mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Constraining of list patterns
This commit is contained in:
parent
7b87d0093e
commit
9ab5d0efb8
4 changed files with 67 additions and 6 deletions
|
@ -1945,8 +1945,8 @@ fn to_pattern_report<'b>(
|
|||
severity: Severity::RuntimeError,
|
||||
}
|
||||
}
|
||||
PReason::TagArg { .. } | PReason::PatternGuard => {
|
||||
unreachable!("I didn't think this could trigger. Please tell Folkert about it!")
|
||||
PReason::TagArg { .. } | PReason::PatternGuard | PReason::ListElem => {
|
||||
internal_error!("We didn't think this could trigger. Please tell us about it on Zulip if it does!")
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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###"
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue