use variablesubsslice for Apply

This commit is contained in:
Folkert 2021-08-12 22:49:56 +02:00
parent 46439b2116
commit 42f04fcc77
8 changed files with 84 additions and 59 deletions

View file

@ -961,10 +961,11 @@ fn unify_flat_type(
}
(Apply(l_symbol, l_args), Apply(r_symbol, r_args)) if l_symbol == r_symbol => {
let problems = unify_zip(subs, pool, l_args.iter(), r_args.iter());
let problems =
unify_zip_slices(subs, pool, *l_args.as_subs_slice(), *r_args.as_subs_slice());
if problems.is_empty() {
merge(subs, ctx, Structure(Apply(*r_symbol, (*r_args).clone())))
merge(subs, ctx, Structure(Apply(*r_symbol, *r_args)))
} else {
problems
}
@ -1094,21 +1095,6 @@ fn unify_zip_slices(
problems
}
fn unify_zip<'a, I>(subs: &mut Subs, pool: &mut Pool, left_iter: I, right_iter: I) -> Outcome
where
I: Iterator<Item = &'a Variable>,
{
let mut problems = Vec::new();
let it = left_iter.zip(right_iter);
for (&l_var, &r_var) in it {
problems.extend(unify_pool(subs, pool, l_var, r_var));
}
problems
}
#[inline(always)]
fn unify_rigid(subs: &mut Subs, ctx: &Context, name: &Lowercase, other: &Content) -> Outcome {
match other {