mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Correct ircheck of nullable-wrapped unions
This commit is contained in:
parent
d6c32ded7d
commit
58930cc96c
1 changed files with 7 additions and 2 deletions
|
@ -746,8 +746,13 @@ fn get_tag_id_payloads(union_layout: UnionLayout, tag_id: TagIdIntType) -> TagPa
|
|||
if tag_id == nullable_id {
|
||||
TagPayloads::Payloads(&[])
|
||||
} else {
|
||||
check_tag_id_oob!(other_tags.len());
|
||||
let payloads = other_tags[tag_id as usize];
|
||||
check_tag_id_oob!(other_tags.len() + 1);
|
||||
let tag_id_idx = if tag_id > nullable_id {
|
||||
tag_id - 1
|
||||
} else {
|
||||
tag_id
|
||||
};
|
||||
let payloads = other_tags[tag_id_idx as usize];
|
||||
TagPayloads::Payloads(payloads)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue