mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
use variablesubsslice for Apply
This commit is contained in:
parent
46439b2116
commit
42f04fcc77
8 changed files with 84 additions and 59 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue