From eaf980d8b69f2caf5ee15d3e328cc3dc6b3af2f5 Mon Sep 17 00:00:00 2001 From: Kim de Vos Date: Mon, 24 Apr 2023 10:57:10 +0200 Subject: [PATCH] move inner block out This resultet in a parser nesting error --- .../SwiftSyntaxTest/SyntaxVisitorTests.swift | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift b/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift index b408b1aa073..9dff638264c 100644 --- a/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift +++ b/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift @@ -29,6 +29,27 @@ public class SyntaxVisitorTests: XCTestCase { /// /// The source file is hard-coded so this test case doesn't need to depend on the parser. static var nestedFunctionsFile: SourceFileSyntax { + let innerBody = CodeBlockSyntax( + leftBrace: .leftBraceToken(), + statements: CodeBlockItemListSyntax([ + CodeBlockItemSyntax( + item: CodeBlockItemSyntax.Item( + IntegerLiteralExprSyntax( + digits: .integerLiteral( + "0xG", + leadingTrivia: [ + .newlines(1), + .spaces(6), + .blockComment("/*Unknown token */"), + ] + ) + ) + ) + ) + ]), + rightBrace: .rightBraceToken(leadingTrivia: [.newlines(1), .spaces(4)]) + ) + let source = SourceFileSyntax( statements: CodeBlockItemListSyntax([ CodeBlockItemSyntax( @@ -76,26 +97,7 @@ public class SyntaxVisitorTests: XCTestCase { rightParen: .rightParenToken(trailingTrivia: .space) ) ), - body: CodeBlockSyntax( - leftBrace: .leftBraceToken(), - statements: CodeBlockItemListSyntax([ - CodeBlockItemSyntax( - item: CodeBlockItemSyntax.Item( - IntegerLiteralExprSyntax( - digits: .integerLiteral( - "0xG", - leadingTrivia: [ - .newlines(1), - .spaces(6), - .blockComment("/*Unknown token */"), - ] - ) - ) - ) - ) - ]), - rightBrace: .rightBraceToken(leadingTrivia: [.newlines(1), .spaces(4)]) - ) + body: innerBody ) ) )