Skip to content

Commit b751e5b

Browse files
authored
Merge pull request swiftlang#67422 from sophiapoirier/abstract-tuple-of-sendable-elements
[Variadic Generics] abstract tuple of Sendable elements does not conform to Sendable
2 parents aae180e + 8f89508 commit b751e5b

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
@@ -1922,7 +1922,7 @@ LookupConformanceInModuleRequest::evaluate(
19221922
Evaluator &evaluator, LookupConformanceDescriptor desc) const {
19231923
auto *mod = desc.Mod;
19241924
auto type = desc.Ty;
1925-
auto protocol = desc.PD;
1925+
auto *protocol = desc.PD;
19261926
ASTContext &ctx = mod->getASTContext();
19271927

19281928
// A dynamic Self type conforms to whatever its underlying type
@@ -2009,9 +2009,10 @@ LookupConformanceInModuleRequest::evaluate(
20092009
return getBuiltinBuiltinTypeConformance(type, builtinType, protocol);
20102010
}
20112011

2012-
// Specific handling of Copyable for pack expansions.
2012+
// Specific handling of Copyable and Sendable for pack expansions.
20132013
if (auto packExpansion = type->getAs<PackExpansionType>()) {
2014-
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
2014+
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable) ||
2015+
protocol->isSpecificProtocol(KnownProtocolKind::Sendable)) {
20152016
auto patternType = packExpansion->getPatternType();
20162017
return (patternType->isTypeParameter()
20172018
? 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)