mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Merge pull request #4869 from roc-lang/josh-recursive-union-bug-2
Skip nullable ID in nullable wrapped tags when iterating
This commit is contained in:
commit
73020ca696
4 changed files with 88 additions and 7 deletions
|
@ -9798,21 +9798,20 @@ fn from_can_pattern_help<'a>(
|
|||
}
|
||||
|
||||
NullableWrapped {
|
||||
sorted_tag_layouts: ref tags,
|
||||
sorted_tag_layouts: ref non_nulled_tags,
|
||||
nullable_id,
|
||||
nullable_name,
|
||||
} => {
|
||||
debug_assert!(!tags.is_empty());
|
||||
|
||||
for (i, (tag_name, args)) in tags.iter().enumerate() {
|
||||
if i == nullable_id as usize {
|
||||
debug_assert!(args.is_empty());
|
||||
for id in 0..(non_nulled_tags.len() + 1) {
|
||||
if id == nullable_id as usize {
|
||||
ctors.push(Ctor {
|
||||
tag_id: TagId(i as _),
|
||||
tag_id: TagId(id as _),
|
||||
name: CtorName::Tag(nullable_name.expect_tag_ref().clone()),
|
||||
arity: 0,
|
||||
});
|
||||
} else {
|
||||
let i = if id < nullable_id.into() { id } else { id - 1 };
|
||||
let (tag_name, args) = &non_nulled_tags[i];
|
||||
ctors.push(Ctor {
|
||||
tag_id: TagId(i as _),
|
||||
name: CtorName::Tag(tag_name.expect_tag_ref().clone()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue