// Copyright 2021 The Go Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
package p | |
type SliceConstraint[T any] interface { | |
[]T | |
} | |
func Map[S SliceConstraint[E], E any](s S, f func(E) E) S { | |
return s | |
} | |
type MySlice []int | |
func f(s MySlice) { | |
Map[MySlice /* ERROR MySlice does not implement SliceConstraint\[int\] */, int](s, nil) | |
} |