Skip to content

Commit 53c17df

Browse files
authored
Merge pull request #40439 from DougGregor/require-explicit-sendable-nonsendable
2 parents 9069cc7 + d075734 commit 53c17df

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,8 +929,13 @@ void swift::diagnoseMissingExplicitSendable(NominalTypeDecl *nominal) {
929929
if (!proto)
930930
return;
931931

932-
SmallVector<ProtocolConformance *, 2> conformances;
933-
if (nominal->lookupConformance(proto, conformances))
932+
// Look for a conformance. If it's present and not (directly) missing,
933+
// we're done.
934+
auto conformance = nominal->getParentModule()->lookupConformance(
935+
nominal->getDeclaredInterfaceType(), proto, /*allowMissing=*/true);
936+
if (conformance &&
937+
!(isa<BuiltinProtocolConformance>(conformance.getConcrete()) &&
938+
cast<BuiltinProtocolConformance>(conformance.getConcrete())->isMissing()))
934939
return;
935940

936941
// Diagnose it.

test/Concurrency/require-explicit-sendable.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,5 @@ public struct S10 { // expected-warning{{public struct 'S10' does not specify wh
9797
struct S11: Sendable {
9898
var s7: S7 // expected-warning{{stored property 's7' of 'Sendable'-conforming struct 'S11' has non-sendable type 'S7'}}
9999
}
100+
101+
@_nonSendable public struct S12 { }

0 commit comments

Comments
 (0)