Skip to content

Commit 9adace8

Browse files
Merge pull request #67407 from sophiapoirier/abstract-tuple-of-sendable-elements
[Variadic Generics] abstract tuple of Sendable elements does not conform to Sendable
2 parents 2473c3b + 974081c commit 9adace8

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

lib/AST/Module.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ LookupConformanceInModuleRequest::evaluate(
19201920
Evaluator &evaluator, LookupConformanceDescriptor desc) const {
19211921
auto *mod = desc.Mod;
19221922
auto type = desc.Ty;
1923-
auto protocol = desc.PD;
1923+
auto *protocol = desc.PD;
19241924
ASTContext &ctx = mod->getASTContext();
19251925

19261926
// A dynamic Self type conforms to whatever its underlying type
@@ -2007,9 +2007,10 @@ LookupConformanceInModuleRequest::evaluate(
20072007
return getBuiltinBuiltinTypeConformance(type, builtinType, protocol);
20082008
}
20092009

2010-
// Specific handling of Copyable for pack expansions.
2010+
// Specific handling of Copyable and Sendable for pack expansions.
20112011
if (auto packExpansion = type->getAs<PackExpansionType>()) {
2012-
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
2012+
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable) ||
2013+
protocol->isSpecificProtocol(KnownProtocolKind::Sendable)) {
20132014
auto patternType = packExpansion->getPatternType();
20142015
return (patternType->isTypeParameter()
20152016
? ProtocolConformanceRef(protocol)

lib/AST/NameLookupRequests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,6 @@ void LookupInModuleRequest::writeDependencySink(
362362
}
363363
}
364364

365-
//----------------------------------------------------------------------------//
366-
// LookupConformanceInModuleRequest computation.
367-
//----------------------------------------------------------------------------//
368-
369365
void swift::simple_display(llvm::raw_ostream &out,
370366
const LookupConformanceDescriptor &desc) {
371367
out << "looking up conformance to ";
@@ -376,6 +372,10 @@ void swift::simple_display(llvm::raw_ostream &out,
376372
simple_display(out, desc.Mod);
377373
}
378374

375+
//----------------------------------------------------------------------------//
376+
// AnyObjectLookupRequest computation.
377+
//----------------------------------------------------------------------------//
378+
379379
void AnyObjectLookupRequest::writeDependencySink(
380380
evaluator::DependencyCollector &reqTracker,
381381
const QualifiedLookupResult &l) const {

test/Constraints/variadic_generic_types.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,12 @@ do {
5656
return Test<String, Int, repeat each T>("a", 42, repeat each v) // Ok
5757
}
5858
}
59+
// rdar://107479662 - variadic tuple of Sendable elements does not conform to Sendable
60+
do {
61+
struct Test<each T> : Sendable {
62+
let prop: (repeat TestProperty<each T>)
63+
}
64+
65+
struct TestProperty<T> : Sendable {
66+
}
67+
}

0 commit comments

Comments
 (0)