mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
no more rigid mistakes?
This commit is contained in:
parent
7a719172bc
commit
75d18eb8ba
1 changed files with 17 additions and 5 deletions
|
@ -1220,11 +1220,17 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint {
|
|||
ret_constraint,
|
||||
})),
|
||||
// "the closure's type is equal to expected type"
|
||||
Eq(fn_type.clone(), expected, Category::Lambda, region),
|
||||
Eq(fn_type.clone(), expected.clone(), Category::Lambda, region),
|
||||
// "fn_var is equal to the closure's type" - fn_var is used in code gen
|
||||
Eq(
|
||||
Type::Variable(*fn_var),
|
||||
NoExpectation(fn_type),
|
||||
NoExpectation(Type::Variable(expr_var)),
|
||||
Category::Storage(std::file!(), std::line!()),
|
||||
region,
|
||||
),
|
||||
Eq(
|
||||
Type::Variable(expr_var),
|
||||
expected,
|
||||
Category::Storage(std::file!(), std::line!()),
|
||||
region,
|
||||
),
|
||||
|
@ -1378,6 +1384,8 @@ pub fn rec_defs_help(
|
|||
|
||||
let mut def_pattern_state = constrain_def_pattern(env, &def.loc_pattern, expr_type.clone());
|
||||
|
||||
def_pattern_state.vars.push(expr_var);
|
||||
|
||||
let mut new_rigids = Vec::new();
|
||||
match &def.annotation {
|
||||
None => {
|
||||
|
@ -1388,8 +1396,6 @@ pub fn rec_defs_help(
|
|||
NoExpectation(expr_type),
|
||||
);
|
||||
|
||||
def_pattern_state.vars.push(expr_var);
|
||||
|
||||
// TODO investigate if this let can be safely removed
|
||||
let def_con = Let(Box::new(LetConstraint {
|
||||
rigid_vars: Vec::new(),
|
||||
|
@ -1571,7 +1577,7 @@ pub fn rec_defs_help(
|
|||
defs_constraint: And(state.constraints),
|
||||
ret_constraint: expr_con,
|
||||
})),
|
||||
Eq(fn_type.clone(), expected, Category::Lambda, region),
|
||||
Eq(fn_type.clone(), expected.clone(), Category::Lambda, region),
|
||||
// "fn_var is equal to the closure's type" - fn_var is used in code gen
|
||||
Eq(
|
||||
Type::Variable(*fn_var),
|
||||
|
@ -1579,6 +1585,12 @@ pub fn rec_defs_help(
|
|||
Category::Storage(std::file!(), std::line!()),
|
||||
region,
|
||||
),
|
||||
Eq(
|
||||
Type::Variable(expr_var),
|
||||
expected,
|
||||
Category::Storage(std::file!(), std::line!()),
|
||||
region,
|
||||
),
|
||||
closure_constraint,
|
||||
]),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue