File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -89,3 +89,17 @@ func fn11[T ~struct{ Field int }]() { // unused
89
89
// don't crash because of the composite literal
90
90
_ = T {Field : 42 }
91
91
}
92
+
93
+ type convertGeneric1 struct { // used
94
+ field int // used
95
+ }
96
+
97
+ type convertGeneric2 struct { // used
98
+ field int // used
99
+ }
100
+
101
+ var _ = convertGeneric1 {}.field // mark field as used
102
+
103
+ func Fn12 [T1 convertGeneric1 , T2 convertGeneric2 ](a T1 ) { // used
104
+ _ = T2 (a ) // conversion marks T2.field as used
105
+ }
Original file line number Diff line number Diff line change @@ -1662,8 +1662,8 @@ func (g *graph) instructions(fn *ir.Function) {
1662
1662
case * ir.ChangeType :
1663
1663
// conversion type handled generically
1664
1664
1665
- s1 , ok1 := typeutil .Dereference (instr .Type ()). Underlying ( ).(* types.Struct )
1666
- s2 , ok2 := typeutil .Dereference (instr .X .Type ()). Underlying ( ).(* types.Struct )
1665
+ s1 , ok1 := typeutil .CoreType ( typeutil . Dereference (instr .Type ())).(* types.Struct )
1666
+ s2 , ok2 := typeutil .CoreType ( typeutil . Dereference (instr .X .Type ())).(* types.Struct )
1667
1667
if ok1 && ok2 {
1668
1668
// Converting between two structs. The fields are
1669
1669
// relevant for the conversion, but only if the
You can’t perform that action at this time.
0 commit comments