mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
![Dan Scales](/assets/img/avatar_default.png)
In a method declaration "func (f *Foo[_, _]) String() string { ... }", the two blank typeparams have the same name, but our current design with types1 needs unique names for type params. Similarly, for export/import, we need unique names to keep the type params straight in generic types and connect the proper type param with the proper constraint. We make blank type params unique by changing them to $1, $2, etc in noder.typ0() via typecheck.TparamExportName(). We then revert $<num> back to _ during type2 import via typecheck.TparamName(). We similarly revert during gcimporter import. We don't need/want to revert in the types1 importer, since we want unique names for type params. Rob Findley has made a similar change to x/tools (and we tried to make the source code changes similar for the gcimporter and types2 importer changes). Fixes #50419 Change-Id: I855cc3d90d06bcf59541ed0c879e9a0e4ede45bb Reviewed-on: https://go-review.googlesource.com/c/go/+/379194 Reviewed-by: Robert Griesemer <gri@golang.org> Trust: Dan Scales <danscales@google.com>
2 lines
2 B
Plaintext
2 lines
2 B
Plaintext
0
|