diff options
| author | Dan Scales <danscales@google.com> | 2021-11-19 12:13:04 -0800 |
|---|---|---|
| committer | Dan Scales <danscales@google.com> | 2021-11-20 01:00:16 +0000 |
| commit | be18cd51dec6ac460949e96231dd05becc2cbcf7 (patch) | |
| tree | 2875aaca75bf540e6ffcd81f33a71ee3de174b8b /test/typeparam | |
| parent | d2f4c935f2e247dd9949094c8a4f3ab8df2ba3a0 (diff) | |
| download | go-be18cd51dec6ac460949e96231dd05becc2cbcf7.tar.xz | |
cmd/compile: ensure generic function is loaded when it needs to be re-exported
In the case where we need to re-export a generic function/method from
another package in the export data of the current package, make sure it
is loaded before trying to write it out.
Fixed #49667
Change-Id: I177754bb762689f34cf5c8ad246d43f1cdbbf195
Reviewed-on: https://go-review.googlesource.com/c/go/+/365837
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/typeparam')
| -rw-r--r-- | test/typeparam/issue49667.dir/a.go | 12 | ||||
| -rw-r--r-- | test/typeparam/issue49667.dir/b.go | 11 | ||||
| -rw-r--r-- | test/typeparam/issue49667.dir/main.go | 11 | ||||
| -rw-r--r-- | test/typeparam/issue49667.go | 7 |
4 files changed, 41 insertions, 0 deletions
diff --git a/test/typeparam/issue49667.dir/a.go b/test/typeparam/issue49667.dir/a.go new file mode 100644 index 0000000000..3b1889f699 --- /dev/null +++ b/test/typeparam/issue49667.dir/a.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 a + +type A[T any] struct { +} + +func (a A[T]) F() { + _ = a +} diff --git a/test/typeparam/issue49667.dir/b.go b/test/typeparam/issue49667.dir/b.go new file mode 100644 index 0000000000..e7f781e4af --- /dev/null +++ b/test/typeparam/issue49667.dir/b.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 b + +import "a" + +type B[T any] struct { + _ a.A[T] +} diff --git a/test/typeparam/issue49667.dir/main.go b/test/typeparam/issue49667.dir/main.go new file mode 100644 index 0000000000..fccefe023f --- /dev/null +++ b/test/typeparam/issue49667.dir/main.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 main + +import "b" + +func main() { + var _ b.B[int] +} diff --git a/test/typeparam/issue49667.go b/test/typeparam/issue49667.go new file mode 100644 index 0000000000..76930e5e4f --- /dev/null +++ b/test/typeparam/issue49667.go @@ -0,0 +1,7 @@ +// rundir -G=3 + +// 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 ignored |
