]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] cmd/compile/internal/importer: key tparams by Package instead...
authorRobert Findley <rfindley@google.com>
Mon, 21 Mar 2022 20:08:38 +0000 (16:08 -0400)
committerCherry Mui <cherryyz@google.com>
Mon, 4 Apr 2022 19:57:18 +0000 (19:57 +0000)
commit69bc821a010e60a40d6575e793e14b3e616b005b
tree9ffce9895f50a9a2bb74d4b8fa734512b6f65f07
parentc258e9d07dce0ef156d5a9c930bc15e3a0276599
[release-branch.go1.18] cmd/compile/internal/importer: key tparams by Package instead of pkgname

The importer type param index used package name as type parameter key,
causing type parameters to be reused/overwritten if two packages in the
import graph had the same combination of (package name, declaration
name, type parameter name).

Fix this by instead using the *Package in the key.

Note: -G=3 was added to typeparam/issue51836.go, as it is necessary for
1.18 but not for tip.

For #51836
Fixes #51847

Change-Id: I881ceaf3cf7c1ab4e0835962350feb552e79b233
Reviewed-on: https://go-review.googlesource.com/c/go/+/394219
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
(cherry picked from commit fd1b5904ae7cc76eefd94d315f92265da5b81b14)
Reviewed-on: https://go-review.googlesource.com/c/go/+/394854
src/cmd/compile/internal/importer/iimport.go
src/go/internal/gcimporter/iimport.go
test/typeparam/issue51836.dir/a.go [new file with mode: 0644]
test/typeparam/issue51836.dir/aa.go [new file with mode: 0644]
test/typeparam/issue51836.dir/p.go [new file with mode: 0644]
test/typeparam/issue51836.go [new file with mode: 0644]