]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/types2: disallow aliases for generic types
authorRobert Griesemer <gri@golang.org>
Tue, 31 Aug 2021 03:30:25 +0000 (20:30 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 31 Aug 2021 16:43:46 +0000 (16:43 +0000)
commit68152359fdd45e8d51aaaec64075aad4ff8f68b2
treea94c32d5009e0ecdad3d38544bdc739392e4167a
parent605d1aaea26ef775369a3d1da6cf53f2a7b1e640
cmd/compile/internal/types2: disallow aliases for generic types

The existing approach (alias name stands for generic type name)
is an exception: it's the only place where a generic type could
be used without explicit instantiation. The correct solution is
currently under discussion (see proposal issue #46477).

This CL requires that the RHS of an alias type declaration be
an instantiated non-generic type. If #46477 is accepted, the
implementation will require proper representation of alias
types.

Change-Id: Ie85b923213a64f39837e56e38e14757458272b93
Reviewed-on: https://go-review.googlesource.com/c/go/+/346294
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/decl.go
src/cmd/compile/internal/types2/testdata/check/typeinst.go2
src/cmd/compile/internal/types2/testdata/fixedbugs/issue39768.go2
src/cmd/compile/internal/types2/testdata/fixedbugs/issue47968.go2
src/cmd/compile/internal/types2/typexpr.go
test/typeparam/aliasimp.dir/main.go