error-message-catalog
error-message-catalog copied to clipboard
Unhelpful compiler error message: "and" should suggest "&&"
Quick Summary:
When trying to compile code with and, the compiler does not give any suggestion to use && instead.
It gives this unhelpful error message:
naming error
Line 21, Column 12
I cannot find a `and` variable:
21| , True and True
^^^
These names seem close though:
abs
tan
acos
asin
Hint: Read <https://elm-lang.org/0.19.0/imports> to see how `import`
declarations work in Elm.
Expected: there would be some hint to use && instead. For example, when using & there is a helpful error message:
unknown operator
Line 22, Column 12
I do not recognize the (&) operator.
22| , True & True
^
Is there an `import` and `exposing` entry for it? Maybe you want (&&) or (*)
instead?
An even better example is the excellent explanation given when trying to use != instead of /=
unknown operator
Line 23, Column 12
Elm uses a different name for the “not equal” operator:
23| , True != True
^^
Switch to (/=) instead.
Note: Our (/=) operator is supposed to look like a real “not equal” sign (≠). I
hope that history will remember (!=) as a weird and temporary choice.
Same goes for | suggesting ||, but or giving an unhelpful error.
Ellie showing these error messages
- Elm: 0.19
- Browser: n/a
- Operating System: n/a