mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-12 14:56:18 +00:00
Snapshot/restore pool if lambda sets are disjoint
This commit is contained in:
parent
0ef0638862
commit
79ee266f66
1 changed files with 4 additions and 2 deletions
|
@ -1477,11 +1477,13 @@ fn separate_union_lambdas<M: MetaCollector>(
|
||||||
// v1 ~ v2
|
// v1 ~ v2
|
||||||
// => {} -[ foo ({} -[ bar Str ]-> {}),
|
// => {} -[ foo ({} -[ bar Str ]-> {}),
|
||||||
// foo ({} -[ bar U64 ]-> {}) ] -> {}
|
// foo ({} -[ bar U64 ]-> {}) ] -> {}
|
||||||
let snapshot = env.subs.snapshot();
|
let subs_snapshot = env.subs.snapshot();
|
||||||
|
let pool_snapshot = pool.len();
|
||||||
let outcome = unify_pool(env, pool, var1, var2, mode);
|
let outcome = unify_pool(env, pool, var1, var2, mode);
|
||||||
|
|
||||||
if !outcome.mismatches.is_empty() {
|
if !outcome.mismatches.is_empty() {
|
||||||
env.subs.rollback_to(snapshot);
|
env.subs.rollback_to(subs_snapshot);
|
||||||
|
pool.truncate(pool_snapshot);
|
||||||
if env.is_inside_lambda_set {
|
if env.is_inside_lambda_set {
|
||||||
// If the lambdas being compared are nested, mismatches mean that the
|
// If the lambdas being compared are nested, mismatches mean that the
|
||||||
// transitively-outer lambdas should be treated as disjoint in
|
// transitively-outer lambdas should be treated as disjoint in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue