Skip to content

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

Merged
merged 6 commits into from
Jan 12, 2023

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Dec 10, 2022

Resolves most TODOs in AvailabilityQueryTests.swift and UnavailabilityQueryTests.swift

@ahoppen ahoppen requested a review from bnbarham December 10, 2022 10:28
@ahoppen
Copy link
Member Author

ahoppen commented Dec 10, 2022

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Dec 12, 2022

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Jan 11, 2023

@swift-ci Please test

@ahoppen ahoppen force-pushed the ahoppen/availability-diags branch from b121d2e to fc6048d Compare January 11, 2023 10:42
@ahoppen
Copy link
Member Author

ahoppen commented Jan 11, 2023

@swift-ci Please test

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),
Copy link
Contributor

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

Copy link
Member Author

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.

@ahoppen ahoppen force-pushed the ahoppen/availability-diags branch from fc6048d to e4eb030 Compare January 12, 2023 07:45
These two nodes were pretty much always handled the same, we should just have one node definition for it.
@ahoppen ahoppen force-pushed the ahoppen/availability-diags branch from e4eb030 to 4e85fa4 Compare January 12, 2023 10:17
@ahoppen ahoppen force-pushed the ahoppen/availability-diags branch from 4e85fa4 to 5272e00 Compare January 12, 2023 10:19
@ahoppen
Copy link
Member Author

ahoppen commented Jan 12, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit b5bf778 into swiftlang:main Jan 12, 2023
@ahoppen ahoppen deleted the ahoppen/availability-diags branch January 12, 2023 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants