Fix compile error

This commit is contained in:
Ayaz Hafiz 2022-04-21 10:26:16 -04:00
parent 939f413569
commit bb06bcd7f1
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -577,15 +577,15 @@ fn unify_structure(
RecursionVar { structure, .. } => match flat_type { RecursionVar { structure, .. } => match flat_type {
FlatType::TagUnion(_, _) => { FlatType::TagUnion(_, _) => {
// unify the structure with this unrecursive tag union // unify the structure with this unrecursive tag union
let mut problems = unify_pool(subs, pool, ctx.first, *structure, ctx.mode); let mut outcome = unify_pool(subs, pool, ctx.first, *structure, ctx.mode);
if problems.is_empty() { if outcome.mismatches.is_empty() {
problems.extend(fix_tag_union_recursion_variable( outcome.union(fix_tag_union_recursion_variable(
subs, ctx, ctx.first, other, subs, ctx, ctx.first, other,
)); ));
} }
problems outcome
} }
FlatType::RecursiveTagUnion(rec, _, _) => { FlatType::RecursiveTagUnion(rec, _, _) => {
debug_assert!(is_recursion_var(subs, *rec)); debug_assert!(is_recursion_var(subs, *rec));
@ -594,15 +594,15 @@ fn unify_structure(
} }
FlatType::FunctionOrTagUnion(_, _, _) => { FlatType::FunctionOrTagUnion(_, _, _) => {
// unify the structure with this unrecursive tag union // unify the structure with this unrecursive tag union
let mut problems = unify_pool(subs, pool, ctx.first, *structure, ctx.mode); let mut outcome = unify_pool(subs, pool, ctx.first, *structure, ctx.mode);
if problems.is_empty() { if outcome.mismatches.is_empty() {
problems.extend(fix_tag_union_recursion_variable( outcome.union(fix_tag_union_recursion_variable(
subs, ctx, ctx.first, other, subs, ctx, ctx.first, other,
)); ));
} }
problems outcome
} }
// Only tag unions can be recursive; everything else is an error. // Only tag unions can be recursive; everything else is an error.
_ => mismatch!( _ => mismatch!(
@ -707,7 +707,7 @@ fn fix_tag_union_recursion_variable(
if !has_recursing_recursive_variable { if !has_recursing_recursive_variable {
merge(subs, ctx, *recursion_var) merge(subs, ctx, *recursion_var)
} else { } else {
vec![] Outcome::default()
} }
} }