You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Relevant code is here in cmd/compile/internal/gc/typecheck.go:
ifn.Left.Op==OTYPE {
if!looktypedot(n, t, 0) {
iflooktypedot(n, t, 1) {
yyerror("%v undefined (cannot refer to unexported method %v)", n, n.Sym)
} else {
yyerror("%v undefined (type %v has no method %v)", n, t, n.Sym)
}
n.Type=nilreturnn
}
So maybe the problem is in the representation of n.Sym? Also fine with this being closed as "this is expected behavior."
minux
changed the title
all: extraneous quotes in "unexported method or field" error message?
cmd/compile: extraneous quotes in "unexported method or field" error message
Dec 23, 2016
@kevinburke I've taken a stab at this - feel free to review the CL if you're at all familiar with cmd/compile :)
Also, FYI, you were slightly off in where the error actually occurs. The place is:
case lookdot(n, t, 1) != nil:
// Field or method matches by name, but it is not exported.
yyerror("%v undefined (cannot refer to unexported field or method %v)", n, n.Sym)
But I believe this doesn't matter, as the problem is that n.Sym.String() is what includes the weird ."" part. My CL above changes the contents of n.Sym.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?tip
What operating system and processor architecture are you using (
go env
)?Irrelevant
What did you do?
https://play.golang.org/p/BzZjqEx-Jk
What did you see instead?
The error message has an extra set of quotes:
I'd expect it to read:
The text was updated successfully, but these errors were encountered: