fix bug in expect serialization of lambda sets

This commit is contained in:
Folkert 2022-09-16 22:19:55 +02:00
parent 52f0dfbaf4
commit bdec61d5bb
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 45 additions and 4 deletions

View file

@ -219,9 +219,9 @@ fn build_clone<'a, 'ctx, 'env>(
when_recursive,
),
// Since we will never actually display functions (and hence lambda sets), we can just pass
// back the nullptr.
Layout::LambdaSet(_) => env.ptr_int().const_zero(),
// Since we will never actually display functions (and hence lambda sets)
// we just write nothing to the buffer
Layout::LambdaSet(_) => cursors.extra_offset,
Layout::Union(union_layout) => {
if layout.safe_to_memcpy(env.layout_interner) {

View file

@ -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 = ""
"#
),
);
}
}

View file

@ -384,7 +384,7 @@ fn render_expect_failure<'a>(
let data = expectations.get_mut(&module_id).unwrap();
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,
};
let subs = arena.alloc(&mut data.subs);