Support monomorphic captures of polymorphic expressions in closures

Closes #4349
This commit is contained in:
Ayaz Hafiz 2022-10-17 13:52:33 -05:00
parent a4ed5a582d
commit ee8e718cc1
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 212 additions and 98 deletions

View file

@ -4103,3 +4103,25 @@ fn issue_4348() {
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn issue_4349() {
assert_evals_to!(
indoc!(
r#"
ir = Ok ""
res =
Result.try ir \_ ->
when ir is
Ok "" -> Ok ""
_ -> Err Bad
when res is
Ok _ -> "okay"
_ -> "FAIL"
"#
),
RocStr::from("okay"),
RocStr
);
}