compiler: support alias to pointer type as receiver in method declaration
Fixes golang/go#27994.
Change-Id: I7549468d567bf6baf6afee4aa3d8cafcd79b449f
Reviewed-on: https://go-review.googlesource.com/c/160459
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/go/gogo.cc b/go/gogo.cc
index b03051c..6e1f1af 100644
--- a/go/gogo.cc
+++ b/go/gogo.cc
@@ -2096,12 +2096,20 @@
// declarations.
Type* rtype = type->receiver()->type();
+ while (rtype->named_type() != NULL
+ && rtype->named_type()->is_alias())
+ rtype = rtype->named_type()->real_type()->forwarded();
+
// We want to look through the pointer created by the
// parser, without getting an error if the type is not yet
// defined.
if (rtype->classification() == Type::TYPE_POINTER)
rtype = rtype->points_to();
+ while (rtype->named_type() != NULL
+ && rtype->named_type()->is_alias())
+ rtype = rtype->named_type()->real_type()->forwarded();
+
if (rtype->is_error_type())
return NULL;
else if (rtype->named_type() != NULL)