]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: avoid re-instantiating method that is already imported
authorDan Scales <danscales@google.com>
Mon, 13 Dec 2021 20:42:38 +0000 (12:42 -0800)
committerDan Scales <danscales@google.com>
Mon, 13 Dec 2021 22:45:26 +0000 (22:45 +0000)
commit5b9207ff67bd3df43a95fd403b2e06e2aa4c33bf
tree7680edfebd1ef0c0547a5324cc7cce00247a223f
parent67917c3d78002ebca7de697f4ede74e602701554
cmd/compile: avoid re-instantiating method that is already imported

We can import an shape-instantiated function/method for inlining
purposes. If we are instantiating the methods of a instantiated type
that we have seen, and it happens to need a shape instantiation that we
have imported, then don't re-create the instantiation, since we will end
up with conflicting/duplicate definitions for the instantiation symbol.
Instead, we can just use the existing imported instantation, and enter
it in the instInfoMap[].

Fixes #50121

Change-Id: I6eeb8786faad71106e261e113048b579afad04fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/371414
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/noder/stencil.go
test/typeparam/issue50121.dir/a.go [new file with mode: 0644]
test/typeparam/issue50121.dir/main.go [new file with mode: 0644]
test/typeparam/issue50121.go [new file with mode: 0644]