Open
Description
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
- Elm: 0.19.1
- Browser: N/A
- Operating System: Linux
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):
a
cannot be moved to either of the other positions inf1
orf2
, e.g. if the recursive call isf1 b a c
orf2 d e a
, the error does not occur.- The number of parameters of
f1
andf2
cannot be reduced, i.e. they must have at least 2 parameters (the erroneous call having at least 3). More can be added with the error still occurring. - The type signatures must be present on
f1
andf2
. - The type signature must be a type variable or Elm-"typeclass"-equivalent, i.e. the error occurs with
number
,appendable
, orvar
, but not withInt
,Bool
, etc. a
,b
,c
, etc. cannot be constants, e.g. the error does not occur withf1 0 b c
orf2 a d 5
.- The error must occur in two functions, as in this example, i.e. the error does not occur if
f1
orf2
is removed entirely. Otherlet
bindings can be added, however, in any position, whether they are valid or erroneous.