mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] @preconcurrency conformance applies to implied conformances as 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: https://github.com/apple/swift/issues/74294
Resolves: rdar://129599097
This commit is contained in:
@@ -681,7 +681,12 @@ public:
|
||||
assert(sourceKind != ConformanceEntryKind::PreMacroExpansion &&
|
||||
"cannot create conformance pre-macro-expansion");
|
||||
Bits.NormalProtocolConformance.SourceKind = unsigned(sourceKind);
|
||||
ImplyingConformance = implyingConformance;
|
||||
if (auto implying = implyingConformance) {
|
||||
ImplyingConformance = implying;
|
||||
PreconcurrencyLoc = implying->getPreconcurrencyLoc();
|
||||
Bits.NormalProtocolConformance.IsPreconcurrency =
|
||||
implying->isPreconcurrency();
|
||||
}
|
||||
}
|
||||
|
||||
/// Determine whether this conformance is lazily loaded.
|
||||
|
||||
Reference in New Issue
Block a user