Skip to content

[AST] @preconcurrency conformance applies to implied conformances a… #74315

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

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jun 11, 2024

…s well

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().

Resolves: #74294
Resolves: rdar://129599097

…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
@xedin
Copy link
Contributor Author

xedin commented Jun 11, 2024

I need to deal with incorrect warning that @preconcurrency has no effect when witness doesn't use it directly in a separate PR.

@xedin
Copy link
Contributor Author

xedin commented Jun 11, 2024

@swift-ci please test

@xedin xedin merged commit b593062 into swiftlang:main Jun 13, 2024
5 checks passed
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.

A preconcurrency conformance does not apply to parent protocols
2 participants