Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in a lambda, wrong let types can cause "thread blocked indefinitely" #2295

Open
lue-bird opened this issue Feb 13, 2023 · 1 comment
Open

Comments

@lue-bird
Copy link

lue-bird commented Feb 13, 2023

Quick Summary: In a lambda, annotating the argument with the wrong type argument causes an error:

thread blocked indefinitely in an MVar operation

SSCCE

test : a -> a
test =
    \a ->
        let
            b : b
            b =
                a
        in
        b

elm throws

You ran into a compiler bug. Here are some details for the developers:

    b [rank = 2]

Please create an <http://sscce.org/> and then report it
at <https://github.com/elm/compiler/issues>


CallStack (from HasCallStack):
  error, called at compiler/src/Type/Solve.hs:206:15 in main:Type.Solve

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

if the argument a is part of the declaration top

test : a -> a
test a = ...

the correct error is thrown

This a value is a:

a

But the type annotation on b says it should be:

b

The result type can be chosen arbitrarily*, for example () or Int.
*If the result type is set to b a correct error is thrown

The body is an anonymous function of type:

b -> b

But the type annotation on test says it should be:

a -> b
  • Elm: 0.19.1
  • Operating System: Ubuntu 22.04.1 LTS
@github-actions
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant