error-message-catalog icon indicating copy to clipboard operation
error-message-catalog copied to clipboard

Error message when miscapitalizing a boolean value could be clearer

Open bowbahdoe opened this issue 7 years ago • 1 comments

Naming Error
Line 36, Column 31
I cannot find a `false` variable:

36|   ( Model "cat" "waiting.gif" false
                                  ^^^^^
These names seem close though:

    value
    abs
    alt
    class

Hint: Read <https://elm-lang.org/0.19.0/imports> to see how `import`
declarations work in Elm.

This is the error message that you get as of 0.19.0 when you write false instead of False. This seems like it would be a common enough stumbling block to be more directly explained to the user. Something like "the boolean false is written with a capital "F" in Elm`.

bowbahdoe avatar Oct 19 '18 00:10 bowbahdoe

I think the capitalization check could even be extended to all typos. For example if you have:

type alias User = { firstName : String, lastName : String }

user = User "Simon" "Herteby"

view model = div [] [ text User.firstName ]

It gives you the error:

I cannot find a `User.firstName` variable:

37|         [ text User.firstName, button [ onClick Increment ] [ text "+1" ]
                   ^^^^^^^^^^^^^^
I cannot find a `User` import. These names seem close though:

    Html.iframe
    Tuple.first
    Char.fromCode
    isInfinite

Hint: Read <https://elm-lang.org/0.19.0/imports> to see how `import`
declarations work in Elm.

It ought to be able to figure out that it was probably a typo, and user.firstName would be correct, since that would match the expected signature..

ie. make the typo suggestions more general I guess, instead of only having it for record fields.

actually maybe this should be it's own issue, if it doesn't already exist :thinking:

Herteby avatar Dec 04 '18 10:12 Herteby