mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #74100 from slavapestov/fix-rdar129024926
Sema: Fix request cycle with isolation inference
This commit is contained in:
@@ -4456,6 +4456,11 @@ getIsolationFromAttributes(const Decl *decl, bool shouldDiagnose = true,
|
||||
/// Infer isolation from witnessed protocol requirements.
|
||||
static std::optional<ActorIsolation>
|
||||
getIsolationFromWitnessedRequirements(ValueDecl *value) {
|
||||
// Associated types cannot have isolation, so there's no such inference for
|
||||
// type witnesses.
|
||||
if (isa<TypeDecl>(value))
|
||||
return std::nullopt;
|
||||
|
||||
auto dc = value->getDeclContext();
|
||||
auto idc = dyn_cast_or_null<IterableDeclContext>(dc->getAsDecl());
|
||||
if (!idc)
|
||||
|
||||
@@ -481,3 +481,13 @@ func checkOpaqueType() -> some Sendable {
|
||||
UnavailableSendable()
|
||||
// expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable; this is an error in the Swift 6 language mode}}
|
||||
}
|
||||
|
||||
// rdar://129024926
|
||||
|
||||
@available(SwiftStdlib 5.1, *)
|
||||
@MainActor class MainActorSuper<T: Sendable> {}
|
||||
|
||||
@available(SwiftStdlib 5.1, *)
|
||||
class MainActorSub: MainActorSuper<MainActorSub.Nested> {
|
||||
struct Nested {} // no cycle
|
||||
}
|
||||
Reference in New Issue
Block a user