Adjust parens around patterns in annotations

This commit is contained in:
Joshua Warner 2024-12-01 17:11:21 -08:00
parent b79d387b46
commit 84b3969648
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
23 changed files with 88 additions and 128 deletions

View file

@ -1,4 +1,4 @@
UserId x : [UserId I64]
UserId x = UserId 42
(UserId x) = UserId 42
x

View file

@ -1,2 +1,2 @@
Email str = Email "blah@example.com"
(Email str) = Email "blah@example.com"
str

View file

@ -1,22 +0,0 @@
expect
html : Html {}
html =
Element "a" 43 [HtmlAttr "href" "https://www.roc-lang.org/"] [Text "Roc"]
actual : { nodes : List RenderedNode, siblingIds : List U64 }
actual =
indexNodes { nodes: [], siblingIds: [] } html
expected : { nodes : List RenderedNode, siblingIds : List U64 }
expected = {
nodes: [
RenderedText "Roc",
RenderedElement "a" { emptyRenderedAttrs & htmlAttrs: Dict.fromList [("href", "https://www.roc-lang.org/")] } [0],
],
siblingIds: [1],
}
(actual.nodes == expected.nodes)
&& (actual.siblingIds == expected.siblingIds)

View file

@ -1,66 +1,34 @@
{
u8: 123u8,
u16: 123u16,
u32: 123u32,
u64: 123u64,
u128: 123u128,
i8: 123i8,
i16: 123i16,
i32: 123i32,
i64: 123i64,
i128: 123i128,
dec: 123dec,
u8Neg: -123u8,
u16Neg: -123u16,
u32Neg: -123u32,
u64Neg: -123u64,
u128Neg: -123u128,
i8Neg: -123i8,
i16Neg: -123i16,
i32Neg: -123i32,
i64Neg: -123i64,
i128Neg: -123i128,
decNeg: -123dec,
u8Bin: 0b101u8,
u16Bin: 0b101u16,
u32Bin: 0b101u32,
u64Bin: 0b101u64,
u128Bin: 0b101u128,
i8Bin: 0b101i8,
i16Bin: 0b101i16,
i32Bin: 0b101i32,
i64Bin: 0b101i64,
i128Bin: 0b101i128,
}

View file

@ -1,2 +1,2 @@
@Thunk it = id (@A {})
(@Thunk it) = id (@A {})
it {}

View file

@ -1,6 +1,4 @@
{ Foo.Bar.baz <-
x: 5,
y: 0,
}

View file

@ -1,10 +1,6 @@
{ Foo.Bar.baz <-
x: 5,
y: 0,
_z: 3,
_: 2,
}

View file

@ -1,6 +1,4 @@
{
answer: 42,
launchTheNukes!: \{} -> boom,
}

View file

@ -1,3 +1,3 @@
Config launchTheNukes! code = cfg
(Config launchTheNukes! code) = cfg
launchTheNukes! code

View file

@ -1,3 +1,3 @@
Config launchTheNukes! code = cfg
(Config launchTheNukes! code) = cfg
launchTheNukes! code

View file

@ -1,7 +1,7 @@
Pair x _ = Pair 0 1
Pair _ y = Pair 0 1
Pair _ _ = Pair 0 1
(Pair x _) = Pair 0 1
(Pair _ y) = Pair 0 1
(Pair _ _) = Pair 0 1
_ = Pair 0 1
Pair (Pair x _) (Pair _ y) = Pair (Pair 0 1) (Pair 2 3)
(Pair (Pair x _) (Pair _ y)) = Pair (Pair 0 1) (Pair 2 3)
0

View file

@ -2144,40 +2144,6 @@ mod test_fmt {
);
}
#[test]
fn comments_with_newlines_in_records() {
expr_formats_to(
indoc!(
r"
{
z: 44 #comment 0
,
y: 41, # comment 1
# comment 2
x: 42
# comment 3
# comment 4
}"
),
indoc!(
r"
{
z: 44,
# comment 0
y: 41,
# comment 1
# comment 2
x: 42,
# comment 3
# comment 4
}"
),
);
}
#[test]
fn multiple_final_comments_with_comma_in_records() {
expr_formats_to(