elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
174 stars 17 forks source link

Using "type" instead of "type_" #311

Open lovasoa opened 4 years ago

lovasoa commented 4 years ago

In elm, type is a reserved keyword that can't be used as a function name, which results in a syntax that can be surprising and unintuitive when trying to use the html type attribute.

SSCCE

import Html exposing (..)
import Html.Attributes exposing (..)

text_input = input [type "text"] []

Current error message

-- UNFINISHED LIST --------------------------------------------- Jump To Problem

I am partway through parsing a list, but I got stuck here:

4| text_input = input [type "text"] []
                       ^
I was expecting to see a closing square bracket before this, so try adding a ]
and see if that helps?

Note: When I get stuck like this, it usually means that there is a missing
parenthesis or bracket somewhere earlier. It could also be a stray keyword or
operator.

The compiler is suggesting to add a closing bracket before type, which is clearly not the solution here. Instead, it should suggest to use type_ instead of type.