fix some comments

This commit is contained in:
Folkert 2020-07-03 15:58:08 +02:00
parent 744b8ce32b
commit 474d164a8c

View file

@ -118,8 +118,8 @@ pub fn constrain_expr(
let record_type = Type::Record( let record_type = Type::Record(
field_types, field_types,
// TODO can we avoid doing Box::new on every single one of these? // TODO can we avoid doing Box::new on every single one of these?
// For example, could we have a single lazy_static global Box they // We can put `static EMPTY_REC: Type = Type::EmptyRec`, but that requires a
// could all share? // lifetime parameter on `Type`
Box::new(Type::EmptyRec), Box::new(Type::EmptyRec),
); );
let record_con = Eq(record_type, expected.clone(), Category::Record, region); let record_con = Eq(record_type, expected.clone(), Category::Record, region);
@ -600,11 +600,7 @@ pub fn constrain_expr(
} }
} }
// TODO check for exhaustiveness. If this `case` is non-exaustive, then: // exhautiveness checking happens when converting to mono::Expr
//
// 1. Record a Problem.
// 2. Add an extra _ branch at the end which throws a runtime error.
exists(vec![cond_var, *expr_var], And(constraints)) exists(vec![cond_var, *expr_var], And(constraints))
} }
Access { Access {
@ -798,7 +794,6 @@ fn constrain_when_branch(
constraints: Vec::with_capacity(1), constraints: Vec::with_capacity(1),
}; };
// TODO ensure this is correct
// TODO investigate for error messages, is it better to unify all branches with a variable, // TODO investigate for error messages, is it better to unify all branches with a variable,
// then unify that variable with the expectation? // then unify that variable with the expectation?
for loc_pattern in &when_branch.patterns { for loc_pattern in &when_branch.patterns {
@ -967,8 +962,7 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint {
expr_type, expr_type,
annotation_expected.clone(), annotation_expected.clone(),
Category::Storage, Category::Storage,
// TODO proper region annotation.region,
Region::zero(),
)); ));
constrain_expr( constrain_expr(