simple/s1016/testdata/go1.18/CheckSimplerStructConversion/convert_generics.go.golden
raw| 1 | package pkg |
| 2 | |
| 3 | type T1 struct { |
| 4 | A int |
| 5 | B int |
| 6 | } |
| 7 | |
| 8 | type T2 struct { |
| 9 | A int |
| 10 | B int |
| 11 | } |
| 12 | |
| 13 | type T3[T any] struct { |
| 14 | A T |
| 15 | B T |
| 16 | } |
| 17 | |
| 18 | type T4[T any] struct { |
| 19 | A T |
| 20 | B T |
| 21 | } |
| 22 | |
| 23 | func _() { |
| 24 | t1 := T1{0, 0} |
| 25 | t3 := T3[int]{0, 0} |
| 26 | |
| 27 | _ = T2(t1) //@ diag(`(type T1) to T2`) |
| 28 | _ = T2(t3) //@ diag(`(type T3[int]) to T2`) |
| 29 | |
| 30 | _ = T4[int](t1) //@ diag(`(type T1) to T4[int]`) |
| 31 | _ = T4[int](t3) //@ diag(`(type T3[int]) to T4[int]`) |
| 32 | |
| 33 | _ = T4[any]{t3.A, t3.B} |
| 34 | } |