mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
fix dropping the wrong argument for List.map when it captures
This commit is contained in:
parent
d5511a57e1
commit
32221a2e99
1 changed files with 19 additions and 1 deletions
|
@ -673,7 +673,25 @@ impl<'a> CallerProc<'a> {
|
|||
|
||||
let argument_layouts = match capture_layout {
|
||||
None => passed_function.argument_layouts,
|
||||
Some(_) => &passed_function.argument_layouts[1..],
|
||||
Some(_capture_layout) => {
|
||||
let capture_layout_index = passed_function.argument_layouts.len() - 1;
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
let passed_capture_layout =
|
||||
passed_function.argument_layouts[capture_layout_index];
|
||||
let repr = layout_interner.get_repr(passed_capture_layout);
|
||||
|
||||
if let LayoutRepr::LambdaSet(lambda_set) = repr {
|
||||
assert!(layout_interner
|
||||
.equiv(_capture_layout, lambda_set.runtime_representation()));
|
||||
} else {
|
||||
panic!("unexpected layout for capture argument");
|
||||
}
|
||||
}
|
||||
|
||||
&passed_function.argument_layouts[..capture_layout_index]
|
||||
}
|
||||
};
|
||||
|
||||
let capture_symbol = ARG_SYMBOLS[0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue