confusing "Not found" error when I change "def foo()" to "val foo()" #18684
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/3.4
Minimized example
Output Error/Warning message
Why this Error/Warning was not helpful
As explained at scala/bug#6564, when refactoring a
def
to aval
, this is an easy mistake to make.In addition, someone on chat suggested they weren't aware that "applies" in patterns did not require backquotes, so that it is not apparent (without research) that the error pertains to a pattern. That is, there is no distinguishing visual marker.
The confusion is even more confounding in REPL, as shown.
Suggested improvement
Mention that it is a pattern context. Or use pink squiggles instead of red. If you can notice that my val doesn't look like a pattern def, then say so.
Relatedly, I am unlikely to use a boolean extractor in a valdef, so that is an example of a pattern def that looks wrong.
At least it mentions here that it was a pattern.
The text was updated successfully, but these errors were encountered: