mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
fix non-recursive tag unions in expects
This commit is contained in:
parent
66f9ff1d58
commit
b132b1fa89
2 changed files with 19 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::llvm::bitcode::call_bitcode_fn;
|
||||
use crate::llvm::build::Env;
|
||||
use crate::llvm::build::{store_roc_value, Env};
|
||||
use crate::llvm::build_list::{self, incrementing_elem_loop};
|
||||
use crate::llvm::convert::basic_type_from_layout;
|
||||
use inkwell::builder::Builder;
|
||||
|
@ -164,7 +164,20 @@ fn build_clone<'a, 'ctx, 'env>(
|
|||
|
||||
Layout::Union(_union_layout) => {
|
||||
if layout.safe_to_memcpy() {
|
||||
build_copy(env, ptr, offset, value)
|
||||
let ptr = unsafe {
|
||||
env.builder
|
||||
.build_in_bounds_gep(ptr, &[offset], "at_current_offset")
|
||||
};
|
||||
|
||||
let ptr_type = value.get_type().ptr_type(AddressSpace::Generic);
|
||||
let ptr = env
|
||||
.builder
|
||||
.build_pointer_cast(ptr, ptr_type, "cast_ptr_type");
|
||||
|
||||
store_roc_value(env, layout, ptr, value);
|
||||
|
||||
let width = value.get_type().size_of().unwrap();
|
||||
env.builder.build_int_add(offset, width, "new_offset")
|
||||
} else {
|
||||
todo!()
|
||||
}
|
||||
|
|
|
@ -368,7 +368,6 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn lookup_result() {
|
||||
run_expect_test(
|
||||
indoc!(
|
||||
|
@ -382,7 +381,6 @@ mod test {
|
|||
expected : Result I64 [OutOfBounds]*
|
||||
expected = Ok 42
|
||||
|
||||
|
||||
List.get items 0 == expected
|
||||
"#
|
||||
),
|
||||
|
@ -392,8 +390,8 @@ mod test {
|
|||
|
||||
5│> expect
|
||||
6│> items = [0, 1]
|
||||
7│> expected = Ok 42
|
||||
8│>
|
||||
7│> expected : Result I64 [OutOfBounds]*
|
||||
8│> expected = Ok 42
|
||||
9│>
|
||||
10│> List.get items 0 == expected
|
||||
|
||||
|
@ -402,8 +400,8 @@ mod test {
|
|||
items : List (Num a)
|
||||
items = [0, 1]
|
||||
|
||||
expected : [Ok (Num a)]b
|
||||
expected = Ok 140526413778648
|
||||
expected : Result I64 [OutOfBounds]*
|
||||
expected = Ok 42
|
||||
"#
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue