Add regression tests for #4772

Closes #4772
This commit is contained in:
Ayaz Hafiz 2023-01-16 14:43:36 -06:00
parent e6926b6fe0
commit 9a4e4f25c2
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 408 additions and 0 deletions

View file

@ -2448,3 +2448,30 @@ fn function_specialization_information_in_lambda_set_thunk_independent_defs() {
"###
)
}
#[mono_test(mode = "test")]
fn issue_4772_weakened_monomorphic_destructure() {
indoc!(
r###"
interface Test exposes [] imports [Json]
getNumber =
{ result, rest } = Decode.fromBytesPartial (Str.toUtf8 "-1234") Json.fromUtf8
when result is
Ok val ->
when Str.toI64 val is
Ok number ->
Ok {val : number, input : rest}
Err InvalidNumStr ->
Err (ParsingFailure "not a number")
Err _ ->
Err (ParsingFailure "not a number")
expect
result = getNumber
result == Ok {val : -1234i64, input : []}
"###
)
}