github.com/JimmyHuang454/JLS-go@v0.0.0-20230831150107-90d536585ba0/internal/types/testdata/fixedbugs/issue42881.go (about) 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 ( 8 T1 interface{ comparable } 9 T2 interface{ int } 10 ) 11 12 var ( 13 _ comparable // ERROR cannot use type comparable outside a type constraint: interface is \(or embeds\) comparable 14 _ T1 // ERROR cannot use type T1 outside a type constraint: interface is \(or embeds\) comparable 15 _ T2 // ERROR cannot use type T2 outside a type constraint: interface contains type constraints 16 )