-
Notifications
You must be signed in to change notification settings - Fork 439
add parsing for ~ (the 'without' operator) #1461
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
Conversation
@swift-ci please test |
assertParse( | ||
""" | ||
struct Hello: ~Copyable {} | ||
|
||
enum Whatever: Int, ~ Hashable, Equatable {} | ||
""" | ||
) |
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.
Could you create separate assertParse
checks for these two cases and make sure they are parsed correctly (i.e. actually have the ~
as a separate token that’s not part of the identifier?
if self.currentToken.starts(with: "~") { | ||
withoutToken = self.consumePrefix("~", as: .prefixOperator) | ||
} |
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.
Is the ~
part of the identifier? If so, that would surprise me. I would assume that you should be able to do
withoutToken = self.consumeIfContextualPunctuator("~")
/// indicate the suppression of implicit conformance to this type. | ||
/// This child stores the token representing the 'without' operator. | ||
Child( | ||
name: "HasWithout", |
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.
I would prefer this to be named WithoutTilde
. This actually contains the tilde itself, so it’s not a boolean variable, which the Has
implies.
add parsing for ~ (the 'without' operator)
thanks alex for the review. i've addressed them in #1559 |
see the primary PR swiftlang/swift#64699 for more details. This companion PR implements the parsing for the "without operator"
~
used for conformance suppression. For example,~Copyable
.rdar://106775103