Skip to content

Fix parsing of @_unavailableFromAsync #78313

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
Feb 18, 2025
Merged

Conversation

beccadax
Copy link
Contributor

There’s a very easy to reach llvm_unreachable() in this code which ought to be a diagnostic, as well as a couple of other issues. Rework it into something that’s a bit better at handling the edge cases.

@beccadax
Copy link
Contributor Author

@swift-ci please test

SourceLoc labelLoc;
parseOptionalArgumentLabel(label, labelLoc, /*isAttr=*/true);

if (label.empty()) {
Copy link
Member

Choose a reason for hiding this comment

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

Considering (_: "message", using labelLoc is safer.

Suggested change
if (label.empty()) {
if (labelLoc.isInvalid()) {

Same for the newCode check below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added more test cases covering these combos, reworked the code to behave more nicely.

There’s a very easy to reach `llvm_unreachable()` in this code which ought to be a diagnostic, as well as a couple of other issues. Rework it into something that’s a bit better at handling the edge cases.
@beccadax
Copy link
Contributor Author

@swift-ci please smoke test

@beccadax beccadax enabled auto-merge December 21, 2024 07:13
@beccadax
Copy link
Contributor Author

@swift-ci please test

@beccadax beccadax merged commit 5c28f1d into swiftlang:main Feb 18, 2025
4 of 5 checks passed
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