go.tools/go/types: use unqualified names for local objects in error messages
LGTM=adonovan R=adonovan CC=golang-codereviews https://golang.org/cl/77590043
This commit is contained in:
parent
5893c271ff
commit
62216e60bb
|
|
@ -27,16 +27,19 @@ func (check *checker) sprintf(format string, args ...interface{}) string {
|
||||||
for i, arg := range args {
|
for i, arg := range args {
|
||||||
switch a := arg.(type) {
|
switch a := arg.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
args[i] = "<nil>"
|
arg = "<nil>"
|
||||||
case operand:
|
case operand:
|
||||||
panic("internal error: should always pass *operand")
|
panic("internal error: should always pass *operand")
|
||||||
case token.Pos:
|
case token.Pos:
|
||||||
args[i] = check.fset.Position(a).String()
|
arg = check.fset.Position(a).String()
|
||||||
case ast.Expr:
|
case ast.Expr:
|
||||||
args[i] = ExprString(a)
|
arg = ExprString(a)
|
||||||
|
case Object:
|
||||||
|
arg = ObjectString(check.pkg, a)
|
||||||
case Type:
|
case Type:
|
||||||
args[i] = TypeString(check.pkg, a)
|
arg = TypeString(check.pkg, a)
|
||||||
}
|
}
|
||||||
|
args[i] = arg
|
||||||
}
|
}
|
||||||
return fmt.Sprintf(format, args...)
|
return fmt.Sprintf(format, args...)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue