mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
check inside a lambda set for whether it is reference counted
This commit is contained in:
parent
73ffce0baa
commit
334253f47f
7 changed files with 34 additions and 31 deletions
|
@ -2872,8 +2872,7 @@ pub(crate) fn build_exp_stmt<'a, 'ctx>(
|
|||
DecRef(symbol) => {
|
||||
let (value, layout) = scope.load_symbol_and_layout(symbol);
|
||||
|
||||
let lay = layout_interner.get_repr(layout);
|
||||
match lay {
|
||||
match layout_interner.get_repr(layout) {
|
||||
LayoutRepr::Builtin(Builtin::Str) => todo!(),
|
||||
LayoutRepr::Builtin(Builtin::List(element_layout)) => {
|
||||
debug_assert!(value.is_struct_value());
|
||||
|
@ -2883,9 +2882,9 @@ pub(crate) fn build_exp_stmt<'a, 'ctx>(
|
|||
build_list::decref(env, value.into_struct_value(), alignment);
|
||||
}
|
||||
|
||||
_ if lay.is_refcounted() => {
|
||||
other_layout if other_layout.is_refcounted(layout_interner) => {
|
||||
if value.is_pointer_value() {
|
||||
let value_ptr = match lay {
|
||||
let value_ptr = match other_layout {
|
||||
LayoutRepr::Union(union_layout)
|
||||
if union_layout
|
||||
.stores_tag_id_in_pointer(env.target_info) =>
|
||||
|
|
|
@ -1246,7 +1246,7 @@ enum DecOrReuse {
|
|||
fn fields_need_no_refcounting(interner: &STLayoutInterner, field_layouts: &[InLayout]) -> bool {
|
||||
!field_layouts.iter().any(|x| {
|
||||
let x = interner.get_repr(*x);
|
||||
x.is_refcounted() || x.contains_refcounted(interner)
|
||||
x.is_refcounted(interner) || x.contains_refcounted(interner)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1763,7 +1763,7 @@ fn modify_refcount_nonrecursive_help<'a, 'ctx>(
|
|||
// if none of the fields are or contain anything refcounted, just move on
|
||||
if !field_layouts.iter().any(|x| {
|
||||
let x = layout_interner.get_repr(*x);
|
||||
x.is_refcounted() || x.contains_refcounted(layout_interner)
|
||||
x.is_refcounted(layout_interner) || x.contains_refcounted(layout_interner)
|
||||
}) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue