Skip to content

Commit 9f51ea1

Browse files
committed
AST: Remove old tuple conformance logic from getBuiltinTupleTypeConformance()
1 parent 10359ea commit 9f51ea1

File tree

1 file changed

+0
-59
lines changed

1 file changed

+0
-59
lines changed

lib/AST/Module.cpp

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,9 +1713,6 @@ static ProtocolConformanceRef getBuiltinTupleTypeConformance(
17131713
ModuleDecl *module) {
17141714
ASTContext &ctx = protocol->getASTContext();
17151715

1716-
// This is the new code path.
1717-
//
1718-
// FIXME: Remove the Sendable stuff below.
17191716
auto *tupleDecl = ctx.getBuiltinTupleDecl();
17201717

17211718
// Find the (unspecialized) conformance.
@@ -1748,62 +1745,6 @@ static ProtocolConformanceRef getBuiltinTupleTypeConformance(
17481745
return ProtocolConformanceRef(specialized);
17491746
}
17501747

1751-
/// For some known protocols (KPs) like Sendable and Copyable, a tuple type
1752-
/// conforms to the protocol KP when all of their element types conform to KP.
1753-
if (protocol->isSpecificProtocol(KnownProtocolKind::Sendable) ||
1754-
protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
1755-
1756-
// Create the pieces for a generic tuple type (T1, T2, ... TN) and a
1757-
// generic signature <T1, T2, ..., TN>.
1758-
SmallVector<GenericTypeParamType *, 4> genericParams;
1759-
SmallVector<Type, 4> typeSubstitutions;
1760-
SmallVector<TupleTypeElt, 4> genericElements;
1761-
SmallVector<Requirement, 4> conditionalRequirements;
1762-
for (const auto &elt : tupleType->getElements()) {
1763-
auto genericParam = GenericTypeParamType::get(/*isParameterPack*/ false, 0,
1764-
genericParams.size(), ctx);
1765-
genericParams.push_back(genericParam);
1766-
typeSubstitutions.push_back(elt.getType());
1767-
genericElements.push_back(elt.getWithType(genericParam));
1768-
conditionalRequirements.push_back(
1769-
Requirement(RequirementKind::Conformance, genericParam,
1770-
protocol->getDeclaredType()));
1771-
}
1772-
1773-
// If there were no generic parameters, just form the builtin conformance.
1774-
if (genericParams.empty()) {
1775-
return ProtocolConformanceRef(
1776-
ctx.getBuiltinConformance(type, protocol, GenericSignature(), { },
1777-
BuiltinConformanceKind::Synthesized));
1778-
}
1779-
1780-
// Form a generic conformance of (T1, T2, ..., TN): KP with signature
1781-
// <T1, T2, ..., TN> and conditional requirements T1: KP,
1782-
// T2: P, ..., TN: KP.
1783-
auto genericTupleType = TupleType::get(genericElements, ctx);
1784-
auto genericSig = GenericSignature::get(
1785-
genericParams, conditionalRequirements);
1786-
auto genericConformance = ctx.getBuiltinConformance(
1787-
genericTupleType, protocol, genericSig, conditionalRequirements,
1788-
BuiltinConformanceKind::Synthesized);
1789-
1790-
// Compute the substitution map from the generic parameters of the
1791-
// generic conformance to actual types that were in the tuple type.
1792-
// Form a specialized conformance from that.
1793-
auto subMap = SubstitutionMap::get(
1794-
genericSig, [&](SubstitutableType *type) {
1795-
if (auto gp = dyn_cast<GenericTypeParamType>(type)) {
1796-
if (gp->getDepth() == 0)
1797-
return typeSubstitutions[gp->getIndex()];
1798-
}
1799-
1800-
return Type(type);
1801-
},
1802-
LookUpConformanceInModule(module));
1803-
return ProtocolConformanceRef(
1804-
ctx.getSpecializedConformance(type, genericConformance, subMap));
1805-
}
1806-
18071748
return ProtocolConformanceRef::forMissingOrInvalid(type, protocol);
18081749
}
18091750

0 commit comments

Comments
 (0)