aboutsummaryrefslogtreecommitdiff
path: root/test/typeparam
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-09-10 08:34:03 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-09-14 02:53:17 +0000
commitee91bb83198f61aa8f26c3100ca7558d302c0a98 (patch)
treea812fdbb40a9c424979e4f72bd5dcddc1bfef990 /test/typeparam
parent2953cd00836323112846b21f60fa1d68aa0f9a77 (diff)
downloadgo-ee91bb83198f61aa8f26c3100ca7558d302c0a98.tar.xz
cmd/compile: prevent typecheck importer reading type parameter twice
This is a port of CL 349009 to typecheck importer. Fixes #48306 Change-Id: Iec3f078089346bd85f0ab739896e079940325011 Reviewed-on: https://go-review.googlesource.com/c/go/+/349011 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'test/typeparam')
-rw-r--r--test/typeparam/issue48306.dir/a.go9
-rw-r--r--test/typeparam/issue48306.dir/main.go15
-rw-r--r--test/typeparam/issue48306.go7
3 files changed, 31 insertions, 0 deletions
diff --git a/test/typeparam/issue48306.dir/a.go b/test/typeparam/issue48306.dir/a.go
new file mode 100644
index 0000000000..739750b20b
--- /dev/null
+++ b/test/typeparam/issue48306.dir/a.go
@@ -0,0 +1,9 @@
+// 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 I[T I[T]] interface {
+ F() T
+}
diff --git a/test/typeparam/issue48306.dir/main.go b/test/typeparam/issue48306.dir/main.go
new file mode 100644
index 0000000000..5d602fe07c
--- /dev/null
+++ b/test/typeparam/issue48306.dir/main.go
@@ -0,0 +1,15 @@
+// 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 "a"
+
+type S struct{}
+
+func (*S) F() *S { return nil }
+
+func main() {
+ var _ a.I[*S] = &S{}
+}
diff --git a/test/typeparam/issue48306.go b/test/typeparam/issue48306.go
new file mode 100644
index 0000000000..76930e5e4f
--- /dev/null
+++ b/test/typeparam/issue48306.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