]> Cypherpunks repositories - gostls13.git/commit
go/types: guard against checking instantiation when generics is disabled
authorRob Findley <rfindley@google.com>
Tue, 22 Jun 2021 00:16:37 +0000 (20:16 -0400)
committerRobert Findley <rfindley@google.com>
Tue, 22 Jun 2021 11:31:57 +0000 (11:31 +0000)
commit63daa774b566d7fe58b3aa82cda9e595929bb777
tree890d6ee47bebcab3f88db2cc9a8e70ca7cf43a63
parent197a5ee2ab8b64c687c74b986bf92139057366b6
go/types: guard against checking instantiation when generics is disabled

When type checking t[_], where t is a type name, it was possible to leak
an error message related to generics. Fix this by guarding on
typeparams.Enabled.

In order to test this fix, we need to be able to run the new go/types
test only if type parameters are disabled. Introduce the .go1 test data
suffix (similar to .go2) to control this behavior.

Originally found via fuzzing, though the test case was manually
simplified.

Updates #46404

Change-Id: Ib1e2c27cf974c2a5ca5b9d6d01b84a30ba4d583b
Reviewed-on: https://go-review.googlesource.com/c/go/+/329793
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/check_test.go
src/go/types/testdata/fixedbugs/issue46404.go1 [new file with mode: 0644]
src/go/types/typexpr.go