Skip to content

[5.10][Concurrency] Downgrade actor_isolated_mutating_func to a warning in a narrow case that was previously accepted. #69332

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
Oct 24, 2023

Conversation

hborla
Copy link
Member

@hborla hborla commented Oct 23, 2023

  • Explanation: The following code is accepted by the Swift 5.9 compiler and below:
extension Optional {
    mutating func mutate() async {}
}

actor A {
  var dict: [Int: Int] = [:]

  func test() async {
    await dict[0]. mutate()
  }
}

This is invalid because an actor-isolated value is passed as inout to an async function. However, because this code was previously accepted as valid, this change downgrades the diagnostic to a warning prior to Swift 6.

in a narrow case that is accepted by compiler versions <=5.9

(cherry picked from commit 936739e)
@hborla hborla requested a review from a team as a code owner October 23, 2023 16:52
@hborla
Copy link
Member Author

hborla commented Oct 23, 2023

@swift-ci please test

@hborla hborla merged commit d69010e into swiftlang:release/5.10 Oct 24, 2023
@hborla hborla deleted the 5.10-inout-async-downgrade branch October 24, 2023 01:00
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