1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package p 6 7 func f[S []T, T any](S, T) {} 8 9 func _() { 10 type L chan int 11 f([]L{}, make(chan int)) 12 f([]L{}, make(L)) 13 f([]chan int{}, make(chan int)) 14 f /* ERROR "[]chan int does not satisfy []L ([]chan int missing in []p.L)" */ ([]chan int{}, make(L)) 15 } 16 17 // test case from issue 18 19 func Append[S ~[]T, T any](s S, x ...T) S { /* implementation of append */ return s } 20 21 func _() { 22 type MyPtr *int 23 var x []MyPtr 24 _ = append(x, new(int)) 25 _ = Append(x, new(int)) 26 } 27