honnef.co/go/tools@v0.5.0-0.dev.0.20240520180541-dcae280a5e87/simple/s1016/testdata/src/example.com/CheckSimplerStructConversion/convert_generics.go (about) 1 //go:build go1.18 2 3 package pkg 4 5 type T1 struct { 6 A int 7 B int 8 } 9 10 type T2 struct { 11 A int 12 B int 13 } 14 15 type T3[T any] struct { 16 A T 17 B T 18 } 19 20 type T4[T any] struct { 21 A T 22 B T 23 } 24 25 func _() { 26 t1 := T1{0, 0} 27 t3 := T3[int]{0, 0} 28 29 _ = T2{t1.A, t1.B} //@ diag(`(type T1) to T2`) 30 _ = T2{t3.A, t3.B} //@ diag(`(type T3[int]) to T2`) 31 32 _ = T4[int]{t1.A, t1.B} //@ diag(`(type T1) to T4[int]`) 33 _ = T4[int]{t3.A, t3.B} //@ diag(`(type T3[int]) to T4[int]`) 34 35 _ = T4[any]{t3.A, t3.B} 36 }