Elm Exactly
Results / elm /

CompilerIssue1785ExtensibleAliasOfUnitTest

Tags:elm19-bugelm-spec

Checks, in A Standard Definition of Elm?:rule s-ty-con

Not translated into Lean for the mechanisation of the book: see why.

elm-0.19.1 failelm-0.19.2 failelm-0.19.3 faillamdera-1.5.0 fail

Issue: elm/compiler#1785

An extensible record alias applied to `()`, a record extending a non-record, is rejected with an error.

<https://github.com/elm/compiler/issues/1785>

Elm 0.19.1 crashes ("Used toAnnotation on a type that is not well-formed") instead of reporting
the error.

Results

elm-0.19.1

fail
Unexpected pattern (CHECK-NOT): HasCallStack
--- 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

fail
Unexpected pattern (CHECK-NOT): HasCallStack
--- 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

fail
Unexpected pattern (CHECK-NOT): HasCallStack
--- 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 CompilerIssue1785ExtensibleAliasOfUnitTest)

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 CompilerIssue1785ExtensibleAliasOfUnitTest)
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

fail
Unexpected pattern (CHECK-NOT): HasCallStack
--- 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:

>   Type.Type.canonicalRecord: not a record extension
>   CallStack (from HasCallStack):
>     error, called at compiler/src/Type/Type.hs:805:7 in main:Type.Type (in module CompilerIssue1785ExtensibleAliasOfUnitTest)

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: Type.Type.canonicalRecord: not a record extension
CallStack (from HasCallStack):
  error, called at compiler/src/Type/Type.hs:805:7 in main:Type.Type (in module CompilerIssue1785ExtensibleAliasOfUnitTest)

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm/CompilerIssue1785ExtensibleAliasOfUnitTest] in its title.

Source

The -- CHECK: lines give the expected output.

module CompilerIssue1785ExtensibleAliasOfUnitTest exposing (..)
{-| An extensible record alias applied to `()`, a record extending a non-record, is rejected with an error.
<https://github.com/elm/compiler/issues/1785>
Elm 0.19.1 crashes ("Used toAnnotation on a type that is not well-formed") instead of reporting
the error.
-}
-- TAGS: elm19-bug
-- TAGS: elm-spec, s-ty-con
-- COMPILE-ERROR: a kind error, not a crash or a hang
-- CHECK: {{-- [A-Z ]+ -}}
-- CHECK-NOT: HasCallStack
import Html
type alias SomeType a =
{ a | one : String, two : String }
someFunction : SomeType () -> Bool
someFunction rec =
False
main =
Html.text ""

Lean translation

No reduced program for Lean's evaluator: the test expects a compile error, so it has no meaning to evaluate. Lean has the program as written, in source syntax, and proves what the static semantics says of it (below). See the Lean mechanisation for which tests are in Lean, and why.

Static semantics: Lean proves that the program as written is not legal, so a compiler must reject it (refuse_elm_CompilerIssue1785ExtensibleAliasOfUnitTest, in StandardElmMech/Certs/). Some type expression of the program (an alias, a constructor's argument, an annotation, a port) elaborates in no derivation (Stat.not_legal_of_typesFailB). It holds for every derivation, with no hypothesis about principality.