better mono repl error

This commit is contained in:
Anton-4 2024-07-12 17:02:34 +02:00
parent b65e65f0a4
commit b702cb634f
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
3 changed files with 14 additions and 1 deletions

View file

@ -34,3 +34,4 @@ bumpalo.workspace = true
hashbrown.workspace = true
parking_lot.workspace = true
static_assertions.workspace = true
indoc.workspace = true

View file

@ -2749,7 +2749,18 @@ fn from_can_let<'a>(
let (mono_pattern, assignments) =
match from_can_pattern(env, procs, layout_cache, &def.loc_pattern.value) {
Ok(v) => v,
Err(_) => todo!(),
Err(_) => {
eprintln!(indoc::indoc! {"
Error:
This can happen if you redefine a variable in the repl, for example:
x = 1
x = 2
Roc does not allow this yet.
"});
std::process::exit(1);
}
};
// convert the continuation