From 4ff0e04c2e409aaeebe0cf5287dbed735f84e974 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 12 Jul 2021 22:39:39 -0700 Subject: [dev.typeparams] cmd/compile/internal/types2: embedding stand-alone type parameters is not permitted For #47127. Change-Id: Ie979ff56ae7c2dd0e5ce0ff39588f98ae68b5ee9 Reviewed-on: https://go-review.googlesource.com/c/go/+/334151 Trust: Robert Griesemer Run-TryBot: Robert Griesemer TryBot-Result: Go Bot Reviewed-by: Robert Findley --- test/typeparam/typelist.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/typeparam') diff --git a/test/typeparam/typelist.go b/test/typeparam/typelist.go index bd90d86fcf..5c51c9c461 100644 --- a/test/typeparam/typelist.go +++ b/test/typeparam/typelist.go @@ -67,6 +67,8 @@ 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. +// Cannot embed stand-alone type parameters. Disabled for now. +/* func f0[A any, B interface{type C}, C interface{type D}, D interface{type A}](A, B, C, D) func _() { f := f0[string] @@ -82,6 +84,7 @@ func _() { f(0, 0) f1(0, 0) } +*/ func f2[A any, B interface{type []A}](_ A, _ B) func _() { @@ -92,6 +95,8 @@ func _() { // f2(0, []byte{}) - this one doesn't work } +// Cannot embed stand-alone type parameters. Disabled for now. +/* func f3[A any, B interface{type C}, C interface{type *A}](a A, _ B, c C) func _() { f := f3[int] @@ -99,6 +104,7 @@ func _() { f(x, &x, &x) f3(x, &x, &x) } +*/ func f4[A any, B interface{type []C}, C interface{type *A}](_ A, _ B, c C) func _() { -- cgit v1.3