Skip to content

Parse: Offer a fix-it when platform is specified with the wrong case in availability attributes and queries #61234

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 1 commit into from
Sep 22, 2022

Conversation

tshortli
Copy link
Contributor

Example:

availability.swift:23:12: warning: unknown platform 'macos' for attribute 'available'; did you mean 'macOS'?
@available(macos, unavailable)
           ^~~~~
           macOS

Resolves rdar://100195680

@tshortli tshortli requested a review from xymus September 21, 2022 21:30
Copy link
Contributor

@xymus xymus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice QOL improvement.

I don't know if it's worth it here but I believe this could also handle simple typos if we use the string distance services StringRef::edit_distance to compare the original platform name with all known platform names and return the closest one.

@tshortli
Copy link
Contributor Author

Nice QOL improvement.

I don't know if it's worth it here but I believe this could also handle simple typos if we use the string distance services StringRef::edit_distance to compare the original platform name with all known platform names and return the closest one.

That's a good idea - I opened #61237 to track investigating that as a follow up.

…in availability attributes and queries.

Resolves rdar://100195680
@tshortli tshortli force-pushed the correct-platform-case-fixit branch from 17ca34c to f1ecb4c Compare September 21, 2022 23:21
@tshortli
Copy link
Contributor Author

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit d015505 into swiftlang:main Sep 22, 2022
@tshortli tshortli deleted the correct-platform-case-fixit branch September 22, 2022 16:20
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.

3 participants