compiler: avoid compiler crash on invalid program

I encountered this crash while working on upgrading libgo to the 1.9
release.  I no longer have the cause of the crash, but it doesn't much
matter, as the policy for crash-on-invalid errors is to fix the crash
but not bother to commit the invalid test case.

Change-Id: I0b971dad0865114435b2bb43f8b8899d67b47e33
Reviewed-on: https://go-review.googlesource.com/62750
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/go/expressions.cc b/go/expressions.cc
index 1e4d906..82de4d8 100644
--- a/go/expressions.cc
+++ b/go/expressions.cc
@@ -210,7 +210,11 @@
     }
 
   // This should have been checked already.
-  go_assert(lhs_interface_type->implements_interface(rhs_type, NULL));
+  if (!lhs_interface_type->implements_interface(rhs_type, NULL))
+    {
+      go_assert(saw_errors());
+      return Expression::make_error(location);
+    }
 
   // An interface is a tuple.  If LHS_TYPE is an empty interface type,
   // then the first field is the type descriptor for RHS_TYPE.