-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Better error message when accessing private members #18686
Labels
area:reporting
Error reporting including formatting, implicit suggestions, etc
better-errors
Issues concerned with improving confusing/unhelpful diagnostic messages
itype:enhancement
Comments
BalmungSan
added
area:reporting
Error reporting including formatting, implicit suggestions, etc
better-errors
Issues concerned with improving confusing/unhelpful diagnostic messages
itype:enhancement
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Oct 12, 2023
Tools should not suggest inaccessible things. Also worth conjecturing that Scala's history with access primes us to be confused and wonder if it's a bug. |
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 13, 2023
Before, the error message showed `module class XYZ$`. Now it shows `object XYZ`. This does not fix the issue scala#18686, it only improves a bit the current error message.
This was referenced Oct 13, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 13, 2023
bishabosha
removed
the
stat:needs triage
Every issue needs to have an "area" and "itype" label
label
Oct 13, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 16, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 16, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 17, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 17, 2023
bishabosha
added a commit
that referenced
this issue
Oct 17, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 19, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:reporting
Error reporting including formatting, implicit suggestions, etc
better-errors
Issues concerned with improving confusing/unhelpful diagnostic messages
itype:enhancement
Compiler version
3.3.1
Minimized example
https://scastie.scala-lang.org/BalmungSan/l6omsTrKSaCu7fH2PCZSgg
Output Error/Warning message
Why this Error/Warning was not helpful
The original situation was actually accessing a Java field, and I had forgot that in Java public access requires the
public
keyword.Thus, I was really confused about why I couldn't access a
static int
from my Scala code.Furthermore, metals was very happy to suggest and autocomplete that field, which originally made me think that I had found some bug in the compiler, which was unable to see the field.
Suggested improvement
It could be made more helpful by explicitly stating that the reason why the field couldn't be accessed was because it is declared as
private
.I know that is what "cannot be accessed" tries to express. But, under the pressure of some code not compiling at the end of the day it was not clear enough :)
The text was updated successfully, but these errors were encountered: