compiler: check recursive inherited interface aliases

Fixes golang/go#25302.

Change-Id: If56cdf8675b06912260315be4426e1255dec3a9f
Reviewed-on: https://go-review.googlesource.com/c/163298
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/go/types.cc b/go/types.cc
index 9081af6..82f9fb0 100644
--- a/go/types.cc
+++ b/go/types.cc
@@ -10329,6 +10329,23 @@
 	return TRAVERSE_SKIP_COMPONENTS;
     }
 
+  // Check if there are recursive inherited interface aliases.
+  Interface_type* ift = type->interface_type();
+  if (ift != NULL)
+    {
+      const Typed_identifier_list* methods = ift->local_methods();
+      if (methods == NULL)
+	return TRAVERSE_CONTINUE;
+      for (Typed_identifier_list::const_iterator p = methods->begin();
+	   p != methods->end();
+	   ++p)
+	if (p->name().empty() && p->type()->named_type() == this->find_type_)
+	  {
+	    this->found_ = true;
+	    return TRAVERSE_EXIT;
+	  }
+    }
+
   return TRAVERSE_CONTINUE;
 }