-
Notifications
You must be signed in to change notification settings - Fork 449
Closed
Labels
SwiftParserBugs in the (new) Parser written in SwiftBugs in the (new) Parser written in SwiftbugSomething isn't workingSomething isn't working
Description
Issue Kind
Bad Diagnostic Produced
Source Code
if {x}() {}
if x.map{$0} {}
Description
While I would love to have these examples permitted, Swift forbids them but they currently succeed in the new Swift parser without diagnostics and produce the following valid parse tree:
SourceFileSyntax children=2
0: CodeBlockItemListSyntax children=2 // if {x}() {}
0: CodeBlockItemSyntax children=1
0: IfStmtSyntax children=3
0: ifKeyword
1: ConditionElementListSyntax children=1
0: ConditionElementSyntax children=1
0: FunctionCallExprSyntax children=4
0: ClosureExprSyntax children=3
0: leftBrace
1: CodeBlockItemListSyntax children=1
0: CodeBlockItemSyntax children=1
0: IdentifierExprSyntax children=1
0: identifier("x")
2: rightBrace
1: leftParen
2: TupleExprElementListSyntax
3: rightParen
2: CodeBlockSyntax children=3
0: leftBrace
1: CodeBlockItemListSyntax
2: rightBrace
1: CodeBlockItemSyntax children=1 // if x.map{$0} {}
0: IfStmtSyntax children=3
0: ifKeyword
1: ConditionElementListSyntax children=1
0: ConditionElementSyntax children=1
0: FunctionCallExprSyntax children=3
0: MemberAccessExprSyntax children=3
0: IdentifierExprSyntax children=1
0: identifier("x")
1: period
2: identifier("map")
1: TupleExprElementListSyntax
2: ClosureExprSyntax children=3
0: leftBrace
1: CodeBlockItemListSyntax children=1
0: CodeBlockItemSyntax children=1
0: IdentifierExprSyntax children=1
0: dollarIdentifier("$0")
2: rightBrace
2: CodeBlockSyntax children=3
0: leftBrace
1: CodeBlockItemListSyntax
2: rightBrace
1: eof
Metadata
Metadata
Assignees
Labels
SwiftParserBugs in the (new) Parser written in SwiftBugs in the (new) Parser written in SwiftbugSomething isn't workingSomething isn't working