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

Case error wrong way round #160

Closed opsb closed 8 years ago

opsb commented 8 years ago

To my reading the error shown below reads the wrong way around.

Example 1

x = 
  case {a = 1} of
    (a, b) -> 
      ""
    _ -> 
      ""

Actual error

-- TYPE MISMATCH ---------------------------------------------------------------

Tag `_Tuple2` is causing problems in this pattern match.

7|     (a, b) -> 
       ^^^^^^
This pattern matches things of type:

    { a : number }

But the values it will actually be trying to match are:

    ( a, b )

Expected error

-- TYPE MISMATCH ---------------------------------------------------------------

Tag `_Tuple2` is causing problems in this pattern match.

7|     (a, b) -> 
       ^^^^^^
This pattern matches things of type:

    (a, b) 

But the values it will actually be trying to match are:

    { a : number }

Example 2

y = 
  case {a = 1} of
    [a, b] -> 
      ""
    _ -> 
      "" 

yields a similar error, with the messages inverted (relative to my expectations at least).

evancz commented 8 years ago

Should be fixed in the next round of 0.18 alpha binaries. I am seeing this error now:

screen shot 2016-10-26 at 4 52 12 pm

Thanks for the report!