make Storage store where it came from

This commit is contained in:
Folkert 2020-11-11 01:16:30 +01:00
parent c64a6da745
commit 984cf744e3
3 changed files with 18 additions and 13 deletions

View file

@ -1090,7 +1090,7 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint {
pattern_state.constraints.push(Eq( pattern_state.constraints.push(Eq(
expr_type, expr_type,
annotation_expected.clone(), annotation_expected.clone(),
Category::Storage, Category::Storage(std::file!(), std::line!()),
Region::span_across(&annotation.region, &def.loc_expr.region), Region::span_across(&annotation.region, &def.loc_expr.region),
)); ));
@ -1173,7 +1173,7 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint {
state.constraints.push(Constraint::Eq( state.constraints.push(Constraint::Eq(
pattern_type.clone(), pattern_type.clone(),
Expected::NoExpectation(loc_ann.clone()), Expected::NoExpectation(loc_ann.clone()),
Category::Storage, Category::Storage(std::file!(), std::line!()),
loc_pattern.region, loc_pattern.region,
)); ));
@ -1218,7 +1218,7 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint {
Eq( Eq(
Type::Variable(*fn_var), Type::Variable(*fn_var),
NoExpectation(fn_type), NoExpectation(fn_type),
Category::Storage, Category::Storage(std::file!(), std::line!()),
region, region,
), ),
closure_constraint, closure_constraint,

View file

@ -271,7 +271,7 @@ pub fn constrain_pattern(
let whole_con = Constraint::Eq( let whole_con = Constraint::Eq(
Type::Variable(*whole_var), Type::Variable(*whole_var),
Expected::NoExpectation(record_type), Expected::NoExpectation(record_type),
Category::Storage, Category::Storage(std::file!(), std::line!()),
region, region,
); );
@ -315,7 +315,7 @@ pub fn constrain_pattern(
vec![(tag_name.clone(), argument_types)], vec![(tag_name.clone(), argument_types)],
Box::new(Type::Variable(*ext_var)), Box::new(Type::Variable(*ext_var)),
)), )),
Category::Storage, Category::Storage(std::file!(), std::line!()),
region, region,
); );

View file

@ -317,7 +317,7 @@ fn constrain_pattern(
let whole_con = Constraint::Eq( let whole_con = Constraint::Eq(
Type::Variable(*whole_var), Type::Variable(*whole_var),
Expected::NoExpectation(record_type), Expected::NoExpectation(record_type),
Category::Storage, Category::Storage(std::file!(), std::line!()),
region, region,
); );
@ -381,7 +381,7 @@ fn constrain_pattern(
let whole_con = Constraint::Eq( let whole_con = Constraint::Eq(
Type::Variable(*whole_var), Type::Variable(*whole_var),
Expected::NoExpectation(union_type), Expected::NoExpectation(union_type),
Category::Storage, Category::Storage(std::file!(), std::line!()),
region, region,
); );
@ -686,7 +686,12 @@ pub fn constrain_expr(
constraints.push(Eq(inferred, expected.clone(), Category::List, region)); constraints.push(Eq(inferred, expected.clone(), Category::List, region));
let stored = Type::Variable(*list_var); let stored = Type::Variable(*list_var);
constraints.push(Eq(stored, expected, Category::Storage, region)); constraints.push(Eq(
stored,
expected,
Category::Storage(std::file!(), std::line!()),
region,
));
exists(vec![*elem_var, *list_var, uniq_var], And(constraints)) exists(vec![*elem_var, *list_var, uniq_var], And(constraints))
} }
@ -1044,7 +1049,7 @@ pub fn constrain_expr(
Eq( Eq(
Type::Variable(*var), Type::Variable(*var),
expected, expected,
Category::Storage, Category::Storage(std::file!(), std::line!()),
loc_ret.region, loc_ret.region,
), ),
]), ]),
@ -1079,7 +1084,7 @@ pub fn constrain_expr(
Eq( Eq(
Type::Variable(*var), Type::Variable(*var),
expected, expected,
Category::Storage, Category::Storage(std::file!(), std::line!()),
loc_ret.region, loc_ret.region,
), ),
]), ]),
@ -1175,7 +1180,7 @@ pub fn constrain_expr(
let ast_con = Eq( let ast_con = Eq(
Type::Variable(*branch_var), Type::Variable(*branch_var),
Expected::NoExpectation(tipe), Expected::NoExpectation(tipe),
Category::Storage, Category::Storage(std::file!(), std::line!()),
region, region,
); );
@ -2278,7 +2283,7 @@ fn constrain_def(
pattern_state.constraints.push(Eq( pattern_state.constraints.push(Eq(
expr_type, expr_type,
annotation_expected.clone(), annotation_expected.clone(),
Category::Storage, Category::Storage(std::file!(), std::line!()),
Region::zero(), Region::zero(),
)); ));
@ -2552,7 +2557,7 @@ pub fn rec_defs_help(
let storage_con = Eq( let storage_con = Eq(
expr_type, expr_type,
annotation_expected, annotation_expected,
Category::Storage, Category::Storage(std::file!(), std::line!()),
def.loc_expr.region, def.loc_expr.region,
); );