mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
Fix bug in unification of tag args in polymorphic contexts
This commit is contained in:
parent
f0b3c3eb08
commit
8abd5cf605
3 changed files with 69 additions and 1 deletions
|
@ -2979,7 +2979,18 @@ fn unify_flat_type<M: MetaCollector>(
|
|||
let mut outcome = unify_zip_slices(env, pool, *l_args, *r_args, ctx.mode);
|
||||
|
||||
if outcome.mismatches.is_empty() {
|
||||
outcome.union(merge(env, ctx, Structure(Apply(*r_symbol, *r_args))));
|
||||
let chosen_args = SubsSlice::reserve_into_subs(env.subs, l_args.len());
|
||||
for ((store, var1), var2) in chosen_args
|
||||
.into_iter()
|
||||
.zip(l_args.into_iter())
|
||||
.zip(r_args.into_iter())
|
||||
{
|
||||
let var1 = env.subs[var1];
|
||||
let var2 = env.subs[var2];
|
||||
env.subs[store] = choose_merged_var(env.subs, var1, var2);
|
||||
}
|
||||
|
||||
outcome.union(merge(env, ctx, Structure(Apply(*r_symbol, chosen_args))));
|
||||
}
|
||||
|
||||
outcome
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue