mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-23 14:35:12 +00:00
Allow captures to be marked as unified without having to be merged
It's very possible to unify two variables without their actual variable numbers having been merged in the unification forest. We might want to do that in the future, but it's not necessarily true today. For example two concrete constructors `{}` and `{}` are unified by their contents, but the variables are not necessarily merged afterward.
This commit is contained in:
parent
cecb6987e7
commit
8fb9ccccfe
1 changed files with 3 additions and 5 deletions
|
@ -1021,7 +1021,9 @@ fn unify_lambda_set_help<M: MetaCollector>(
|
|||
let snapshot = subs.snapshot();
|
||||
let outcome = unify_pool::<M>(subs, pool, var1, var2, ctx.mode);
|
||||
|
||||
if !outcome.mismatches.is_empty() {
|
||||
if outcome.mismatches.is_empty() {
|
||||
subs.commit_snapshot(snapshot);
|
||||
} else {
|
||||
captures_unify = false;
|
||||
subs.rollback_to(snapshot);
|
||||
// Continue so the other variables can unify if possible, allowing us to re-use
|
||||
|
@ -1031,10 +1033,6 @@ fn unify_lambda_set_help<M: MetaCollector>(
|
|||
}
|
||||
|
||||
if captures_unify {
|
||||
debug_assert!((subs.get_subs_slice(vars1).iter())
|
||||
.zip(subs.get_subs_slice(vars2).iter())
|
||||
.all(|(v1, v2)| subs.equivalent_without_compacting(*v1, *v2)));
|
||||
|
||||
new_lambdas.push((lambda_name, subs.get_subs_slice(vars1).to_vec()));
|
||||
} else {
|
||||
debug_assert!((subs.get_subs_slice(vars1).iter())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue