mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Add debug assertion for shape of tag union extension variables
When we have a tag union type, outside of special cases in the middle of unification, its extension type should either be (1) the closed tag union or (2) a flex/rigid var. This adds an assertion for that.
This commit is contained in:
parent
1c58118dc7
commit
5f5d6a42d1
1 changed files with 9 additions and 0 deletions
|
@ -4263,9 +4263,18 @@ pub fn gather_tags_unsorted_iter(
|
|||
|
||||
let mut stack = vec![other_fields];
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
let mut seen_head_union = false;
|
||||
|
||||
loop {
|
||||
match subs.get_content_without_compacting(var) {
|
||||
Structure(TagUnion(sub_fields, sub_ext)) => {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
assert!(!seen_head_union, "extension variable is another tag union, but I expected it to be either open or closed!");
|
||||
seen_head_union = true;
|
||||
}
|
||||
|
||||
stack.push(*sub_fields);
|
||||
|
||||
var = *sub_ext;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue