Skip to content

Commit 9cd58b0

Browse files
committed
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 <[email protected]> Run-TryBot: Robert Griesemer <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Peter Weinberger <[email protected]>
1 parent 7b0b504 commit 9cd58b0

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

cmd/stringer/testdata/typeparams/conv2.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@ package main
1010

1111
import "fmt"
1212

13-
type Other[T interface{ ~int | ~uint }] T // Imagine this is in another package.
13+
// For now, a lone type parameter is not permitted as RHS in a type declaration (issue #45639).
14+
// type Other[T interface{ ~int | ~uint }] T // Imagine this is in another package.
15+
type Other int
1416

1517
const (
16-
alpha Other[int] = iota
18+
// alpha Other[int] = iota
19+
alpha Other = iota
1720
beta
1821
gamma
1922
delta
2023
)
2124

22-
type Conv2 Other[int]
25+
// type Conv2 Other[int]
26+
type Conv2 Other
2327

2428
const (
2529
Alpha = Conv2(alpha)

cmd/stringer/testdata/typeparams/prime2.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ package main
1111

1212
import "fmt"
1313

14-
type Likeint[T interface{ ~int | ~uint8 }] T
14+
// For now, a lone type parameter is not permitted as RHS in a type declaration (issue #45639).
15+
// type Likeint[T interface{ ~int | ~uint8 }] T
16+
type Likeint int
1517

16-
type Prime2 Likeint[int]
18+
// type Prime2 Likeint[int]
19+
type Prime2 Likeint
1720

1821
const (
1922
p2 Prime2 = 2

0 commit comments

Comments
 (0)