elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.51k stars 656 forks source link

Error called at Type/Solve.hs:206:15 -- thread blocked indefinitely in an MVar operation -- caused by two or more examples of recursion with wrong number of args #2184

Open SiriusStarr opened 3 years ago

SiriusStarr commented 3 years ago

Quick Summary: While trying to compile invalid code (but the sort one might reasonably generate on accident, since I did while eliminating a parameter from a function), compiler crashes with the following error (boilerplate parts excluded):

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

    ? [rank = 1]

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

>   thread blocked indefinitely in an MVar operation

SSCCE

module Main exposing (func)

func : Int -> Int
func a =
    let
        f1 : number -> Int -> Int
        f1 b c =
            f1 a b c

        f2 : number -> Int -> Int
        f2 d e =
            f2 a d e
    in
    0

Additional Details

I was unable to further reduce the above SSCCE (other than removing the type annotation on func). The code itself is invalid, as it involves a recursive call of a function with the wrong number of arguments. I've tested the following changes to the code, noting whether or not the error persists (i.e. whether the compiler crashes or reports a reasonable issue with the code):

github-actions[bot] commented 3 years ago

Thanks for reporting this! To set expectations:

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