mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
panic on invalid non-recursive tag union
This commit is contained in:
parent
47128414d4
commit
3cbac76be8
1 changed files with 2 additions and 8 deletions
|
@ -960,15 +960,9 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
|
||||||
field_types.push(field_type);
|
field_types.push(field_type);
|
||||||
|
|
||||||
if let Layout::RecursivePointer = tag_field_layout {
|
if let Layout::RecursivePointer = tag_field_layout {
|
||||||
let ptr = allocate_with_refcount(env, &tag_layout, val);
|
panic!(
|
||||||
|
r"non-recursive tag unions cannot directly contain a recursive pointer"
|
||||||
let ptr = cast_basic_basic(
|
|
||||||
builder,
|
|
||||||
ptr.into(),
|
|
||||||
ctx.i64_type().ptr_type(AddressSpace::Generic).into(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
field_vals.push(ptr);
|
|
||||||
} else {
|
} else {
|
||||||
// this check fails for recursive tag unions, but can be helpful while debugging
|
// this check fails for recursive tag unions, but can be helpful while debugging
|
||||||
debug_assert_eq!(tag_field_layout, val_layout);
|
debug_assert_eq!(tag_field_layout, val_layout);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue