Исходники и презентации
This commit is contained in:
21
lessons/generics_and_reflection/constraints_union/main.go
Normal file
21
lessons/generics_and_reflection/constraints_union/main.go
Normal file
@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
type _ interface {
|
||||
[]int | comparable // compilation error
|
||||
}
|
||||
|
||||
type _ interface {
|
||||
string | error // compilation error
|
||||
}
|
||||
|
||||
type _ interface {
|
||||
string | interface{ Do() } // compilation error
|
||||
}
|
||||
|
||||
type _ interface {
|
||||
string | interface{ int } // ok
|
||||
}
|
||||
|
||||
type _ interface {
|
||||
string | interface{} // ok
|
||||
}
|
||||
Reference in New Issue
Block a user