Skip to content

Commit 45c7d6f

Browse files
committed
Allow missing Sendable conformances when type parametesr are made concrete.
Fixes rdar://91174106.
1 parent fdc6260 commit 45c7d6f

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

lib/AST/RequirementMachine/ConcreteContraction.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ Optional<Type> ConcreteContraction::substTypeParameter(
223223

224224
auto conformance = ((*substBaseType)->isTypeParameter()
225225
? ProtocolConformanceRef(proto)
226-
: module->lookupConformance(*substBaseType, proto));
226+
: module->lookupConformance(*substBaseType, proto,
227+
/*allowMissing=*/true));
227228

228229
// The base type doesn't conform, in which case the requirement remains
229230
// unsubstituted.
@@ -363,7 +364,8 @@ ConcreteContraction::substRequirement(const Requirement &req) const {
363364
auto *proto = req.getProtocolDecl();
364365
auto *module = proto->getParentModule();
365366
if (!substFirstType->isTypeParameter() &&
366-
!module->lookupConformance(substFirstType, proto)) {
367+
!module->lookupConformance(substFirstType, proto,
368+
/*allowMissing=*/true)) {
367369
// Handle the case of <T where T : P, T : C> where C is a class and
368370
// C does not conform to P by leaving the conformance requirement
369371
// unsubstituted.
@@ -664,4 +666,4 @@ bool swift::rewriting::performConcreteContraction(
664666
ConcreteContraction concreteContraction(debug);
665667
return concreteContraction.performConcreteContraction(
666668
requirements, result, errors);
667-
}
669+
}

test/Concurrency/sendable_conformance_checking.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,11 @@ extension SendableExtSub: @unchecked Sendable {}
165165
// Still want to know about same-class redundancy
166166
class MultiConformance: @unchecked Sendable {} // expected-note {{'MultiConformance' declares conformance to protocol 'Sendable' here}}
167167
extension MultiConformance: @unchecked Sendable {} // expected-error {{redundant conformance of 'MultiConformance' to protocol 'Sendable'}}
168+
169+
// rdar://91174106 - allow missing Sendable conformances when extending a
170+
// type generically.
171+
// FIXME: Should warn because of missing Sendable, but currently is silent.
172+
// We don't want a hard error except in Swift 6.
173+
struct X<T: Sendable> { }
174+
enum Y {}
175+
extension X where T == Y {}

0 commit comments

Comments
 (0)