summaryrefslogtreecommitdiffstats
path: root/test/typeparam/issue50598.dir
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:23:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:23:18 +0000
commit43a123c1ae6613b3efeed291fa552ecd909d3acf (patch)
treefd92518b7024bc74031f78a1cf9e454b65e73665 /test/typeparam/issue50598.dir
parentInitial commit. (diff)
downloadgolang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.tar.xz
golang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.zip
Adding upstream version 1.20.14.upstream/1.20.14upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/typeparam/issue50598.dir')
-rw-r--r--test/typeparam/issue50598.dir/a0.go23
-rw-r--r--test/typeparam/issue50598.dir/a1.go11
-rw-r--r--test/typeparam/issue50598.dir/a2.go11
-rw-r--r--test/typeparam/issue50598.dir/main.go22
4 files changed, 67 insertions, 0 deletions
diff --git a/test/typeparam/issue50598.dir/a0.go b/test/typeparam/issue50598.dir/a0.go
new file mode 100644
index 0000000..61d353e
--- /dev/null
+++ b/test/typeparam/issue50598.dir/a0.go
@@ -0,0 +1,23 @@
+// Copyright 2022 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 a0
+
+type Builder[T any] struct{}
+
+func (r Builder[T]) New1() T {
+ var v T
+ return v
+}
+
+func (r Builder[T]) New2() T {
+ var v T
+ return v
+}
+
+type IntBuilder struct{}
+
+func (b IntBuilder) New() int {
+ return Builder[int]{}.New2()
+}
diff --git a/test/typeparam/issue50598.dir/a1.go b/test/typeparam/issue50598.dir/a1.go
new file mode 100644
index 0000000..36624b4
--- /dev/null
+++ b/test/typeparam/issue50598.dir/a1.go
@@ -0,0 +1,11 @@
+// Copyright 2022 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 a1
+
+import "./a0"
+
+func New() int {
+ return a0.IntBuilder{}.New()
+}
diff --git a/test/typeparam/issue50598.dir/a2.go b/test/typeparam/issue50598.dir/a2.go
new file mode 100644
index 0000000..c28be66
--- /dev/null
+++ b/test/typeparam/issue50598.dir/a2.go
@@ -0,0 +1,11 @@
+// Copyright 2022 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 a2
+
+import "./a0"
+
+func New() int {
+ return a0.Builder[int]{}.New1()
+}
diff --git a/test/typeparam/issue50598.dir/main.go b/test/typeparam/issue50598.dir/main.go
new file mode 100644
index 0000000..b0b6844
--- /dev/null
+++ b/test/typeparam/issue50598.dir/main.go
@@ -0,0 +1,22 @@
+// Copyright 2022 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 (
+ "fmt"
+
+ "./a1"
+ "./a2"
+)
+
+func New() int {
+ return a1.New() + a2.New()
+}
+
+func main() {
+ if got, want := New(), 0; got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+}