Skip to content

Commit 8bca3ce

Browse files
authored
fixing issue with extra line before collection expression within a ca… (#1335)
…st expression closes #1334
1 parent 4d51407 commit 8bca3ce

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

Src/CSharpier.Tests/FormattingTests/TestFiles/cs/CollectionExpressions.test

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,35 @@ class MyClass
146146
]
147147
)]
148148
class ClassName { }
149+
150+
class CastExpressions
151+
{
152+
void MethodName()
153+
{
154+
var x = (string[])[someValue, someValue];
155+
156+
var x = (string[])
157+
[longValue________________________________, longValue________________________________];
158+
159+
var x = (string[])
160+
[
161+
longerValue_____________________________________________,
162+
longerValue_____________________________________________,
163+
];
164+
165+
CallMethod((string[])[someValue, someValue]);
166+
167+
CallMethod(
168+
(string[])
169+
[longValue______________________________, longValue______________________________]
170+
);
171+
172+
CallMethod(
173+
(string[])
174+
[
175+
longerValue_____________________________________________,
176+
longerValue_____________________________________________,
177+
]
178+
);
179+
}
180+
}

Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/CollectionExpression.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public static Doc Print(CollectionExpressionSyntax node, FormattingContext conte
88
is ArgumentSyntax { NameColon: null }
99
or AttributeArgumentSyntax
1010
or ArrowExpressionClauseSyntax
11+
or CastExpressionSyntax
1112
or ExpressionElementSyntax
1213
or SimpleLambdaExpressionSyntax
1314
or AssignmentExpressionSyntax

0 commit comments

Comments
 (0)