mirror of
https://github.com/golang/go
synced 2024-11-19 00:44:40 -07:00
go.tools/go/ssa/interp: improve "no such method" error.
LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/59740043
This commit is contained in:
parent
08fadac071
commit
b2557286bb
@ -177,7 +177,11 @@ func lookupMethod(i *interpreter, typ types.Type, meth *types.Func) *ssa.Functio
|
||||
case errorType:
|
||||
return i.errorMethods[meth.Id()]
|
||||
}
|
||||
return i.prog.Method(i.prog.MethodSets.MethodSet(typ).Lookup(meth.Pkg(), meth.Name()))
|
||||
sel := i.prog.MethodSets.MethodSet(typ).Lookup(meth.Pkg(), meth.Name())
|
||||
if sel == nil {
|
||||
panic(fmt.Sprintf("%s has no method %s (of type %s)", typ, meth.Id(), meth.Type()))
|
||||
}
|
||||
return i.prog.Method(sel)
|
||||
}
|
||||
|
||||
// visitInstr interprets a single ssa.Instruction within the activation
|
||||
|
Loading…
Reference in New Issue
Block a user