Skip to content

[Variadic Generics] abstract tuple of Sendable elements does not conform to Sendable #67422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/AST/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,7 @@ LookupConformanceInModuleRequest::evaluate(
Evaluator &evaluator, LookupConformanceDescriptor desc) const {
auto *mod = desc.Mod;
auto type = desc.Ty;
auto protocol = desc.PD;
auto *protocol = desc.PD;
ASTContext &ctx = mod->getASTContext();

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

// Specific handling of Copyable for pack expansions.
// Specific handling of Copyable and Sendable for pack expansions.
if (auto packExpansion = type->getAs<PackExpansionType>()) {
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable) ||
protocol->isSpecificProtocol(KnownProtocolKind::Sendable)) {
auto patternType = packExpansion->getPatternType();
return (patternType->isTypeParameter()
? ProtocolConformanceRef(protocol)
Expand Down
8 changes: 4 additions & 4 deletions lib/AST/NameLookupRequests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,6 @@ void LookupInModuleRequest::writeDependencySink(
}
}

//----------------------------------------------------------------------------//
// LookupConformanceInModuleRequest computation.
//----------------------------------------------------------------------------//

void swift::simple_display(llvm::raw_ostream &out,
const LookupConformanceDescriptor &desc) {
out << "looking up conformance to ";
Expand All @@ -376,6 +372,10 @@ void swift::simple_display(llvm::raw_ostream &out,
simple_display(out, desc.Mod);
}

//----------------------------------------------------------------------------//
// AnyObjectLookupRequest computation.
//----------------------------------------------------------------------------//

void AnyObjectLookupRequest::writeDependencySink(
evaluator::DependencyCollector &reqTracker,
const QualifiedLookupResult &l) const {
Expand Down
9 changes: 9 additions & 0 deletions test/Constraints/variadic_generic_types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ do {
return Test<String, Int, repeat each T>("a", 42, repeat each v) // Ok
}
}
// rdar://107479662 - variadic tuple of Sendable elements does not conform to Sendable
do {
struct Test<each T> : Sendable {
let prop: (repeat TestProperty<each T>)
}

struct TestProperty<T> : Sendable {
}
}