Skip to content

Commit cd618ac

Browse files
authored
Fixing a bug introduced by one of the fixes (#1421)
1 parent 3b88bee commit cd618ac

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Some Comment
2+
3+
#if DEBUG
4+
#endif
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
// Some Comment
3+
4+
#if DEBUG
5+
#endif

Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/CompilationUnit.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public static Doc Print(CompilationUnitSyntax node, PrintingContext context)
1818
if (
1919
finalTrivia is Concat { Contents.Count: > 1 } list
2020
&& list.Contents[1] is LeadingComment
21-
&& docs[^1] is Concat previousList
21+
&& docs.Count > 0
22+
&& docs[^1] is Concat { Contents.Count: > 1 } previousList
2223
&& previousList.Contents[^1] is HardLine
2324
&& previousList.Contents[^2] is HardLine
2425
)

0 commit comments

Comments
 (0)