Closed
Description
Issue Kind
Parse of Valid Source Produced Invalid Syntax Tree
Source Code
struct S {
#if swift(>=2.2)
let x: Int
#else
// There should be no error here.
let x: @#$()%&*)@#$(%&*
#endif
}
Description
The above code is from the swift project, and can be found here.
Instead of parsing x
as a constant declaration, with @#$()%&*)@#$(%&*
as its type, the above code only parses let x: @
as a variableDecl
. The rest of the type is parsed in a wrong way, and the following #$()
sequence is parsed as a macroExpansionDecl
.
The following test fails:
func testIfConfigExpr36() {
AssertParse(
"""
struct S {
#if swift(>=2.2)
let x: Int
#else
// There should be no error here.
let x: @#$()%&*)@#$(%&*
#endif
}
"""
)
}