Constraining of list patterns

This commit is contained in:
Ayaz Hafiz 2022-10-31 12:15:21 -05:00
parent 7b87d0093e
commit 9ab5d0efb8
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 67 additions and 6 deletions

View file

@ -11821,4 +11821,30 @@ All branches in an `if` must have the same type!
I would have to crash if I saw one of those! Add branches for them!
"###
);
test_report!(
#[ignore = "must implement exhaustiveness sketching for lists first"]
mismatch_within_list_pattern,
indoc!(
r#"
when [] is
[A, 1u8] -> ""
"#
),
@r###"
"###
);
test_report!(
#[ignore = "must implement exhaustiveness sketching for lists first"]
mismatch_list_pattern_vs_condition,
indoc!(
r#"
when [A, B] is
["foo", "bar"] -> ""
"#
),
@r###"
"###
);
}