Skip to content

A couple of SourceRange fixes for nonisolated #80345

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 3 commits into from
Mar 27, 2025

Conversation

hamishknight
Copy link
Contributor

@hamishknight hamishknight commented Mar 27, 2025

  • Modifiers like nonisolated aren't spelled with an @, make sure the type attribute logic handles a missing @. I don't have a test case for this, but this would assert if the source range were queried.
  • Make sure we correctly set the attribute range when used as a decl attribute with @.

rdar://147965036

@xedin
Copy link
Contributor

xedin commented Mar 27, 2025

@hamishknight I do have a test-case :)

func test(_: () -> Void) {}

test { @nonisolated in
}

This is a reduction from rdar://147965036

@hamishknight
Copy link
Contributor Author

I do have a test-case :)

Funnily enough that's actually a different issue since it's a decl attribute there 😄 I see the issue, I can put up a fix for it

@xedin
Copy link
Contributor

xedin commented Mar 27, 2025

Heh, thanks!

Attributes like `nonisolated` aren't spelled with an `@`. I don't
have a test case, but this would assert if the source range were
queried.
Avoid printing a spurious space when not printing the `attribute`
branch of this diagnostic.
Make sure we set the `AttrRange` in cases where `@` is present, but
`unsafe` isn't present.

rdar://147965036
@hamishknight
Copy link
Contributor Author

Updated with the fix for rdar://147965036

@hamishknight
Copy link
Contributor Author

@swift-ci please smoke test

@hamishknight hamishknight changed the title [AST] Handle missing @ location in AtTypeAttrBase A couple of SourceRange fixes for nonisolated Mar 27, 2025
@hamishknight hamishknight enabled auto-merge March 27, 2025 20:09
@hamishknight hamishknight merged commit 98ce87c into swiftlang:main Mar 27, 2025
3 checks passed
@hamishknight hamishknight deleted the nonisolated-range branch March 28, 2025 08:45
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