error message for record update and missing module

This commit is contained in:
Folkert 2020-07-14 23:24:30 +02:00
parent 27317110f2
commit 331a8ed5eb
8 changed files with 153 additions and 8 deletions

View file

@ -214,10 +214,17 @@ pub fn canonicalize_expr<'a>(
(answer, output)
} else {
panic!(
"TODO canonicalize invalid record update (non-Var in update position)\n{:?}",
can_update.value
);
// only (optionally qualified) variables can be updated, not arbitrary expressions
let error = roc_problem::can::RuntimeError::InvalidRecordUpdate {
region: can_update.region,
};
let answer = Expr::RuntimeError(error.clone());
env.problems.push(Problem::RuntimeError(error));
(answer, Output::default())
}
}
ast::Expr::Record {