Properly implement lifting for if and when

This commit is contained in:
Joshua Warner 2025-01-01 12:03:26 -05:00
parent 2918e26b38
commit 14b18f4213
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
5 changed files with 93 additions and 2 deletions

View file

@ -0,0 +1,39 @@
@0-17 SpaceAfter(
When(
@5-6 Var {
module_name: "",
ident: "n",
},
[
WhenBranch {
patterns: [
@10-11 SpaceBefore(
Tag(
"O",
),
[
Newline,
],
),
],
value: @13-17 ParensAround(
SpaceAfter(
Var {
module_name: "",
ident: "s",
},
[
Newline,
],
),
),
guard: None,
},
],
),
[
LineComment(
"",
),
],
)

View file

@ -0,0 +1,3 @@
when n is
O->(s
)#

View file

@ -751,6 +751,7 @@ mod test_snapshots {
pass/var_minus_two.expr,
pass/var_then.expr,
pass/var_when.expr,
pass/when_branch_comment_after_parens.expr,
pass/when_comment_after_pattern.expr,
pass/when_comment_bbefore_if.expr,
pass/when_if_guard.expr,