-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: confusing error messages when package paths mismatch #16133
Comments
There is actually code in |
Here's a test case that can probably be reduced further.
Sample run:
|
It looks like the respective code in the compiler doesn't trigger because numImport[s.Pkg.Name] is always 0 in this case. Possibly an error in the new importer. Investigating. |
Yes, this got lost in the move from the old textual importer to the new binary one. This is a 1.7 regression. We should probably fix it, the fix is simple; with it, the error message is: tst.go:8: cannot use "/Users/gri/tmp/a".NewX() (type "/Users/gri/tmp/a".X) as type "/Users/gri/tmp/a2".X in field value (I've compiled all packages in the tmp directory.) |
@rogpeppe Thanks for the test case. This is in fact a regression since 1.6, so setting milestone to 1.7maybe. 1.6.2:
1.7beta2:
|
CL https://golang.org/cl/24312 mentions this issue. |
Example error message:
The error was actually that I'd imported the names package from the wrong path.
It would be nice if the error message could make that clearer - as it is, it
it confusing because both types look identical.
For example:
Another possibility might be to do general disambiguation when more than one
identical package name referring to a different path is used in the same error
message.
For example:
The text was updated successfully, but these errors were encountered: