Skip to content

Commit

Permalink
Add tests with trailing commas in tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Jan 8, 2024
1 parent fe1b820 commit 85c44dd
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scalafmt-tests/src/test/resources/rewrite/RedundantParens.stat
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,10 @@ object A {
(
foo,
)
def test =
((
(foo),
))
def test =
(
Option(""),
Expand All @@ -1339,6 +1343,10 @@ object A {
(
foo,
)
def test =
(
foo,
)
def test =
(
Option(""),
Expand All @@ -1352,6 +1360,10 @@ object A {
(
foo,
)
def test =
((
(foo),
))
def test =
(
Option(""),
Expand All @@ -1362,6 +1374,10 @@ object A {
(
foo,
)
def test =
(
foo,
)
def test =
(
Option(""),
Expand All @@ -1375,6 +1391,10 @@ object A {
(
foo,
)
def test =
((
(foo),
))
def test =
(
Option(""),
Expand All @@ -1385,6 +1405,10 @@ object A {
(
foo,
)
def test =
(
foo,
)
def test =
(
Option(""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,29 @@ class foo(
a, b,
)
}
<<< #3663 enclosed literal
val x = ( "a",
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = ("a", )
^
====== full result: ======
val x = ("a", )
<<< #3663 enclosed lambda
val x = ( x => x + 1,
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = (x => x + 1, )
^
====== full result: ======
val x = (x => x + 1, )
<<< #3663 enclosed lambda 1
val x = (
x => x + 1,
)
>>>
val x = (
x => x + 1,
)
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,29 @@ object a {
)
}
}
<<< #3663 enclosed literal
val x = ( "a",
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = ("a", )
^
====== full result: ======
val x = ("a", )
<<< #3663 enclosed lambda
val x = ( x => x + 1,
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = (x => x + 1, )
^
====== full result: ======
val x = (x => x + 1, )
<<< #3663 enclosed lambda 1
val x = (
x => x + 1,
)
>>>
val x = (
x => x + 1,
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,29 @@ val x = (
)
>>>
val x = ("a", "b")
<<< #3663 enclosed literal
val x = ( "a",
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = ("a", )
^
====== full result: ======
val x = ("a", )
<<< #3663 enclosed lambda
val x = ( x => x + 1,
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = (x => x + 1, )
^
====== full result: ======
val x = (x => x + 1, )
<<< #3663 enclosed lambda 1
val x = (
x => x + 1,
)
>>>
val x = (
x => x + 1,
)
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,29 @@ class foo(
a, b,
)
}
<<< #3663 enclosed literal
val x = ( "a",
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = ("a", )
^
====== full result: ======
val x = ("a", )
<<< #3663 enclosed lambda
val x = ( x => x + 1,
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = (x => x + 1, )
^
====== full result: ======
val x = (x => x + 1, )
<<< #3663 enclosed lambda 1
val x = (
x => x + 1,
)
>>>
val x = (
x => x + 1,
)
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,29 @@ object a {
)
}
}
<<< #3663 enclosed literal
val x = ( "a",
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = ("a", )
^
====== full result: ======
val x = ("a", )
<<< #3663 enclosed lambda
val x = ( x => x + 1,
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = (x => x + 1, )
^
====== full result: ======
val x = (x => x + 1, )
<<< #3663 enclosed lambda 1
val x = (
x => x + 1,
)
>>>
val x = (
x => x + 1,
)
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,29 @@ object a {
)
}
}
<<< #3663 enclosed literal
val x = ( "a",
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = ("a", )
^
====== full result: ======
val x = ("a", )
<<< #3663 enclosed lambda
val x = ( x => x + 1,
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = (x => x + 1, )
^
====== full result: ======
val x = (x => x + 1, )
<<< #3663 enclosed lambda 1
val x = (
x => x + 1,
)
>>>
val x = (
x => x + 1,
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,29 @@ val x = (
)
>>>
val x = ("a", "b")
<<< #3663 enclosed literal
val x = ( "a",
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = ("a", )
^
====== full result: ======
val x = ("a", )
<<< #3663 enclosed lambda
val x = ( x => x + 1,
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = (x => x + 1, )
^
====== full result: ======
val x = (x => x + 1, )
<<< #3663 enclosed lambda 1
val x = (
x => x + 1,
)
>>>
val x = (
x => x + 1,
)
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,29 @@ val x = (
"a",
"b",
)
<<< #3663 enclosed literal
val x = ( "a",
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = ("a", )
^
====== full result: ======
val x = ("a", )
<<< #3663 enclosed lambda
val x = ( x => x + 1,
)
>>>
test does not parse: [dialect scala213] illegal start of simple expression
val x = (x => x + 1, )
^
====== full result: ======
val x = (x => x + 1, )
<<< #3663 enclosed lambda 1
val x = (
x => x + 1,
)
>>>
val x = (
x => x + 1,
)

0 comments on commit 85c44dd

Please sign in to comment.