Don't mark accessors as thunks

This commit is contained in:
Ayaz Hafiz 2023-01-18 18:10:23 -06:00
parent 6b491c617e
commit f0ab9f77ca
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 13 additions and 18 deletions

View file

@ -5744,8 +5744,10 @@ fn build_pending_specializations<'a>(
let tag = declarations.declarations[index];
match tag {
Value => {
if !matches!(body.value, roc_can::expr::Expr::Accessor(..)) {
// mark this symbols as a top-level thunk before any other work on the procs
module_thunks.push(symbol);
}
// If this is an exposed symbol, we need to
// register it as such. Otherwise, since it

View file

@ -1101,7 +1101,7 @@ impl<'a> Procs<'a> {
// if we've already specialized this one, no further work is needed.
if !already_specialized {
if self.is_module_thunk(name.name()) {
debug_assert!(layout.arguments.is_empty());
debug_assert!(layout.arguments.is_empty(), "{:?}", name);
}
let needs_suspended_specialization =
@ -2391,12 +2391,9 @@ fn from_can_let<'a>(
}
Accessor(accessor_data) => {
let fresh_record_symbol = env.unique_symbol();
register_noncapturing_closure(
env,
procs,
*symbol,
accessor_data.to_closure_data(fresh_record_symbol),
);
let closure_data = accessor_data.to_closure_data(fresh_record_symbol);
debug_assert_eq!(*symbol, closure_data.name);
register_noncapturing_closure(env, procs, *symbol, closure_data);
lower_rest!(variable, cont.value)
}

View file

@ -1,12 +1,8 @@
procedure Test.1 ():
let Test.6 : {} = Struct {};
ret Test.6;
procedure Test.2 (Test.7):
ret Test.7;
let Test.4 : {} = Struct {};
ret Test.4;
procedure Test.0 ():
let Test.9 : U8 = 15i64;
let Test.4 : {} = CallByName Test.1;
let Test.3 : U8 = CallByName Test.2 Test.9;
ret Test.3;
let Test.6 : U8 = 15i64;
let Test.2 : U8 = CallByName Test.1 Test.6;
ret Test.2;