ErrorMessagesIssue361ExtensibleAliasOfUnitCrashTest
Issue: elm/error-message-catalog#361
An extensible-record type alias applied to a non-record type (`ExtRec ()`) crashes the
compiler instead of reporting a type error.
<https://github.com/elm/error-message-catalog/issues/361>
Elm 0.19.1 dies with the internal error "Used toAnnotation on a type that is not well-formed"
("I ran into something that bypassed the normal error reporting process!"). It should reject
the program with an ordinary error report. (With `exposing (main)` instead of `exposing (..)`,
Elm 0.19.1 does not crash but compiles the program, accepting the ill-formed type.)Results
elm-0.19.1
failUnexpected pattern (CHECK-NOT): bypassed the normal error reporting --- compiler output --- Compiling ...elm: Used toAnnotation on a type that is not well-formed CallStack (from HasCallStack): error, called at compiler/src/Type/Type.hs:413:21 in main:Type.Type -- ERROR ----------------------------------------------------------------------- I ran into something that bypassed the normal error reporting process! I extracted whatever information I could from the internal error: > thread blocked indefinitely in an MVar operation These errors are usually pretty confusing, so start by asking around on one of forums listed at https://elm-lang.org/community to see if anyone can get you unstuck quickly. -- REQUEST --------------------------------------------------------------------- If you are feeling up to it, please try to get your code down to the smallest version that still triggers this message. Ideally in a single Main.elm and elm.json file. From there open a NEW issue at https://github.com/elm/compiler/issues with your reduced example pasted in directly. (Not a link to a repo or gist!) Do not worry about if someone else saw something similar. More examples is better! This kind of error is usually tied up in larger architectural choices that are hard to change, so even when we have a couple good examples, it can take some time to resolve in a solid way.elm: thread blocked indefinitely in an MVar operation
elm-0.19.2
failUnexpected pattern (CHECK-NOT): bypassed the normal error reporting --- compiler output --- Compiling ...elm: Used toAnnotation on a type that is not well-formed CallStack (from HasCallStack): error, called at compiler/src/Type/Type.hs:412:21 in elm-0.19.2-inplace-elm:Type.Type -- ERROR ----------------------------------------------------------------------- I ran into something that bypassed the normal error reporting process! I extracted whatever information I could from the internal error: > thread blocked indefinitely in an MVar operation These errors are usually pretty confusing, so start by asking around on one of forums listed at https://elm-lang.org/community to see if anyone can get you unstuck quickly. -- REQUEST --------------------------------------------------------------------- If you are feeling up to it, please try to get your code down to the smallest version that still triggers this message. Ideally in a single Main.elm and elm.json file. From there open a NEW issue at https://github.com/elm/compiler/issues with your reduced example pasted in directly. (Not a link to a repo or gist!) Do not worry about if someone else saw something similar. More examples is better! This kind of error is usually tied up in larger architectural choices that are hard to change, so even when we have a couple good examples, it can take some time to resolve in a solid way.elm: thread blocked indefinitely in an MVar operation
elm-0.19.3
failUnexpected pattern (CHECK-NOT): bypassed the normal error reporting --- compiler output --- Compiling ... -- ERROR ----------------------------------------------------------------------- I ran into something that bypassed the normal error reporting process! I extracted whatever information I could from the internal error: > Used toAnnotation on a type that is not well-formed > > Type.Type.termToCanType (line 374) (in module ErrorMessagesIssue361ExtensibleAliasOfUnitCrashTest) These errors are usually pretty confusing, so start by asking around on one of forums listed at https://elm-lang.org/community to see if anyone can get you unstuck quickly. -- REQUEST --------------------------------------------------------------------- If you are feeling up to it, please try to get your code down to the smallest version that still triggers this message. Ideally in a single Main.elm and elm.json file. From there open a NEW issue at https://github.com/elm/compiler/issues with your reduced example pasted in directly. (Not a link to a repo or gist!) Do not worry about if someone else saw something similar. More examples is better! This kind of error is usually tied up in larger architectural choices that are hard to change, so even when we have a couple good examples, it can take some time to resolve in a solid way.elm: Used toAnnotation on a type that is not well-formed Type.Type.termToCanType (line 374) (in module ErrorMessagesIssue361ExtensibleAliasOfUnitCrashTest) HasCallStack backtrace: collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:169:13 in ghc-internal:GHC.Internal.Exception toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:89:42 in ghc-internal:GHC.Internal.Exception throw, called at builder/src/Reporting.hs:445:45 in elm-0.19.3-inplace-elm:Reporting
lamdera-1.5.0
failUnexpected pattern (CHECK-NOT): bypassed the normal error reporting
--- compiler output ---
-- ERROR -----------------------------------------------------------------------
lamdera-1.5.0-0.19.3-linux-x86_64-1ec0a3a092ea4c714f98404cd529abe37b0673e0 (Mon
Oct 26 11:38:05 2026 +1100) (branch:distribute)
I ran into something that bypassed the normal error reporting process! I
extracted whatever information I could from the internal error:
> Crash {_module = Module "Type.Type", _name = Name "Type.Type.termToCanType", _line = Line 1127, _message = "Used toAnnotation on a type that is not well-formed"} (in module ErrorMessagesIssue361ExtensibleAliasOfUnitCrashTest)
These errors are usually pretty confusing, so start by asking around on Discord
https://dashboard.lamdera.app/docs/discuss to see if anyone can get you unstuck
quickly.
-- REQUEST ---------------------------------------------------------------------
If you are feeling up to it, please try to get your code down to the smallest
version that still triggers this message. Ideally in a single Main.elm and
elm.json file.
From there open a NEW issue at https://github.com/elm/compiler/issues with your
reduced example pasted in directly. (Not a link to a repo or gist!) Do not worry
about if someone else saw something similar. More examples is better!
This kind of error is usually tied up in larger architectural choices that are
hard to change, so even when we have a couple good examples, it can take some
time to resolve in a solid way.lamdera: Crash {_module = Module "Type.Type", _name = Name "Type.Type.termToCanType", _line = Line 1127, _message = "Used toAnnotation on a type that is not well-formed"} (in module ErrorMessagesIssue361ExtensibleAliasOfUnitCrashTest)
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-error-catalogue/ErrorMessagesIssue361ExtensibleAliasOfUnitCrashTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ErrorMessagesIssue361ExtensibleAliasOfUnitCrashTest exposing (..)
{-| An extensible-record type alias applied to a non-record type (`ExtRec ()`) crashes the
compiler instead of reporting a type error.
<https://github.com/elm/error-message-catalog/issues/361>
Elm 0.19.1 dies with the internal error "Used toAnnotation on a type that is not well-formed"
("I ran into something that bypassed the normal error reporting process!"). It should reject
the program with an ordinary error report. (With `exposing (main)` instead of `exposing (..)`,
Elm 0.19.1 does not crash but compiles the program, accepting the ill-formed type.)
-}
-- TAGS: elm19-bug, error-message
-- COMPILE-ERROR: extensible record alias applied to the unit type
-- CHECK: {{-- [A-Z ]+ -}}
-- CHECK-NOT: bypassed the normal error reporting
-- CHECK-NOT: toAnnotation
import Html exposing (text)
type alias ExtRec a =
{ a | foo : Int }
type alias Model =
()
f : ExtRec Model
f =
Debug.todo "implement"
main =
text (String.fromInt f.foo)