This matches the compiler's long-standing behavior.
For #55326.
Change-Id: Icd946b031b1b6e65498fb52bceb4a53807732463
Reviewed-on: https://go-review.googlesource.com/c/go/+/432556
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
}
}
if exp == nil {
- check.errorf(e.Sel, _UndeclaredImportedName, "%s not declared by package C", sel)
+ check.errorf(e.Sel, _UndeclaredImportedName, "undefined: %s", syntax.Expr(e)) // cast to syntax.Expr to silence vet
goto Error
}
check.objDecl(exp, nil)
exp = pkg.scope.Lookup(sel)
if exp == nil {
if !pkg.fake {
- if check.conf.CompilerErrorMessages {
- check.errorf(e.Sel, _UndeclaredImportedName, "undefined: %s.%s", pkg.name, sel)
- } else {
- check.errorf(e.Sel, _UndeclaredImportedName, "%s not declared by package %s", sel, pkg.name)
- }
+ check.errorf(e.Sel, _UndeclaredImportedName, "undefined: %s", syntax.Expr(e))
}
goto Error
}
}
}
if exp == nil {
- check.errorf(e.Sel, _UndeclaredImportedName, "%s not declared by package C", sel)
+ check.errorf(e.Sel, _UndeclaredImportedName, "undefined: %s", ast.Expr(e)) // cast to ast.Expr to silence vet
goto Error
}
check.objDecl(exp, nil)
exp = pkg.scope.Lookup(sel)
if exp == nil {
if !pkg.fake {
- check.errorf(e.Sel, _UndeclaredImportedName, "%s not declared by package %s", sel, pkg.name)
+ check.errorf(e.Sel, _UndeclaredImportedName, "undefined: %s", ast.Expr(e))
}
goto Error
}
t13 int = a /* ERROR "shifted operand" */ << d
t14 int = i << j
t15 math /* ERROR "not in selector" */
- t16 math.xxx /* ERROR "not declared" */
+ t16 math.xxx /* ERROR "undefined" */
t17 math /* ERROR "not a type" */ .Pi
t18 float64 = math.Pi * 10.0
t19 int = t1 /* ERROR "cannot call" */ ()
nosuchtype /* ERROR undefined: nosuchtype */
}
type _ interface {
- fmt.Nosuchtype /* ERROR Nosuchtype not declared by package fmt */
+ fmt.Nosuchtype /* ERROR undefined: fmt\.Nosuchtype */
}
type _ interface {
nosuchpkg /* ERROR undefined: nosuchpkg */ .Nosuchtype