-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Parse] Ignore '(' on newline after attribute names #83497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
swiftlang/swift-syntax#3132 |
swiftlang/swift-syntax#3132 |
@@ -2503,7 +2503,7 @@ static std::optional<Identifier> parseSingleAttrOptionImpl( | |||
}; | |||
bool isDeclModifier = DeclAttribute::isDeclModifier(DK); | |||
|
|||
if (!P.Tok.is(tok::l_paren)) { | |||
if (!P.Tok.isFollowingLParen()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this change but I've always disliked the name isFollowingLParen
, to me it reads as "is token following an l-paren", when really it's "is token a following-l-paren". Maybe we should just call it isSameLineLParen
?
Also '#error', '#warning', and '#sourceLocation'. Other call-like syntax (call expression, macro expansion, and custom attribtues) requires '(' on the same line as the callee. For consistency, built-in attributes and built-in directives should also ignore '(' on next line.
44ecb58
to
b271766
Compare
swiftlang/swift-syntax#3132 |
swiftlang/swift-syntax#3132 |
1 similar comment
swiftlang/swift-syntax#3132 |
swiftlang/swift-syntax#3132 |
swiftlang/swift-syntax#3132 |
swiftlang/swift-syntax#3132 |
swiftlang/swift-syntax#3132 |
2 similar comments
swiftlang/swift-syntax#3132 |
swiftlang/swift-syntax#3132 |
Also '#error', '#warning', and '#sourceLocation'.
Other call-like syntax (call expression, macro expansion, custom attributes, and some builtin attributes like
@available
) requires '(' on the same line as the callee name. For consistency, all built-in attributes and directives should also ignore '(' on next line.