mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
Cleanup constrain_def_make_constraint
This commit is contained in:
parent
1609a1a48b
commit
c9e8f6130b
1 changed files with 13 additions and 16 deletions
|
@ -1727,30 +1727,27 @@ fn constrain_def(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a let-constraint for a non-recursive def.
|
||||||
|
/// Recursive defs should always use `constrain_recursive_defs`.
|
||||||
pub fn constrain_def_make_constraint(
|
pub fn constrain_def_make_constraint(
|
||||||
constraints: &mut Constraints,
|
constraints: &mut Constraints,
|
||||||
new_rigid_variables: impl Iterator<Item = Variable>,
|
annotation_rigid_variables: impl Iterator<Item = Variable>,
|
||||||
new_infer_variables: impl Iterator<Item = Variable>,
|
annotation_infer_variables: impl Iterator<Item = Variable>,
|
||||||
expr_con: Constraint,
|
def_expr_con: Constraint,
|
||||||
body_con: Constraint,
|
after_def_con: Constraint,
|
||||||
def_pattern_state: PatternState,
|
def_pattern_state: PatternState,
|
||||||
) -> Constraint {
|
) -> Constraint {
|
||||||
let and_constraint = constraints.and_constraint(def_pattern_state.constraints);
|
let all_flex_variables = (def_pattern_state.vars.into_iter()).chain(annotation_infer_variables);
|
||||||
|
|
||||||
let def_con = constraints.let_constraint(
|
let pattern_constraints = constraints.and_constraint(def_pattern_state.constraints);
|
||||||
[],
|
let def_pattern_and_body_con = constraints.and_constraint([pattern_constraints, def_expr_con]);
|
||||||
new_infer_variables,
|
|
||||||
[], // empty, because our functions have no arguments!
|
|
||||||
and_constraint,
|
|
||||||
expr_con,
|
|
||||||
);
|
|
||||||
|
|
||||||
constraints.let_constraint(
|
constraints.let_constraint(
|
||||||
new_rigid_variables,
|
annotation_rigid_variables,
|
||||||
def_pattern_state.vars,
|
all_flex_variables,
|
||||||
def_pattern_state.headers,
|
def_pattern_state.headers,
|
||||||
def_con,
|
def_pattern_and_body_con,
|
||||||
body_con,
|
after_def_con,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue