From 79ee266f669d313ffd6ee1979c7fcea6205c0efc Mon Sep 17 00:00:00 2001 From: Ayaz Hafiz Date: Mon, 12 Dec 2022 18:06:50 -0600 Subject: [PATCH] Snapshot/restore pool if lambda sets are disjoint --- crates/compiler/unify/src/unify.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/compiler/unify/src/unify.rs b/crates/compiler/unify/src/unify.rs index be70f89ba5..6b0e1f555c 100644 --- a/crates/compiler/unify/src/unify.rs +++ b/crates/compiler/unify/src/unify.rs @@ -1477,11 +1477,13 @@ fn separate_union_lambdas( // v1 ~ v2 // => {} -[ foo ({} -[ bar Str ]-> {}), // 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); 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 the lambdas being compared are nested, mismatches mean that the // transitively-outer lambdas should be treated as disjoint in