123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package main
-
- // TYPE OMIT
- type Integer interface {
- int
- }
-
- // TYPE OMIT
-
- // INVALID OMIT
- // EmbeddedParameter is INVALID.
- type EmbeddedParameter[T any] interface {
- T // INVALID: may not list a plain type parameter
- }
- // INVALID OMIT
-
-
- // APPRO OMIT
- type MyInt int
-
- type AnyInteger interface {
- ~int
- }
- // APPRO OMIT
-
-
- // ALL INVALID OMIT
-
- type MyString string
-
- // ApproximateMyString is INVALID.
- type ApproximateMyString interface {
- ~MyString // INVALID: underlying type of MyString is not MyString
- }
-
- // ApproximateParameter is INVALID.
- type ApproximateParameter[T any] interface {
- ~T // INVALID: T is a type parameter
- }
-
- type MyInterface {}
-
- // ApproximateInterface is INVALID.
- type ApproximateInterface interface {
- ~MyInterface // INVALID: T is an interface type
- }
-
- // ALL INVALID OMIT
-
-
-
-
- // ONION EXAMPLE OMIT
-
- // PredeclaredSignedInteger is a constraint that matches the
- // five predeclared signed integer types.
- type PredeclaredSignedInteger interface {
- int | int8 | int16 | int32 | int64
- }
-
- // SignedInteger is a constraint that matches any signed integer type.
- type SignedInteger interface {
- ~int | ~int8 | ~int16 | ~int32 | ~int64
- }
-
- // ONION EXAMPLE OMIT
|