From 474d164a8cc27a0c58bdac0ff2041f3e3d304bf9 Mon Sep 17 00:00:00 2001 From: Folkert Date: Fri, 3 Jul 2020 15:58:08 +0200 Subject: [PATCH] fix some comments --- compiler/constrain/src/expr.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/compiler/constrain/src/expr.rs b/compiler/constrain/src/expr.rs index adfdd50005..7e2be731da 100644 --- a/compiler/constrain/src/expr.rs +++ b/compiler/constrain/src/expr.rs @@ -118,8 +118,8 @@ pub fn constrain_expr( let record_type = Type::Record( field_types, // 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 - // could all share? + // We can put `static EMPTY_REC: Type = Type::EmptyRec`, but that requires a + // lifetime parameter on `Type` Box::new(Type::EmptyRec), ); 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: - // - // 1. Record a Problem. - // 2. Add an extra _ branch at the end which throws a runtime error. - + // exhautiveness checking happens when converting to mono::Expr exists(vec![cond_var, *expr_var], And(constraints)) } Access { @@ -798,7 +794,6 @@ fn constrain_when_branch( 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, // then unify that variable with the expectation? for loc_pattern in &when_branch.patterns { @@ -967,8 +962,7 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint { expr_type, annotation_expected.clone(), Category::Storage, - // TODO proper region - Region::zero(), + annotation.region, )); constrain_expr(