@@ -122,50 +122,11 @@ ProtocolConformanceRef::subst(Type origType,
122
122
123
123
auto *proto = getRequirement();
124
124
125
- // If the original type was an archetype, check the conformance map.
126
- if (origType->is<SubstitutableType>()
127
- || origType->is<DependentMemberType>()) {
128
- if (auto result = conformances(origType->getCanonicalType(),
129
- substType,
130
- proto->getDeclaredType())) {
131
- return *result;
132
- }
133
- }
134
-
135
- // If that didn't find anything, we can still synthesize AnyObject
136
- // conformances from thin air. FIXME: this is going away soon.
137
- if (proto->isSpecificProtocol(KnownProtocolKind::AnyObject)) {
138
- if (substType->isExistentialType())
139
- return *this;
140
-
141
- ClassDecl *classDecl = nullptr;
142
- auto archetype = substType->getAs<ArchetypeType>();
143
-
144
- if (archetype) {
145
- if (archetype->getSuperclass())
146
- classDecl = archetype->getSuperclass()->getClassOrBoundGenericClass();
147
-
148
- // A class-constrained archetype without a superclass constraint
149
- // conforms to AnyObject abstractly.
150
- if (!classDecl && archetype->requiresClass())
151
- return ProtocolConformanceRef(proto);
152
- } else {
153
- classDecl = substType->getClassOrBoundGenericClass();
154
- }
155
-
156
- assert(classDecl);
157
-
158
- // Create a concrete conformance based on the conforming class.
159
- SmallVector<ProtocolConformance *, 1> lookupResults;
160
- classDecl->lookupConformance(classDecl->getParentModule(), proto,
161
- lookupResults);
162
- auto *conf = lookupResults.front();
163
- auto subMap = substType->getContextSubstitutionMap(
164
- conf->getDeclContext()->getParentModule(), conf->getDeclContext());
165
- if (!subMap.empty())
166
- conf = substType->getASTContext().getSpecializedConformance(substType,
167
- conf, subMap);
168
- return ProtocolConformanceRef(conf);
125
+ // Check the conformance map.
126
+ if (auto result = conformances(origType->getCanonicalType(),
127
+ substType,
128
+ proto->getDeclaredType())) {
129
+ return *result;
169
130
}
170
131
171
132
llvm_unreachable("Invalid conformance substitution");
@@ -892,13 +853,7 @@ void NominalTypeDecl::prepareConformanceTable() const {
892
853
}
893
854
894
855
// Add any synthesized conformances.
895
- if (isa<ClassDecl>(this)) {
896
- // FIXME: This is going away soon.
897
- if (auto anyObject = getASTContext().getProtocol(
898
- KnownProtocolKind::AnyObject)) {
899
- ConformanceTable->addSynthesizedConformance(mutableThis, anyObject);
900
- }
901
- } else if (auto theEnum = dyn_cast<EnumDecl>(mutableThis)) {
856
+ if (auto theEnum = dyn_cast<EnumDecl>(mutableThis)) {
902
857
if (theEnum->hasCases() && theEnum->hasOnlyCasesWithoutAssociatedValues()) {
903
858
// Simple enumerations conform to Equatable.
904
859
if (auto equatable = ctx.getProtocol(KnownProtocolKind::Equatable)) {
0 commit comments