]> Cypherpunks.ru repositories - gostls13.git/commit
go/types, types2: point out type parameters with predeclared names in errors
authorRobert Griesemer <gri@golang.org>
Tue, 21 Feb 2023 22:42:18 +0000 (14:42 -0800)
committerGopher Robot <gobot@golang.org>
Wed, 22 Feb 2023 00:40:19 +0000 (00:40 +0000)
commit5e6ccd12236167fb28b72040dacef6859d4a8710
treef02314dae46327df8439977fc195ad2a026834ea
parent22a65ba7b7276b67237198db4609cf3e4bde34e7
go/types, types2: point out type parameters with predeclared names in errors

If a type parameter has the same name as a predeclared type, error
messages can be very confusing. In these rare cases, explicitly
point out where the type parameter is declared (types2) or that it
is a type parameter (go/types).

(We can't point out where the type parameter is declared in go/types
because we don't have access to the file set in the type writer at
the moment.)

Fixes #58611.

Change-Id: I5c150c2b0afae5fad320821e7e5935090dc2ef4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/470075
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/types2/typestring.go
src/go/types/typestring.go
src/internal/types/testdata/fixedbugs/issue58611.go [new file with mode: 0644]