* Go patch committed: Support alias to pointer type as method receiver
@ 2019-01-30 16:25 Ian Lance Taylor
2019-02-01 15:01 ` Ian Lance Taylor
0 siblings, 1 reply; 2+ messages in thread
From: Ian Lance Taylor @ 2019-01-30 16:25 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 244 bytes --]
This patch by Ben Shi to the Go frontend fixes it to support an
aliases to a pointer type as a method receiver. This fixes
https://golang.org/issue/28252. Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu. Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1016 bytes --]
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 268369)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-5af8ee0693944c280b1f529450dbfd4ec1ee451d
+2206f40fc1e0e1e2ba3eacb7388dd26b72729bde
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: gcc/go/gofrontend/gogo.cc
===================================================================
--- gcc/go/gofrontend/gogo.cc (revision 268369)
+++ gcc/go/gofrontend/gogo.cc (working copy)
@@ -1944,6 +1944,10 @@ Gogo::start_function(const std::string&
go_assert(at_top_level);
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Go patch committed: Support alias to pointer type as method receiver
2019-01-30 16:25 Go patch committed: Support alias to pointer type as method receiver Ian Lance Taylor
@ 2019-02-01 15:01 ` Ian Lance Taylor
0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2019-02-01 15:01 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 532 bytes --]
On Wed, Jan 30, 2019 at 7:57 AM Ian Lance Taylor <iant@golang.org> wrote:
>
> This patch by Ben Shi to the Go frontend fixes it to support an
> aliases to a pointer type as a method receiver. This fixes
> https://golang.org/issue/28252. Bootstrapped and ran Go testsuite on
> x86_64-pc-linux-gnu. Committed to mainline.
This patch, also by Ben Shi, extends the same idea to a method
declaration. This fixes https://golang.org/issue/27994. Bootstrapped
and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1350 bytes --]
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 268397)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-2206f40fc1e0e1e2ba3eacb7388dd26b72729bde
+cbcc538adc5177778da5788d1101e16f106a1514
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: gcc/go/gofrontend/gogo.cc
===================================================================
--- gcc/go/gofrontend/gogo.cc (revision 268397)
+++ gcc/go/gofrontend/gogo.cc (working copy)
@@ -2096,12 +2096,20 @@ Gogo::declare_function(const std::string
// 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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-01 15:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 16:25 Go patch committed: Support alias to pointer type as method receiver Ian Lance Taylor
2019-02-01 15:01 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).