elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.51k stars 656 forks source link

fails to produce error message when a type argument must be a record but isn't #2213

Closed lue-bird closed 2 years ago

lue-bird commented 3 years ago
type alias T a =
    { a | field : () }

a : T ()
a =
    { field = () }

elm responds

Something is off with the body of the a definition:

4| a = { field = () }
       ^^^^^^^^^^^^^^

The body is a record of type:

   elm: Used toErrorType on a type that is not well-formed
CallStack (from HasCallStack):
 error, called at compiler/src/Type/Type.hs:541:21 in main:Type.Type

This happens for T with any type that isn't a record (T Bool, T Int, T String, ...).

github-actions[bot] commented 3 years ago

Thanks for reporting this! To set expectations:

Finally, please be patient with the core team. They are trying their best with limited resources.

lue-bird commented 3 years ago

https://github.com/elm/compiler/issues/2200 could be related

lue-bird commented 3 years ago

It's the same issue as https://github.com/elm/compiler/issues/1952

lue-bird commented 2 years ago

Also the same issue as https://github.com/elm/compiler/issues/1896

lue-bird commented 2 years ago

Merged into https://github.com/elm/compiler/issues/2200