Fix list rest bind in when branch tuple destructure

This commit is contained in:
JRI98 2023-12-21 11:55:29 +00:00
parent 9b7eb05b87
commit 689a1ff352
No known key found for this signature in database
GPG key ID: F83B29916FF13F24
3 changed files with 81 additions and 3 deletions

View file

@ -3447,3 +3447,19 @@ fn inspect_derived_dict() {
"#
)
}
#[mono_test]
fn issue_6196() {
indoc!(
r#"
nth : List a, Nat -> Result a [OutOfBounds]
nth = \l, i ->
when (l, i) is
([], _) -> Err OutOfBounds
([e, ..], 0) -> Ok e
([_, .. as rest], _) -> nth rest (i - 1)
nth ["a"] 0
"#
)
}