Skip to content

Commit 8493312

Browse files
authored
Merge pull request #74100 from slavapestov/fix-rdar129024926
Sema: Fix request cycle with isolation inference
2 parents 48237b8 + 3196164 commit 8493312

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/Sema/TypeCheckConcurrency.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -4456,6 +4456,11 @@ getIsolationFromAttributes(const Decl *decl, bool shouldDiagnose = true,
44564456
/// Infer isolation from witnessed protocol requirements.
44574457
static std::optional<ActorIsolation>
44584458
getIsolationFromWitnessedRequirements(ValueDecl *value) {
4459+
// Associated types cannot have isolation, so there's no such inference for
4460+
// type witnesses.
4461+
if (isa<TypeDecl>(value))
4462+
return std::nullopt;
4463+
44594464
auto dc = value->getDeclContext();
44604465
auto idc = dyn_cast_or_null<IterableDeclContext>(dc->getAsDecl());
44614466
if (!idc)

test/Concurrency/sendable_checking.swift

+10
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,13 @@ func checkOpaqueType() -> some Sendable {
481481
UnavailableSendable()
482482
// expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable; this is an error in the Swift 6 language mode}}
483483
}
484+
485+
// rdar://129024926
486+
487+
@available(SwiftStdlib 5.1, *)
488+
@MainActor class MainActorSuper<T: Sendable> {}
489+
490+
@available(SwiftStdlib 5.1, *)
491+
class MainActorSub: MainActorSuper<MainActorSub.Nested> {
492+
struct Nested {} // no cycle
493+
}

0 commit comments

Comments
 (0)