Merge pull request #7050 from roc-lang/arg-patterns-as

This commit is contained in:
Agus Zubiaga 2024-09-02 14:02:17 -03:00 committed by GitHub
commit 2469a3aa2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 179 additions and 1 deletions

View file

@ -657,6 +657,31 @@ fn record_optional_field_function_use_default() {
"
}
#[mono_test]
fn record_as_pattern_in_closure_arg() {
r"
f = \{x, y, w, h} -> (x + w, y + h)
g = \({ x, y } as box) ->
(right, bottom) = f box
(x, y, right, bottom)
g { x: 1, y: 2, w: 3, h: 4 }
"
}
#[mono_test]
fn opaque_as_pattern_in_closure_arg() {
r"
Opaque := U64
f = \(@Opaque x) -> x * 2
g = \(@Opaque x as s) -> (x, f s)
g (@Opaque 42)
"
}
#[mono_test]
fn quicksort_help() {
// do we still need with_larger_debug_stack?