mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
fix bug in expect serialization of lambda sets
This commit is contained in:
parent
52f0dfbaf4
commit
bdec61d5bb
3 changed files with 45 additions and 4 deletions
|
@ -219,9 +219,9 @@ fn build_clone<'a, 'ctx, 'env>(
|
||||||
when_recursive,
|
when_recursive,
|
||||||
),
|
),
|
||||||
|
|
||||||
// Since we will never actually display functions (and hence lambda sets), we can just pass
|
// Since we will never actually display functions (and hence lambda sets)
|
||||||
// back the nullptr.
|
// we just write nothing to the buffer
|
||||||
Layout::LambdaSet(_) => env.ptr_int().const_zero(),
|
Layout::LambdaSet(_) => cursors.extra_offset,
|
||||||
|
|
||||||
Layout::Union(union_layout) => {
|
Layout::Union(union_layout) => {
|
||||||
if layout.safe_to_memcpy(env.layout_interner) {
|
if layout.safe_to_memcpy(env.layout_interner) {
|
||||||
|
|
|
@ -893,4 +893,45 @@ mod test {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn arg_parser() {
|
||||||
|
run_expect_test(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
interface A exposes [] imports []
|
||||||
|
|
||||||
|
makeForcer : {} -> (Str -> U8)
|
||||||
|
makeForcer = \{} -> \_ -> 2u8
|
||||||
|
|
||||||
|
expect
|
||||||
|
forcer = makeForcer {}
|
||||||
|
|
||||||
|
case = ""
|
||||||
|
|
||||||
|
forcer case == 5u8
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
This expectation failed:
|
||||||
|
|
||||||
|
6│> expect
|
||||||
|
7│> forcer = makeForcer {}
|
||||||
|
8│>
|
||||||
|
9│> case = ""
|
||||||
|
10│>
|
||||||
|
11│> forcer case == 5u8
|
||||||
|
|
||||||
|
When it failed, these variables had these values:
|
||||||
|
|
||||||
|
forcer : Str -> U8
|
||||||
|
forcer = <function>
|
||||||
|
|
||||||
|
case : Str
|
||||||
|
case = ""
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,7 +384,7 @@ fn render_expect_failure<'a>(
|
||||||
let data = expectations.get_mut(&module_id).unwrap();
|
let data = expectations.get_mut(&module_id).unwrap();
|
||||||
|
|
||||||
let current = match data.expectations.get(&failure_region) {
|
let current = match data.expectations.get(&failure_region) {
|
||||||
None => panic!("region not in list of expects"),
|
None => panic!("region {failure_region:?} not in list of expects"),
|
||||||
Some(current) => current,
|
Some(current) => current,
|
||||||
};
|
};
|
||||||
let subs = arena.alloc(&mut data.subs);
|
let subs = arena.alloc(&mut data.subs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue