aboutsummaryrefslogtreecommitdiff
path: root/test/typeparam/typelist.go
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-03-30 13:42:14 -0700
committerDan Scales <danscales@google.com>2021-03-31 00:52:26 +0000
commitf2717b31b5cf235457631fea1afd6d9df578737c (patch)
tree7e7da7c3cb5cb09323736474399a0be965f0a011 /test/typeparam/typelist.go
parent606e0aba74eda01e15a8c9697ccd82b802bb3501 (diff)
downloadgo-f2717b31b5cf235457631fea1afd6d9df578737c.tar.gz
go-f2717b31b5cf235457631fea1afd6d9df578737c.zip
cmd/compile: deal correctly with unnamed function params during stenciling
During substitution of the function type during stenciling, we must set the Name nodes of the param/result fields of the func type. We get those name nodes from the substituted Dcl nodes of the PPARAMS and PPARAMOUTs. But we must check that the names match with the Dcl nodes, so that we skip any param fields that correspond to unnamed (in) parameters. Added a few tests to typelist.go by removing a variety of unneeded function parameter names. Change-Id: If786961b64549da6f18eeeb5060ea58fab874eb9 Reviewed-on: https://go-review.googlesource.com/c/go/+/305912 Trust: Dan Scales <danscales@google.com> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'test/typeparam/typelist.go')
-rw-r--r--test/typeparam/typelist.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/typeparam/typelist.go b/test/typeparam/typelist.go
index dd674cc889..bd90d86fcf 100644
--- a/test/typeparam/typelist.go
+++ b/test/typeparam/typelist.go
@@ -67,14 +67,14 @@ func _[V any, T interface { type map[string]V }](p T) V {
// Testing partial and full type inference, including the case where the types can
// be inferred without needing the types of the function arguments.
-func f0[A any, B interface{type C}, C interface{type D}, D interface{type A}](a A, b B, c C, d D)
+func f0[A any, B interface{type C}, C interface{type D}, D interface{type A}](A, B, C, D)
func _() {
f := f0[string]
f("a", "b", "c", "d")
f0("a", "b", "c", "d")
}
-func f1[A any, B interface{type A}](a A, b B)
+func f1[A any, B interface{type A}](A, B)
func _() {
f := f1[int]
f(int(0), int(0))
@@ -83,7 +83,7 @@ func _() {
f1(0, 0)
}
-func f2[A any, B interface{type []A}](a A, b B)
+func f2[A any, B interface{type []A}](_ A, _ B)
func _() {
f := f2[byte]
f(byte(0), []byte{})
@@ -92,7 +92,7 @@ func _() {
// f2(0, []byte{}) - this one doesn't work
}
-func f3[A any, B interface{type C}, C interface{type *A}](a A, b B, c C)
+func f3[A any, B interface{type C}, C interface{type *A}](a A, _ B, c C)
func _() {
f := f3[int]
var x int
@@ -100,7 +100,7 @@ func _() {
f3(x, &x, &x)
}
-func f4[A any, B interface{type []C}, C interface{type *A}](a A, b B, c C)
+func f4[A any, B interface{type []C}, C interface{type *A}](_ A, _ B, c C)
func _() {
f := f4[int]
var x int