codekingpro/portable-devtools
114k
1// run2 3// Copyright 2021 The Go Authors. All rights reserved.4// Use of this source code is governed by a BSD-style5// license that can be found in the LICENSE file.6 7package main8 9type Recv <-chan int10 11type sliceOf[E any] interface {12 ~[]E13}14 15func _Append[S sliceOf[T], T any](s S, t ...T) S {16 return append(s, t...)17}18 19func 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 