Skip to content

[Concurrency] Diagnose non-Sendable 'self' arguments crossing actor isolation boundaries in member reference expressions. #68081

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
Aug 23, 2023

Conversation

hborla
Copy link
Member

@hborla hborla commented Aug 23, 2023

Otherwise, the following code bypasses Sendable checking:

class NotSendable {
  @MainActor
  var x: Int { 0 }
}

func test() async {
  let notSendable = NotSendable()
  await notSendable.x // Sending an instance of 'NotSendable' to the MainActor here!
}

Resolves rdar://111453371

@hborla
Copy link
Member Author

hborla commented Aug 23, 2023

@swift-ci please smoke test

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

That looks good!

…solation

boundaries in member reference expressions.
@hborla hborla force-pushed the sendable-self-in-reference branch from 3d227a6 to 84eaeb7 Compare August 23, 2023 04:28
@hborla
Copy link
Member Author

hborla commented Aug 23, 2023

@swift-ci please smoke test

@hborla hborla merged commit d4f3bc6 into swiftlang:main Aug 23, 2023
@hborla hborla deleted the sendable-self-in-reference branch August 23, 2023 17:56
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