Specialize zero-argument thunks with the correct variable

Previously we would pass the annotation down as the
type-to-be-monomorphized for, but that would just mean the annotation
would unify with itself. We instead want to use the variable the thunk
is being used as to be the one unified with the thunk's annotation.

Closes #2445
Closes #2446
This commit is contained in:
ayazhafiz 2022-02-06 20:58:13 -05:00
parent 365b3bb9c0
commit 40196185a0
2 changed files with 26 additions and 2 deletions

View file

@ -2941,8 +2941,7 @@ fn specialize_naked_symbol<'a>(
symbol: Symbol,
) -> Stmt<'a> {
if procs.is_module_thunk(symbol) {
let partial_proc = procs.get_partial_proc(symbol).unwrap();
let fn_var = partial_proc.annotation;
let fn_var = variable;
// This is a top-level declaration, which will code gen to a 0-arity thunk.
let result = call_by_name(