@@ -174,30 +174,36 @@ func (subst *subster) node(n ir.Node) ir.Node {
174
174
}
175
175
ir .EditChildren (m , edit )
176
176
177
- // A method value/call via a type param will have been left as an
178
- // OXDOT. When we see this during stenciling, finish the
179
- // typechecking, now that we have the instantiated receiver type.
180
- // We need to do this now, since the access/selection to the
181
- // method for the real type is very different from the selection
182
- // for the type param.
183
177
if x .Op () == ir .OXDOT {
184
- // Will transform to an OCALLPART
178
+ // A method value/call via a type param will have been left as an
179
+ // OXDOT. When we see this during stenciling, finish the
180
+ // typechecking, now that we have the instantiated receiver type.
181
+ // We need to do this now, since the access/selection to the
182
+ // method for the real type is very different from the selection
183
+ // for the type param.
185
184
m .SetTypecheck (0 )
185
+ // m will transform to an OCALLPART
186
186
typecheck .Expr (m )
187
187
}
188
188
if x .Op () == ir .OCALL {
189
189
call := m .(* ir.CallExpr )
190
- if call .X .Op () != ir .OCALLPART {
191
- base .FatalfAt (call .Pos (), "Expecting OXDOT with CALL" )
190
+ if call .X .Op () == ir .OTYPE {
191
+ // Do typechecking on a conversion, now that we
192
+ // know the type argument.
193
+ m .SetTypecheck (0 )
194
+ m = typecheck .Expr (m )
195
+ } else if call .X .Op () == ir .OCALLPART {
196
+ // Redo the typechecking, now that we know the method
197
+ // value is being called.
198
+ call .X .(* ir.SelectorExpr ).SetOp (ir .OXDOT )
199
+ call .X .SetTypecheck (0 )
200
+ call .X .SetType (nil )
201
+ typecheck .Callee (call .X )
202
+ m .SetTypecheck (0 )
203
+ typecheck .Call (m .(* ir.CallExpr ))
204
+ } else {
205
+ base .FatalfAt (call .Pos (), "Expecting OCALLPART or OTYPE with CALL" )
192
206
}
193
- // Redo the typechecking, now that we know the method
194
- // value is being called
195
- call .X .(* ir.SelectorExpr ).SetOp (ir .OXDOT )
196
- call .X .SetTypecheck (0 )
197
- call .X .SetType (nil )
198
- typecheck .Callee (call .X )
199
- m .SetTypecheck (0 )
200
- typecheck .Call (m .(* ir.CallExpr ))
201
207
}
202
208
203
209
if x .Op () == ir .OCLOSURE {
0 commit comments