compiler icon indicating copy to clipboard operation
compiler copied to clipboard

Issue with extensible records and unit type

Open JonathanLorimer opened this issue 2 years ago • 1 comments

Quick Summary: I got a very confusing error when I applied an extensible record to a unit type. Obviously this is wrong, but better compiler info about where the error is would be great!

SSCCE

module Issue exposing (..)

type alias ExtRec a =
    { a | foo : Int }

type alias Model = ()

f : ExtRec Model
f = Debug.todo "implement"
  • Elm: 0.19.1
  • Browser: Not in browser
  • Operating System: NixOS 23.11.20230830.a63a64b (Tapir) x86_64

Additional Details

Full error message

Compiling ...+-------------------------------------------------------------------------------
|  Corrupt File: /path/to/repo/elm-stuff/0.19.1/Issue.elmi
|   Byte Offset: 0
|       Message: not enough bytes
|
| Please report this to https://github.com/elm/compiler/issues
| Trying to continue anyway.
+-------------------------------------------------------------------------------

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

JonathanLorimer avatar Oct 26 '23 21:10 JonathanLorimer

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions in a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

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

github-actions[bot] avatar Oct 26 '23 21:10 github-actions[bot]