Skip to content

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

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

Conversation

hborla
Copy link
Member

@hborla hborla commented Oct 23, 2023

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.

Resolves rdar://117357457

in a narrow case that is accepted by compiler versions <=5.9
@hborla
Copy link
Member Author

hborla commented Oct 23, 2023

@swift-ci please smoke test

@hborla hborla merged commit 5f3f845 into swiftlang:main Oct 23, 2023
@hborla hborla deleted the inout-async-downgrade branch October 23, 2023 20:35
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