compiler: check recursive inherited interface aliases
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 27 Feb 2019 01:41:25 +0000 (01:41 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 27 Feb 2019 01:41:25 +0000 (01:41 +0000)
    Fixes golang/go#25302.

    Reviewed-on: https://go-review.googlesource.com/c/163298

From-SVN: r269241

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/types.cc

index d601bb99cff04e4c2d2aa8ad7f18a0ecb47c701c..bb8a931451eb10ee67f909393b6906b02ce95c20 100644 (file)
@@ -1,4 +1,4 @@
-9c1859b8e97242b0e697a3aaa39a4da5e6172e74
+2c74b84184941ebea318f69fe43a81f657790b63
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 9081af60bdd1d0ac7194cc8a20bc300e9de71202..82f9fb02b400e837a163525c34bebe69b1468b52 100644 (file)
@@ -10329,6 +10329,23 @@ Find_alias::type(Type* type)
        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;
 }