1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 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
-
-
- // StringableSignedInteger OMIT
- type StringableSignedInteger interface {
- ~int | ~int8 | ~int16 | ~int32 | ~int64
- String() string
- }
- // StringableSignedInteger OMIT
|