aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/testdata/check/typeinst2.go2
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/types/testdata/check/typeinst2.go2')
-rw-r--r--src/go/types/testdata/check/typeinst2.go229
1 files changed, 15 insertions, 14 deletions
diff --git a/src/go/types/testdata/check/typeinst2.go2 b/src/go/types/testdata/check/typeinst2.go2
index 6e2104a515..ab56ccafc9 100644
--- a/src/go/types/testdata/check/typeinst2.go2
+++ b/src/go/types/testdata/check/typeinst2.go2
@@ -148,15 +148,15 @@ func _[T any](r R2[T, int], p *R2[string, T]) {
p.pm()
}
-// An interface can (explicitly) declare at most one type list.
+// It is ok to have multiple embedded unions.
type _ interface {
m0()
- type int, string, bool
- type /* ERROR multiple type lists */ float32, float64
+ ~int | ~string | ~bool
+ ~float32 | ~float64
m1()
m2()
- type /* ERROR multiple type lists */ complex64, complex128
- type /* ERROR multiple type lists */ rune
+ ~complex64 | ~complex128
+ ~rune
}
// Interface type lists may contain each type at most once.
@@ -164,23 +164,24 @@ type _ interface {
// for them to be all in a single list, and we report the error
// as well.)
type _ interface {
- type int, int /* ERROR duplicate type int */
- type /* ERROR multiple type lists */ int /* ERROR duplicate type int */
+ ~int|~ /* ERROR duplicate term int */ int
+ ~int|int /* ERROR duplicate term int */
+ int|int /* ERROR duplicate term int */
}
type _ interface {
- type struct{f int}, struct{g int}, struct /* ERROR duplicate type */ {f int}
+ ~struct{f int} | ~struct{g int} | ~ /* ERROR duplicate term */ struct{f int}
}
// Interface type lists can contain any type, incl. *Named types.
// Verify that we use the underlying type to compute the operational type.
type MyInt int
-func add1[T interface{type MyInt}](x T) T {
+func add1[T interface{MyInt}](x T) T {
return x + 1
}
type MyString string
-func double[T interface{type MyInt, MyString}](x T) T {
+func double[T interface{MyInt|MyString}](x T) T {
return x + x
}
@@ -189,15 +190,15 @@ func double[T interface{type MyInt, MyString}](x T) T {
// type lists.
type E0 interface {
- type int, bool, string
+ ~int | ~bool | ~string
}
type E1 interface {
- type int, float64, string
+ ~int | ~float64 | ~string
}
type E2 interface {
- type float64
+ ~float64
}
type I0 interface {
@@ -246,7 +247,7 @@ var _ = f12[float64]
type I0_ interface {
E0
- type int
+ ~int
}
func f0_[T I0_]()