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

@ -1084,7 +1084,8 @@ fn type_to_union_tags<'a>(
let ext = {
let (it, ext) =
roc_types::types::gather_tags_unsorted_iter(subs, UnionTags::default(), temp_ext_var);
roc_types::types::gather_tags_unsorted_iter(subs, UnionTags::default(), temp_ext_var)
.expect("not a tag union");
tag_vars.extend(it.map(|(n, v)| (n.clone(), v)));
tag_vars.sort_unstable_by(|(a, _), (b, _)| a.cmp(b));