Add mono tests for opaque pattern with as

This commit is contained in:
Agus Zubiaga 2024-09-02 12:23:25 -03:00
parent ada24e4fd9
commit e2bd31a549
No known key found for this signature in database
3 changed files with 51 additions and 4 deletions

View file

@ -658,15 +658,27 @@ fn record_optional_field_function_use_default() {
}
#[mono_test]
fn as_pattern_in_closure_arg() {
fn record_as_pattern_in_closure_arg() {
r"
g = \{x, y, w, h} -> (x + w, y + h)
f = \{x, y, w, h} -> (x + w, y + h)
f = \({ x, y } as box) ->
g = \({ x, y } as box) ->
(right, bottom) = g box
(x, y, right, bottom)
f { x: 1, y: 2, w: 3, h: 4 }
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)
"
}