mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
remove panic in constrain/src/pattern
This commit is contained in:
parent
503486f5bb
commit
e05bad3c72
2 changed files with 16 additions and 18 deletions
|
@ -117,9 +117,10 @@ pub fn constrain_pattern(
|
||||||
state: &mut PatternState,
|
state: &mut PatternState,
|
||||||
) {
|
) {
|
||||||
match pattern {
|
match pattern {
|
||||||
Underscore | UnsupportedPattern(_) => {
|
Underscore | UnsupportedPattern(_) | Shadowed(_, _) => {
|
||||||
// Neither the _ pattern nor erroneous ones add any constraints.
|
// Neither the _ pattern nor erroneous ones add any constraints.
|
||||||
}
|
}
|
||||||
|
|
||||||
Identifier(symbol) => {
|
Identifier(symbol) => {
|
||||||
state.headers.insert(
|
state.headers.insert(
|
||||||
symbol.clone(),
|
symbol.clone(),
|
||||||
|
@ -271,8 +272,5 @@ pub fn constrain_pattern(
|
||||||
state.constraints.push(whole_con);
|
state.constraints.push(whole_con);
|
||||||
state.constraints.push(tag_con);
|
state.constraints.push(tag_con);
|
||||||
}
|
}
|
||||||
Shadowed(_, _) => {
|
|
||||||
panic!("TODO constrain Shadowed pattern");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,22 +289,22 @@ mod test_report {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
// #[test]
|
||||||
// fn report_shadow() {
|
// fn report_shadow() {
|
||||||
// report_problem_as(
|
// report_problem_as(
|
||||||
// indoc!(
|
// indoc!(
|
||||||
// r#"
|
// r#"
|
||||||
// i = 1
|
// i = 1
|
||||||
//
|
//
|
||||||
// s = \i ->
|
// s = \i ->
|
||||||
// i + 1
|
// i + 1
|
||||||
//
|
//
|
||||||
// s i
|
// s i
|
||||||
// "#
|
// "#
|
||||||
// ),
|
// ),
|
||||||
// indoc!(r#" "#),
|
// indoc!(r#" "#),
|
||||||
// )
|
// )
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #[test]
|
// #[test]
|
||||||
// fn report_unsupported_top_level_def() {
|
// fn report_unsupported_top_level_def() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue