Improve handling of multi pattern unbound variables

This commit is contained in:
JRI98 2023-12-21 11:58:55 +00:00
parent b74653db8e
commit acbbdd0f7b
No known key found for this signature in database
GPG key ID: F83B29916FF13F24
2 changed files with 37 additions and 8 deletions

View file

@ -10220,6 +10220,28 @@ In roc, functions are always written as a lambda, like{}
"#
);
test_report!(
issue_6279,
indoc!(
r#"
when A "" is
A x | B x | C -> x
"#
),
@r###"
NAME NOT BOUND IN ALL PATTERNS in /code/proj/Main.roc
`x` is not bound in all patterns of this `when` branch
5 A x | B x | C -> x
^
Identifiers introduced in a `when` branch must be bound in all patterns
of the branch. Otherwise, the program would crash when it tries to use
an identifier that wasn't bound!
"###
);
test_report!(
flip_flop_catch_all_branches_not_exhaustive,
indoc!(