modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue21273.go (about) 1 // errorcheck 2 3 // Copyright 2017 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 package main 8 9 type T0 T0 // ERROR "invalid recursive type" 10 type _ map[T0]int 11 12 type T1 struct{ T1 } // ERROR "invalid recursive type" 13 type _ map[T1]int 14 15 func f() { 16 type T2 T2 // ERROR "invalid recursive type" 17 type _ map[T2]int 18 } 19 20 func g() { 21 type T3 struct{ T3 } // ERROR "invalid recursive type" 22 type _ map[T3]int 23 } 24 25 func h() { 26 type T4 struct{ m map[T4]int } // ERROR "invalid map key" 27 type _ map[T4]int // ERROR "invalid map key" 28 }