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

@ -2807,7 +2807,8 @@ fn type_to_variable<'a>(
subs,
UnionTags::default(),
temp_ext_var,
);
)
.expect("extension var could not be seen as a tag union");
for _ in it {
unreachable!("we assert that the ext var is empty; otherwise we'd already know it was a tag union!");
@ -3351,7 +3352,8 @@ fn type_to_union_tags<'a>(
subs,
UnionTags::default(),
temp_ext_var,
);
)
.expect("extension var could not be seen as tag union");
tag_vars.extend(it.map(|(n, v)| (n.clone(), v)));