diff options
author | Dan Scales <danscales@google.com> | 2021-06-04 18:17:49 -0700 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-06-07 19:34:39 +0000 |
commit | 201d55e6376365dc5e8c2392e34fdf7ee8a4b63e (patch) | |
tree | 9e2968c64eb1c7e51604f51627634e2262d78d31 /test/typeparam/mutualimp.dir | |
parent | 7c8a5be2d6f26caed84c6bae2a115872af5b1021 (diff) | |
download | go-201d55e6376365dc5e8c2392e34fdf7ee8a4b63e.tar.gz go-201d55e6376365dc5e8c2392e34fdf7ee8a4b63e.zip |
[dev.typeparams] cmd/compile: create .dict Param in the package of the instantiated function
The instantiated functions are created in the source package of the
generic function, so all lookups of symbols should be relative to that
package, so all symbols are consistently in the source package.
Fixes #46575
Change-Id: Iba67b2ba8014a630c5d4e032c0f2f2fbaaedce65
Reviewed-on: https://go-review.googlesource.com/c/go/+/325529
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/typeparam/mutualimp.dir')
-rw-r--r-- | test/typeparam/mutualimp.dir/a.go | 11 | ||||
-rw-r--r-- | test/typeparam/mutualimp.dir/b.go | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/typeparam/mutualimp.dir/a.go b/test/typeparam/mutualimp.dir/a.go new file mode 100644 index 0000000000..56ca57cea5 --- /dev/null +++ b/test/typeparam/mutualimp.dir/a.go @@ -0,0 +1,11 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +type X int +func (x X) M() X { return x } + +func F[T interface{ M() U }, U interface{ M() T }]() {} +func G() { F[X, X]() } diff --git a/test/typeparam/mutualimp.dir/b.go b/test/typeparam/mutualimp.dir/b.go new file mode 100644 index 0000000000..83cc3af283 --- /dev/null +++ b/test/typeparam/mutualimp.dir/b.go @@ -0,0 +1,12 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package b + +import "./a" + +func H() { + a.F[a.X, a.X]() + a.G() +} |