You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I set a default value for an argument in recursive functions, the compiler crashes with
Failure("Impossible: optional argument with non-option type")
let rec parenthesizedExpression = () => {
let expression1 = expression(0)
expression1
}
and expression = (prec=0) => { // setting the default value here causes the compiler crash
0
}
provide let parse = (source: String) => {
expression(0)
}
The text was updated successfully, but these errors were encountered:
This is a really interesting error, it occurs when Apply_too_many_arguments is hit in typecore.re, interestingly if you pass the arguments as named parameters we get a different impossible error. This error also only seems to occur when the function being used is called before its defintion in an and statement.
In grain we require arguments to be passed with their label in the defaulted case normally we have a pretty error for this but it seems something is messing it up. I traced this issue back a little and we seem to be producing the wrong type here let funct = type_exp(env, func); line 1382 in type_expect we are producing a function with a (Default(_), TTyVar(None)) instead of an optional type.
When I set a default value for an argument in recursive functions, the compiler crashes with
Failure("Impossible: optional argument with non-option type")
The text was updated successfully, but these errors were encountered: