Skip to content

Commit 4305bf6

Browse files
authored
Merge pull request #75360 from hborla/6.0-unavailable-sendable-restated
[6.0][Concurrency] Don't warn about re-stating inherited unavailable conformances to `Sendable`.
2 parents e58b7a3 + fcf6ed7 commit 4305bf6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6193,7 +6193,11 @@ bool swift::checkSendableConformance(
61936193
return false;
61946194

61956195
// If this is an always-unavailable conformance, there's nothing to check.
6196-
if (auto ext = dyn_cast<ExtensionDecl>(conformanceDC)) {
6196+
// We always use the root conformance for this check, because inherited
6197+
// conformances need to walk back to the original declaration for the
6198+
// superclass conformance to find an unavailable attribute.
6199+
if (auto ext = dyn_cast<ExtensionDecl>(
6200+
conformance->getRootConformance()->getDeclContext())) {
61976201
if (AvailableAttr::isUnavailable(ext))
61986202
return false;
61996203
}

test/Concurrency/concurrent_value_checking.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,14 @@ final class C7<T>: Sendable { }
380380

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

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

0 commit comments

Comments
 (0)