add LambdaSet layout variant

This commit is contained in:
Folkert 2021-09-12 17:00:09 +02:00
parent e00c8b6837
commit 350891468a
7 changed files with 40 additions and 1 deletions

View file

@ -59,6 +59,15 @@ fn build_hash_layout<'a, 'ctx, 'env>(
val.into_struct_value(),
),
Layout::LambdaSet(lambda_set) => build_hash_layout(
env,
layout_ids,
seed,
val,
&lambda_set.runtime_representation(),
when_recursive,
),
Layout::Union(union_layout) => {
build_hash_tag(env, layout_ids, layout, union_layout, seed, val)
}

View file

@ -156,6 +156,8 @@ fn build_eq<'a, 'ctx, 'env>(
rhs_val.into_struct_value(),
),
Layout::LambdaSet(_) => unreachable!("cannot compare closures"),
Layout::Union(union_layout) => build_tag_eq(
env,
layout_ids,
@ -336,6 +338,7 @@ fn build_neq<'a, 'ctx, 'env>(
Layout::RecursivePointer => {
unreachable!("recursion pointers should never be compared directly")
}
Layout::LambdaSet(_) => unreachable!("cannot compare closure"),
}
}

View file

@ -27,6 +27,7 @@ pub fn basic_type_from_layout<'a, 'ctx, 'env>(
match layout {
Struct(sorted_fields) => basic_type_from_record(env, sorted_fields),
LambdaSet(lambda_set) => basic_type_from_layout(env, &lambda_set.runtime_representation()),
Union(union_layout) => {
use UnionLayout::*;

View file

@ -626,6 +626,14 @@ fn modify_refcount_layout_build_function<'a, 'ctx, 'env>(
Some(function)
}
},
LambdaSet(lambda_set) => modify_refcount_layout_build_function(
env,
parent,
layout_ids,
mode,
when_recursive,
&lambda_set.runtime_representation(),
),
}
}