@@ -127,13 +127,13 @@ func StaticCall(call *ir.CallExpr) {
127
127
// v.A()
128
128
// v = &Impl{}
129
129
//
130
- // Here in the devirtualizer, we determine the concrete type of v as beeing an *Impl, but
131
- // in can still be a nil interface, but we have not detected that. It is not a huge problem as
132
- // the v.(*Impl) type assertion that we make here would also have failed, but with a different
130
+ // Here in the devirtualizer, we determine the concrete type of v as beeing an *Impl,
131
+ // but in can still be a nil interface, we have not detected that. The v.(*Impl)
132
+ // type assertion that we make here would also have failed, but with a different
133
133
// panic "pkg.Iface is nil, not *pkg.Impl", where previously we would get a nil panic.
134
134
// We fix this, by introducing an additional nilcheck on the itab.
135
- nilCheck := ir . NewUnaryExpr ( call . Pos (), ir . OCHECKNIL , ir . NewUnaryExpr ( call . Pos (), ir . OITAB , sel . X ))
136
- dt .PtrInit (). Append ( typecheck . Stmt ( nilCheck ))
135
+ dt . EmitItabNilCheck = true
136
+ dt .SetPos ( call . Pos ( ))
137
137
}
138
138
139
139
x := typecheck .XDotMethod (sel .Pos (), dt , sel .Sel , true )
@@ -174,14 +174,12 @@ func StaticCall(call *ir.CallExpr) {
174
174
typecheck .FixMethodCall (call )
175
175
}
176
176
177
- // const concreteTypeDebug = false
178
- var concreteTypeDebug = false
177
+ const concreteTypeDebug = false
179
178
180
179
// concreteType determines the concrete type of n, following OCONVIFACEs and type asserts.
181
180
// Returns nil when the concrete type could not be determined, or when there are multiple
182
181
// (different) types assigned to an interface.
183
182
func concreteType (n ir.Node ) (typ * types.Type ) {
184
- concreteTypeDebug = base .Debug .Testing != 0
185
183
return concreteType1 (n , make (map [* ir.Name ]* types.Type ))
186
184
}
187
185
0 commit comments