1
2
3
4
5 package p
6
7 type C0 interface{ int }
8 type C1 interface{ chan int }
9 type C2 interface{ chan int | <-chan int }
10 type C3 interface{ chan int | chan float32 }
11 type C4 interface{ chan int | chan<- int }
12 type C5[T any] interface{ ~chan T | chan<- T }
13
14 func _[T any](ch T) {
15 ch <- 0
16 }
17
18 func _[T C0](ch T) {
19 ch <- 0
20 }
21
22 func _[T C1](ch T) {
23 ch <- 0
24 }
25
26 func _[T C2](ch T) {
27 ch <- 0
28 }
29
30 func _[T C3](ch T) {
31 ch <- 0
32 }
33
34 func _[T C4](ch T) {
35 ch <- 0
36 }
37
38 func _[T C5[X], X any](ch T, x X) {
39 ch <- x
40 }
41
View as plain text