Include ZATs in host exposed aliases

This commit is contained in:
Ayaz Hafiz 2022-07-14 12:26:11 -04:00
parent 161c2101a7
commit 20c2c308fa
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 30 additions and 3 deletions

View file

@ -194,7 +194,7 @@ where
RawFunctionLayout::ZeroArgumentThunk(_) => {
let bytes = func_name_bytes_help(
*symbol,
[Layout::UNIT],
[],
CapturesNiche::no_niche(),
&top_level.result,
);

View file

@ -2976,8 +2976,35 @@ fn specialize_external<'a>(
aliases.insert(*symbol, (name, top_level, layout));
}
RawFunctionLayout::ZeroArgumentThunk(_) => {
unreachable!("so far");
RawFunctionLayout::ZeroArgumentThunk(result) => {
let assigned = env.unique_symbol();
let hole = env.arena.alloc(Stmt::Ret(assigned));
let forced = force_thunk(env, lambda_name.name(), result, assigned, hole);
let proc = Proc {
name: LambdaName::no_niche(name),
args: &[],
body: forced,
closure_data_layout: None,
ret_layout: result,
is_self_recursive: SelfRecursive::NotSelfRecursive,
must_own_arguments: false,
host_exposed_layouts: HostExposedLayouts::NotHostExposed,
};
let top_level =
ProcLayout::from_raw(env.arena, layout, CapturesNiche::no_niche());
procs.specialized.insert_specialized(name, top_level, proc);
aliases.insert(
*symbol,
(
name,
ProcLayout::new(env.arena, &[], CapturesNiche::no_niche(), result),
layout,
),
);
}
}
}