Feature Request: Improve misleading error message value ... is not a member of ...
#23838
GLI-RK0
started this conversation in
Feature Requests
Replies: 1 comment
-
I don't remember if there is an existing ticket, but I've left "notes to self" to port Scala 2 diagnostic for assignment operators:
That addendum is not even as precise as requested here. It happens to look similar. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
You can call
:=+
on avar Seq
If you accidentally supply the wrong type of argument, it errors as expected
but gives you a misleading error message
It makes users consider that they are forgetting how the operator is spelt, or if they forgot to make the value a
var
and notval
, etc.Value
:+=
is in fact a member ofSeq[Int]
, even if:+=(str: String)
is not. This error message should be replaced with one that makes this clear, that:+=
does exist (forInt
in this case) but that the wrong type of argument is being supplied.At the very least, the error message could be replaced to specify
String
being the cause of the failure, liketo make the argument type mismatch more obvious, Ideally the message would also suggest the correct type.
Beta Was this translation helpful? Give feedback.
All reactions