Debian Codegraph @

simple/s1016/testdata/go1.0/CheckSimplerStructConversion/convert.go

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 t1
14
15 func fn() {
16 v1 := t1{1, 2}
17 v2 := t2{1, 2}
18 _ = t2{v1.a, v1.b} //@ diag(`should convert v1`)
19 _ = t2{a: v1.a, b: v1.b} //@ diag(`should convert v1`)
20 _ = t2{b: v1.b, a: v1.a} //@ diag(`should convert v1`)
21 _ = t3{v1.a, v1.b} //@ diag(`should convert v1`)
22
23 _ = t3{v1.a, v2.b}
24
25 _ = t2{v1.b, v1.a}
26 _ = t2{a: v1.b, b: v1.a}
27 _ = t2{a: v1.a}
28 _ = t1{v1.a, v1.b}
29
30 v := t1{1, 2}
31 _ = &t2{v.a, v.b}
32 }