Don't try to fix recursion vars if there are other errors

This commit is contained in:
ayazhafiz 2022-04-09 22:42:51 -04:00 committed by Ayaz Hafiz
parent 1e1ffb2f62
commit 939f413569
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -579,9 +579,11 @@ fn unify_structure(
// unify the structure with this unrecursive tag union
let mut problems = unify_pool(subs, pool, ctx.first, *structure, ctx.mode);
problems.extend(fix_tag_union_recursion_variable(
subs, ctx, ctx.first, other,
));
if problems.is_empty() {
problems.extend(fix_tag_union_recursion_variable(
subs, ctx, ctx.first, other,
));
}
problems
}
@ -594,9 +596,11 @@ fn unify_structure(
// unify the structure with this unrecursive tag union
let mut problems = unify_pool(subs, pool, ctx.first, *structure, ctx.mode);
problems.extend(fix_tag_union_recursion_variable(
subs, ctx, ctx.first, other,
));
if problems.is_empty() {
problems.extend(fix_tag_union_recursion_variable(
subs, ctx, ctx.first, other,
));
}
problems
}