Skip to content

[6.0][AST] @preconcurrency conformance applies to implied conformances as well #74429

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 17, 2024

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jun 14, 2024

Cherry-pick of #74315


  • Explanation:

    A @preconcurrency conformance to an inherited protocol should imply @preconcurrency on its parents as well. For example:

    protocol Parent {
      func a()
    }
    
    protocol Child: Parent {
      func b()
    }
    
    @MainActor
    class Test: @preconcurrency Child {
      func a() {
      }
    
      func b() {
      }
    }

    Test conformance to Parent implied by its conformance to Child should carry @preconcurrency and inject dynamic actor isolation checks to witness of a().

  • Main Branch PR: [AST] @preconcurrency conformance applies to implied conformances a… #74315

  • Resolves: rdar://129599097

  • Risk: Low

  • Reviewed By: @hborla

  • Testing: Existing test-cases were modified and new tests were added.

Resolves: #74294

(cherry picked from commit 414295d)

…s well

A `@preconcurrency` conformance to an inherited protocol should imply
`@preconcurrency` on its parents as well. For example:

```swift
protocol Parent {
  func a()
}

protocol Child: Parent {
  func b()
}

@mainactor
class Test: @preconcurrency Child {
  func a() {
  }

  func b() {
  }
}
```

`Test` conformance to `Parent` implied by its conformance to `Child`
should carry `@preconcurrency` and inject dynamic actor isolation checks
to witness of `a()`.

Resolves: swiftlang#74294
Resolves: rdar://129599097
(cherry picked from commit 414295d)
@xedin xedin added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels Jun 14, 2024
@xedin xedin requested a review from hborla June 14, 2024 17:08
@xedin xedin requested a review from a team as a code owner June 14, 2024 17:08
@xedin
Copy link
Contributor Author

xedin commented Jun 14, 2024

@swift-ci please test

@xedin xedin merged commit ddad629 into swiftlang:release/6.0 Jun 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants