github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/types/testdata/fixedbugs/issue39938.go (about) 1 // Copyright 2020 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 // All but E2 and E5 provide an "indirection" and break infinite expansion of a type. 8 type E0[P any] []P 9 type E1[P any] *P 10 type E2[P any] struct{ _ P } 11 type E3[P any] struct{ _ *P } 12 type E5[P any] struct{ _ [10]P } 13 14 type T0 struct { 15 _ E0[T0] 16 } 17 18 type T0_ struct { 19 E0[T0_] 20 } 21 22 type T1 struct { 23 _ E1[T1] 24 } 25 26 type T2 /* ERROR "invalid recursive type" */ struct { 27 _ E2[T2] 28 } 29 30 type T3 struct { 31 _ E3[T3] 32 } 33 34 type T4 /* ERROR "invalid recursive type" */ [10]E5[T4] 35 36 type T5 struct { 37 _ E0[E2[T5]] 38 } 39 40 type T6 struct { 41 _ E0[E2[E0[E1[E2[[10]T6]]]]] 42 } 43 44 type T7 struct { 45 _ E0[[10]E2[E0[E2[E2[T7]]]]] 46 } 47 48 type T8 struct { 49 _ E0[[]E2[E0[E2[E2[T8]]]]] 50 } 51 52 type T9 /* ERROR "invalid recursive type" */ [10]E2[E5[E2[T9]]] 53 54 type T10 [10]E2[E5[E2[func(T10)]]]