compiler icon indicating copy to clipboard operation
compiler copied to clipboard

thread blocked indefinitely in an MVar operation

Open dotKuro opened this issue 4 years ago • 2 comments

Quick Summary:

When using the extensible record syntax to avoid duplicate fields in similiar data types, I crash the compiler when trying to convert between the similir types.

The error occurs when running elm make on the provided code.

This seems to be related to #2146. I still open this issue though because the compiler error encouraged me to do so, if my example looks different.

SSCCE

module Example exposing (..)


type alias ExtensibleT extension dataT =
    { extension | data : dataT }

type alias TWithOutExtension dataT =
    ExtensibleT () dataT

type alias TWithSimpleExtension dataT =
    ExtensibleT { simple : Int } dataT


addExtension : TWithOutExtension dataT -> TWithSimpleExtension dataT
addExtension { data } = { data = data, simple = 0 }
  • Elm: 0.19.1
  • Browser: --
  • Operating System: Linux 5.10.16

Additional Details

  • The example does compile when the addExtension function is not in the code.
  • Exact output of the compiler:
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.

dotKuro avatar Feb 22 '21 22:02 dotKuro

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 Feb 22 '21 22:02 github-actions[bot]

I ran into a similar issue and my problem was () instead of {}.

type alias TWithOutExtension dataT =
    ExtensibleT () dataT

should be

type alias TWithOutExtension dataT =
    ExtensibleT {} dataT

caseyWebb avatar Dec 17 '22 07:12 caseyWebb