mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 06:55:15 +00:00
Add test cases for uninhabited variant collapsing with destructure patterns
Closes #4080
This commit is contained in:
parent
f96c825aa4
commit
412c73c54c
1 changed files with 32 additions and 0 deletions
|
@ -7791,4 +7791,36 @@ mod solve_expr {
|
|||
"Str",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn match_on_result_with_uninhabited_error_destructuring() {
|
||||
infer_eq_without_problem(
|
||||
indoc!(
|
||||
r#"
|
||||
x : Result Str []
|
||||
x = Ok "abc"
|
||||
|
||||
Ok str = x
|
||||
|
||||
str
|
||||
"#
|
||||
),
|
||||
"Str",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn match_on_result_with_uninhabited_error_destructuring_in_lambda_syntax() {
|
||||
infer_eq_without_problem(
|
||||
indoc!(
|
||||
r#"
|
||||
x : Result Str [] -> Str
|
||||
x = \Ok s -> s
|
||||
|
||||
x
|
||||
"#
|
||||
),
|
||||
"Result Str [] -> Str",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue