1
2
3
4
5
6
7 package main
8
9 type Recv <-chan int
10
11 type sliceOf[E any] interface {
12 ~[]E
13 }
14
15 func _Append[S sliceOf[T], T any](s S, t ...T) S {
16 return append(s, t...)
17 }
18
19 func main() {
20 recv := make(Recv)
21 a := _Append([]Recv{recv}, recv)
22 if len(a) != 2 || a[0] != recv || a[1] != recv {
23 panic(a)
24 }
25
26 recv2 := make(chan<- int)
27 a2 := _Append([]chan<- int{recv2}, recv2)
28 if len(a2) != 2 || a2[0] != recv2 || a2[1] != recv2 {
29 panic(a)
30 }
31 }
32
View as plain text