Skip to content

[Concurrency] Fix a crash caused by misuse of isolated modifier #82593

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
Jun 30, 2025

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jun 28, 2025

Adjust isolation checking to handle misused isolated attribute and let attribute checker property diagnose it.

Resolves: rdar://148076903
Resolves: #80363

Adjust isolation checking to handle misused `isolated` attribute
and let attribute checker property diagnose it.

Resolves: rdar://148076903
Resolves: swiftlang#80363
@xedin
Copy link
Contributor Author

xedin commented Jun 28, 2025

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jun 28, 2025

@swift-ci please test macOS platform

@xedin
Copy link
Contributor Author

xedin commented Jun 28, 2025

@swift-ci please test Windows platform

@xedin xedin merged commit d3f86b4 into swiftlang:main Jun 30, 2025
5 checks passed

func testLocal() {
isolated let c = C()
// expected-error@-1 {{'isolated' may only be used on 'deinit' declarations}}
Copy link
Contributor

Choose a reason for hiding this comment

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

the error message isn't quite right. it may also be used on parameters today: func p(a: isolated A) where A is an : Actor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, this is just a crash fix, we can adjust the message separately.

class C {}

func testLocal() {
isolated let c = C()
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that in the future we'd actually want to support that kinda, in those cases:

func p(pp: isolated P) {
  isolated let c = pp // carry "forward" that it was isolated
}

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.

[6.2, 6.1 regression] Misused isolated keyword crashes the compiler.
3 participants