x/tools/cmd/stringer: adjust generics tests
Per the issue below, a lone type parameter is not permitted
on the the RHS of a type declaration, at least for Go 1.18.
Slightly modified the generics tests so that they pass for
now.
For golang/go#45639.
Change-Id: I3c5dc0ff65bfdc268c372e5e3fdfe00a8547f17e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359274
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
diff --git a/cmd/stringer/testdata/typeparams/conv2.go b/cmd/stringer/testdata/typeparams/conv2.go
index 1563fe8..62e1cb7 100644
--- a/cmd/stringer/testdata/typeparams/conv2.go
+++ b/cmd/stringer/testdata/typeparams/conv2.go
@@ -10,16 +10,20 @@
import "fmt"
-type Other[T interface{ ~int | ~uint }] T // Imagine this is in another package.
+// For now, a lone type parameter is not permitted as RHS in a type declaration (issue #45639).
+// type Other[T interface{ ~int | ~uint }] T // Imagine this is in another package.
+type Other int
const (
- alpha Other[int] = iota
+ // alpha Other[int] = iota
+ alpha Other = iota
beta
gamma
delta
)
-type Conv2 Other[int]
+// type Conv2 Other[int]
+type Conv2 Other
const (
Alpha = Conv2(alpha)
diff --git a/cmd/stringer/testdata/typeparams/prime2.go b/cmd/stringer/testdata/typeparams/prime2.go
index 376c9e2..556db37 100644
--- a/cmd/stringer/testdata/typeparams/prime2.go
+++ b/cmd/stringer/testdata/typeparams/prime2.go
@@ -11,9 +11,12 @@
import "fmt"
-type Likeint[T interface{ ~int | ~uint8 }] T
+// For now, a lone type parameter is not permitted as RHS in a type declaration (issue #45639).
+// type Likeint[T interface{ ~int | ~uint8 }] T
+type Likeint int
-type Prime2 Likeint[int]
+// type Prime2 Likeint[int]
+type Prime2 Likeint
const (
p2 Prime2 = 2