rename for clarity

This commit is contained in:
Folkert 2021-05-24 12:03:06 +02:00
parent cae4225504
commit 1aa71113ca

View file

@ -982,14 +982,32 @@ fn unify_flat_type(
problems problems
} }
} }
(FunctionOrTagUnion(tag_name, _, ext), Func(args, closure, ret)) => { (FunctionOrTagUnion(tag_name, tag_symbol, ext), Func(args, closure, ret)) => {
unify_function_or_tag_union_and_func( unify_function_or_tag_union_and_func(
tag_name, args, subs, pool, ctx, ext, ret, closure, true, subs,
pool,
ctx,
tag_name,
*tag_symbol,
*ext,
args,
*ret,
*closure,
true,
) )
} }
(Func(args, closure, ret), FunctionOrTagUnion(tag_name, _, ext)) => { (Func(args, closure, ret), FunctionOrTagUnion(tag_name, tag_symbol, ext)) => {
unify_function_or_tag_union_and_func( unify_function_or_tag_union_and_func(
tag_name, args, subs, pool, ctx, ext, ret, closure, false, subs,
pool,
ctx,
tag_name,
*tag_symbol,
*ext,
args,
*ret,
*closure,
false,
) )
} }
(FunctionOrTagUnion(tag_name_1, _, ext_1), FunctionOrTagUnion(tag_name_2, _, ext_2)) => { (FunctionOrTagUnion(tag_name_1, _, ext_1), FunctionOrTagUnion(tag_name_2, _, ext_2)) => {
@ -1246,30 +1264,31 @@ fn is_recursion_var(subs: &Subs, var: Variable) -> bool {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
fn unify_function_or_tag_union_and_func( fn unify_function_or_tag_union_and_func(
tag_name: &TagName,
args: &[Variable],
subs: &mut Subs, subs: &mut Subs,
pool: &mut Pool, pool: &mut Pool,
ctx: &Context, ctx: &Context,
ext: &Variable, tag_name: &TagName,
ret: &Variable, _tag_symbol: Symbol,
_closure: &Variable, tag_ext: Variable,
function_arguments: &[Variable],
function_return: Variable,
_function_lambda_set: Variable,
left: bool, left: bool,
) -> Outcome { ) -> Outcome {
use FlatType::*; use FlatType::*;
let mut new_tags = MutMap::with_capacity_and_hasher(1, default_hasher()); let mut new_tags = MutMap::with_capacity_and_hasher(1, default_hasher());
new_tags.insert(tag_name.clone(), args.to_owned()); new_tags.insert(tag_name.clone(), function_arguments.to_owned());
let content = Structure(TagUnion(new_tags, *ext)); let content = Structure(TagUnion(new_tags, tag_ext));
let new_tag_union_var = fresh(subs, pool, ctx, content); let new_tag_union_var = fresh(subs, pool, ctx, content);
let problems = if left { let problems = if left {
unify_pool(subs, pool, new_tag_union_var, *ret) unify_pool(subs, pool, new_tag_union_var, function_return)
} else { } else {
unify_pool(subs, pool, *ret, new_tag_union_var) unify_pool(subs, pool, function_return, new_tag_union_var)
}; };
if problems.is_empty() { if problems.is_empty() {