Emit runtime error when tag unions have an error type

Closes #3266
This commit is contained in:
Ayaz Hafiz 2022-07-22 15:46:09 -04:00
parent 53e7a41f27
commit 5ad04dcd2c
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
6 changed files with 80 additions and 31 deletions

View file

@ -3056,7 +3056,9 @@ pub fn ext_var_is_empty_tag_union(subs: &Subs, ext_var: Variable) -> bool {
// the ext_var is empty
let mut ext_fields = std::vec::Vec::new();
match roc_types::pretty_print::chase_ext_tag_union(subs, ext_var, &mut ext_fields) {
Ok(()) | Err((_, Content::FlexVar(_) | Content::RigidVar(_))) => ext_fields.is_empty(),
Ok(()) | Err((_, Content::FlexVar(_) | Content::RigidVar(_) | Content::Error)) => {
ext_fields.is_empty()
}
Err(content) => panic!("invalid content in ext_var: {:?}", content),
}
}