Skip to content

Commit 22db563

Browse files
authored
Merge pull request #75359 from hborla/unavailable-sendable-restated
[Concurrency] Don't warn about re-stating inherited unavailable conformances to `Sendable`.
2 parents cb2bd5a + 69b2435 commit 22db563

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Diff for: lib/Sema/TypeCheckConcurrency.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -6219,7 +6219,11 @@ bool swift::checkSendableConformance(
62196219
return false;
62206220

62216221
// If this is an always-unavailable conformance, there's nothing to check.
6222-
if (auto ext = dyn_cast<ExtensionDecl>(conformanceDC)) {
6222+
// We always use the root conformance for this check, because inherited
6223+
// conformances need to walk back to the original declaration for the
6224+
// superclass conformance to find an unavailable attribute.
6225+
if (auto ext = dyn_cast<ExtensionDecl>(
6226+
conformance->getRootConformance()->getDeclContext())) {
62236227
if (AvailableAttr::isUnavailable(ext))
62246228
return false;
62256229
}

Diff for: test/Concurrency/concurrent_value_checking.swift

+8
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ final class C7<T>: Sendable { }
381381

382382
class C9: Sendable { } // expected-warning{{non-final class 'C9' cannot conform to 'Sendable'; use '@unchecked Sendable'}}
383383

384+
@available(*, unavailable)
385+
extension HasUnavailableSendable : @unchecked Sendable { }
386+
387+
class HasUnavailableSendable {
388+
}
389+
390+
class NoRestated: HasUnavailableSendable {} // okay
391+
384392
@globalActor
385393
struct SomeActor {
386394
static let shared = A1()

0 commit comments

Comments
 (0)