mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Merge pull request #5029 from roc-lang/lambda-set-cleanup
This commit is contained in:
commit
b0d3d8fc7c
1 changed files with 6 additions and 42 deletions
|
@ -492,7 +492,9 @@ impl<'a> RawFunctionLayout<'a> {
|
|||
let structure_content = env.subs.get_content_without_compacting(structure);
|
||||
Self::new_help(env, structure, *structure_content)
|
||||
}
|
||||
LambdaSet(lset) => Self::layout_from_lambda_set(env, lset),
|
||||
LambdaSet(_) => {
|
||||
internal_error!("lambda set should only appear under a function, where it's handled independently.");
|
||||
}
|
||||
Structure(flat_type) => Self::layout_from_flat_type(env, flat_type),
|
||||
RangedNumber(..) => Layout::new_help(env, var, content).then(Self::ZeroArgumentThunk),
|
||||
|
||||
|
@ -565,15 +567,6 @@ impl<'a> RawFunctionLayout<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn layout_from_lambda_set(
|
||||
_env: &mut Env<'a, '_>,
|
||||
_lset: subs::LambdaSet,
|
||||
) -> Cacheable<RawFunctionLayoutResult<'a>> {
|
||||
unreachable!()
|
||||
// Lambda set is just a tag union from the layout's perspective.
|
||||
// Self::layout_from_flat_type(env, lset.as_tag_union())
|
||||
}
|
||||
|
||||
fn layout_from_flat_type(
|
||||
env: &mut Env<'a, '_>,
|
||||
flat_type: FlatType,
|
||||
|
@ -2373,7 +2366,9 @@ impl<'a> Layout<'a> {
|
|||
let structure_content = env.subs.get_content_without_compacting(structure);
|
||||
Self::new_help(env, structure, *structure_content)
|
||||
}
|
||||
LambdaSet(lset) => layout_from_lambda_set(env, lset),
|
||||
LambdaSet(_) => {
|
||||
internal_error!("lambda set should only appear under a function, where it's handled independently.");
|
||||
}
|
||||
Structure(flat_type) => layout_from_flat_type(env, flat_type),
|
||||
|
||||
Alias(symbol, _args, actual_var, _) => {
|
||||
|
@ -2958,37 +2953,6 @@ impl<'a> Builtin<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn layout_from_lambda_set<'a>(
|
||||
env: &mut Env<'a, '_>,
|
||||
lset: subs::LambdaSet,
|
||||
) -> Cacheable<LayoutResult<'a>> {
|
||||
// Lambda set is just a tag union from the layout's perspective.
|
||||
let subs::LambdaSet {
|
||||
solved,
|
||||
recursion_var,
|
||||
unspecialized,
|
||||
ambient_function: _,
|
||||
} = lset;
|
||||
|
||||
if !unspecialized.is_empty() {
|
||||
internal_error!(
|
||||
"unspecialized lambda sets remain during layout generation for {:?}",
|
||||
roc_types::subs::SubsFmtContent(&Content::LambdaSet(lset), env.subs)
|
||||
);
|
||||
}
|
||||
|
||||
match recursion_var.into_variable() {
|
||||
None => {
|
||||
let labels = solved.unsorted_lambdas(env.subs);
|
||||
layout_from_non_recursive_union(env, &labels).map(Ok)
|
||||
}
|
||||
Some(rec_var) => {
|
||||
let labels = solved.unsorted_lambdas(env.subs);
|
||||
layout_from_recursive_union(env, rec_var, &labels)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn layout_from_flat_type<'a>(
|
||||
env: &mut Env<'a, '_>,
|
||||
flat_type: FlatType,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue