Description
Compiler version
3.2.2
Minimized example
object ConfusingErrorMessage {
def m()() = ()
m()
}
Output
.../ConfusingErrorMessage.scala:3:4
method m in object ConfusingErrorMessage must be called with () argument
m()
Note how the error message says that the method needs to be called with an empty argument list, even though the method is called with an empty argument list.
(Yes, I know that the real problem is that it needs a second empty argument list too, but the error message doesn't say or hint at that, and therefore is confusing.)
Expectation
Better error message wording and/or structure.
Maybe refer to the partial call m()
instead of referring to just method m
when saying that something must be called with a ()
argument list.
Maybe say something like "call to m
must be called with a(nother) ()
argument."
Also, report the column number consistently. When the first (empty) argument list is missing, the column number points to where the list is missing (the column after m
), but when a second or later (argument) list is missing, the column number points into the middle of the last present argument list, not pointing to where something it missing.