-
Notifications
You must be signed in to change notification settings - Fork 440
Improve diagnostics of #available
and #unavailable
#1125
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 |
14eae8f
to
955121b
Compare
@swift-ci Please test |
955121b
to
b121d2e
Compare
@swift-ci Please test |
b121d2e
to
fc6048d
Compare
@swift-ci Please test |
Tests/SwiftParserTest/translated/AvailabilityQueryUnavailabilityTests.swift
Outdated
Show resolved
Hide resolved
if unexpected.first?.as(TokenSyntax.self)?.tokenKind == .pound { | ||
addDiagnostic(unexpected, UnknownDirectiveError(unexpected: unexpected), handledNodes: [unexpected.id, node.identifier.id]) | ||
} else if let availability = unexpected.first?.as(AvailabilityConditionSyntax.self) { | ||
if let prefixOperatorExpr = node.parent?.as(PrefixOperatorExprSyntax.self), |
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.
Might be worth splitting this out into its own method
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 factored out the logic for negatedAvailabilityKeyword
. With that I think the logic is pretty straightforward again.
fc6048d
to
e4eb030
Compare
These two nodes were pretty much always handled the same, we should just have one node definition for it.
e4eb030
to
4e85fa4
Compare
4e85fa4
to
5272e00
Compare
@swift-ci Please test |
Resolves most TODOs in AvailabilityQueryTests.swift and UnavailabilityQueryTests.swift