Add test cases for uninhabited variant collapsing with destructure patterns

Closes #4080
This commit is contained in:
Ayaz Hafiz 2022-09-20 14:22:40 -05:00
parent f96c825aa4
commit 412c73c54c
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -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",
);
}
}