swift-syntax icon indicating copy to clipboard operation
swift-syntax copied to clipboard

Macro expansions allow a space (or even newline) between `#` and macro name, as well as `@` and attribute name

Open ahoppen opened this issue 1 year ago • 2 comments

Issue Kind

Other

Source Code

# myMacroName
#
myMacroName
@ MyAttribute
func foo() {}
@
MyAttribute 
func foo() {}

Description

The above examples parse as macro expansion or attribute but shouldn’t be valid. We need to check that the # or @ doesn’t contain trailing trivia and the identifier doesn’t contain leading trivia to parse a macro expansion/attribute.

ahoppen avatar Mar 09 '23 01:03 ahoppen

rdar://106464071

ahoppen avatar Mar 09 '23 01:03 ahoppen

@ahoppen Is it possible to assign this issue to me? I'm already working on it on my free time.

TiagoMaiaL avatar Mar 09 '23 14:03 TiagoMaiaL

Is this still an issue? Screenshot 2024-04-05 at 1 01 48 PM

Matejkob avatar Apr 05 '24 11:04 Matejkob

Screenshot 2024-04-05 at 1 08 09 PM

Matejkob avatar Apr 05 '24 11:04 Matejkob

No, this was fixed by https://github.com/apple/swift-syntax/pull/2466. Thanks for noticing 👍🏽

ahoppen avatar Apr 05 '24 17:04 ahoppen