Source file src/internal/types/testdata/fixedbugs/issue57486.go
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 type C1 interface { 8 comparable 9 } 10 11 type C2 interface { 12 comparable 13 [2]any | int 14 } 15 16 func G1[T C1](t T) { _ = t == t } 17 func G2[T C2](t T) { _ = t == t } 18 19 func F1[V [2]any](v V) { 20 _ = G1[V /* ERROR "V does not satisfy comparable" */] 21 _ = G1[[2]any] 22 _ = G1[int] 23 } 24 25 func F2[V [2]any](v V) { 26 _ = G2[V /* ERROR "V does not satisfy C2" */] 27 _ = G2[[ /* ERROR "[2]any does not satisfy C2 (C2 mentions [2]any, but [2]any is not in the type set of C2)" */ 2]any] 28 _ = G2[int] 29 } 30