Skip to content

Commit 79cf063

Browse files
authored
Merge pull request swiftlang#74102 from slavapestov/fix-rdar129024926-6.0
[6.0] Sema: Fix request cycle with isolation inference
2 parents 04d082c + d818314 commit 79cf063

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4440,6 +4440,11 @@ getIsolationFromAttributes(const Decl *decl, bool shouldDiagnose = true,
44404440
/// Infer isolation from witnessed protocol requirements.
44414441
static std::optional<ActorIsolation>
44424442
getIsolationFromWitnessedRequirements(ValueDecl *value) {
4443+
// Associated types cannot have isolation, so there's no such inference for
4444+
// type witnesses.
4445+
if (isa<TypeDecl>(value))
4446+
return std::nullopt;
4447+
44434448
auto dc = value->getDeclContext();
44444449
auto idc = dyn_cast_or_null<IterableDeclContext>(dc->getAsDecl());
44454450
if (!idc)

test/Concurrency/sendable_checking.swift

Lines changed: 10 additions & 0 deletions
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)