]> Cypherpunks repositories - gostls13.git/commit
go/types: if base type for an alias is known, use it when needed
authorRobert Griesemer <gri@golang.org>
Wed, 8 Aug 2018 00:53:59 +0000 (17:53 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 8 Aug 2018 16:54:21 +0000 (16:54 +0000)
commite7bce08493297c09856d3a14d018bc0f3c0319cc
treecff9771fd41079e6f32420901942117d0ec6166c
parent884eea6f0a673e29491afaee661b4d71f93b7287
go/types: if base type for an alias is known, use it when needed

Because methods are type-checked before the receiver base type
is "complete" (i.e., they are checked as part of the receiver
base type), situations occur where aliases of those base types
are used (in those methods) but the alias types are not known
yet (even though their base types are known).

This fix is a temporary work-around that looks syntactically
for the base types of alias types and uses those base types
when we refer to an "incomplete" alias type. The work-around
is completely localized and guarded with a flag so it can be
disabled at short notice.

The correct fix (slated for 1.12) is to decouple type-checking
of methods from their receiver base types. See issue #26854.

Fixes #26390.

Change-Id: I66cc9d834b220c254ac00e671a137cf8a3da59c1
Reviewed-on: https://go-review.googlesource.com/128435
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/go/types/check_test.go
src/go/types/decl.go
src/go/types/testdata/issue26390.src [new file with mode: 0644]