@@ -155,57 +155,6 @@ static bool sameOverloadChoice(const OverloadChoice &x,
155
155
llvm_unreachable (" Unhandled OverloadChoiceKind in switch." );
156
156
}
157
157
158
- // / Compare two declarations to determine whether one is a witness of the other.
159
- static Comparison compareWitnessAndRequirement (TypeChecker &tc, DeclContext *dc,
160
- ValueDecl *decl1,
161
- ValueDecl *decl2) {
162
- // We only have a witness/requirement pair if exactly one of the declarations
163
- // comes from a protocol.
164
- auto proto1 = dyn_cast<ProtocolDecl>(decl1->getDeclContext ());
165
- auto proto2 = dyn_cast<ProtocolDecl>(decl2->getDeclContext ());
166
- if ((bool )proto1 == (bool )proto2)
167
- return Comparison::Unordered;
168
-
169
- // Figure out the protocol, requirement, and potential witness.
170
- ProtocolDecl *proto;
171
- ValueDecl *req;
172
- ValueDecl *potentialWitness;
173
- if (proto1) {
174
- proto = proto1;
175
- req = decl1;
176
- potentialWitness = decl2;
177
- } else {
178
- proto = proto2;
179
- req = decl2;
180
- potentialWitness = decl1;
181
- }
182
-
183
- // Cannot compare type declarations this way.
184
- // FIXME: Use the same type-substitution approach as lookupMemberType.
185
- if (isa<TypeDecl>(req))
186
- return Comparison::Unordered;
187
-
188
- if (!potentialWitness->getDeclContext ()->isTypeContext ())
189
- return Comparison::Unordered;
190
-
191
- // Determine whether the type of the witness's context conforms to the
192
- // protocol.
193
- auto owningType
194
- = potentialWitness->getDeclContext ()->getDeclaredInterfaceType ();
195
- auto conformance = tc.conformsToProtocol (owningType, proto, dc,
196
- ConformanceCheckFlags::InExpression);
197
- if (!conformance || conformance->isAbstract ())
198
- return Comparison::Unordered;
199
-
200
- // If the witness and the potential witness are not the same, there's no
201
- // ordering here.
202
- if (conformance->getConcrete ()->getWitnessDecl (req, &tc) != potentialWitness)
203
- return Comparison::Unordered;
204
-
205
- // We have a requirement/witness match.
206
- return proto1? Comparison::Worse : Comparison::Better;
207
- }
208
-
209
158
namespace {
210
159
// / Describes the relationship between the context types for two declarations.
211
160
enum class SelfTypeRelationship {
@@ -504,18 +453,6 @@ static bool isDeclAsSpecializedAs(TypeChecker &tc, DeclContext *dc,
504
453
return subscript2->isGeneric ();
505
454
}
506
455
507
- // A witness is always more specialized than the requirement it satisfies.
508
- switch (compareWitnessAndRequirement (tc, dc, decl1, decl2)) {
509
- case Comparison::Unordered:
510
- break ;
511
-
512
- case Comparison::Better:
513
- return true ;
514
-
515
- case Comparison::Worse:
516
- return false ;
517
- }
518
-
519
456
// Members of protocol extensions have special overloading rules.
520
457
ProtocolDecl *inProtocolExtension1 = outerDC1
521
458
->getAsProtocolExtensionContext ();
0 commit comments