@@ -8348,8 +8348,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
83488348 }
83498349
83508350 // Check whether this type conforms to the protocol.
8351- auto conformance = DC->getParentModule()->lookupConformance(
8352- type, protocol, /*allowMissing=*/true);
8351+ auto conformance = lookupConformance(type, protocol);
83538352 if (conformance) {
83548353 return recordConformance(conformance);
83558354 }
@@ -8469,8 +8468,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
84698468
84708469 if (auto rawValue = isRawRepresentable(*this, type)) {
84718470 if (!rawValue->isTypeVariableOrMember() &&
8472- TypeChecker::conformsToProtocol(rawValue, protocol,
8473- DC->getParentModule())) {
8471+ lookupConformance(rawValue, protocol)) {
84748472 auto *fix = UseRawValue::create(*this, type, protocolTy, loc);
84758473 // Since this is a conformance requirement failure (where the
84768474 // source is most likely an argument), let's increase its impact
@@ -8629,11 +8627,9 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyTransitivelyConformsTo(
86298627
86308628 auto *protocol = protocolTy->castTo<ProtocolType>()->getDecl();
86318629
8632- auto *M = DC->getParentModule();
8633-
86348630 // First, let's check whether the type itself conforms,
86358631 // if it does - we are done.
8636- if (M-> lookupConformance(resolvedTy, protocol))
8632+ if (lookupConformance(resolvedTy, protocol))
86378633 return SolutionKind::Solved;
86388634
86398635 // If the type doesn't conform, let's check whether
@@ -8705,10 +8701,9 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyTransitivelyConformsTo(
87058701 }
87068702 }
87078703
8708- return llvm::any_of(typesToCheck,
8709- [&](Type type) {
8710- return bool(M->lookupConformance(type, protocol));
8711- })
8704+ return llvm::any_of(
8705+ typesToCheck,
8706+ [&](Type type) { return bool(lookupConformance(type, protocol)); })
87128707 ? SolutionKind::Solved
87138708 : SolutionKind::Error;
87148709}
@@ -9295,7 +9290,7 @@ static bool mayBeForKeyPathSubscriptWithoutLabel(ConstraintSystem &cs,
92959290/// This is useful to figure out whether it makes sense to
92969291/// perform dynamic member lookup or not.
92979292static bool
9298- allFromConditionalConformances(DeclContext *DC , Type baseTy,
9293+ allFromConditionalConformances(ConstraintSystem &cs , Type baseTy,
92999294 ArrayRef<OverloadChoice> candidates) {
93009295 auto *NTD = baseTy->getAnyNominal();
93019296 if (!NTD)
@@ -9314,8 +9309,7 @@ allFromConditionalConformances(DeclContext *DC, Type baseTy,
93149309 }
93159310
93169311 if (auto *protocol = candidateDC->getSelfProtocolDecl()) {
9317- auto conformance = DC->getParentModule()->lookupConformance(
9318- baseTy, protocol);
9312+ auto conformance = cs.lookupConformance(baseTy, protocol);
93199313 if (!conformance.isConcrete())
93209314 return false;
93219315
@@ -10053,7 +10047,7 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
1005310047 const auto &candidates = result.ViableCandidates;
1005410048
1005510049 if ((candidates.empty() ||
10056- allFromConditionalConformances(DC , instanceTy, candidates)) &&
10050+ allFromConditionalConformances(*this , instanceTy, candidates)) &&
1005710051 !isSelfRecursiveKeyPathDynamicMemberLookup(*this, baseTy,
1005810052 memberLocator)) {
1005910053 auto &ctx = getASTContext();
@@ -10636,7 +10630,8 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
1063610630 // called within extensions to that type (usually adding 'clamp').
1063710631 bool treatAsViable =
1063810632 (member.isSimpleName("min") || member.isSimpleName("max")) &&
10639- allFromConditionalConformances(DC, baseTy, result.ViableCandidates);
10633+ allFromConditionalConformances(*this, baseTy,
10634+ result.ViableCandidates);
1064010635
1064110636 generateConstraints(
1064210637 candidates, memberTy, outerAlternatives, useDC, locator, llvm::None,
@@ -11044,8 +11039,7 @@ ConstraintSystem::simplifyValueWitnessConstraint(
1104411039 // conformance already?
1104511040 auto proto = requirement->getDeclContext()->getSelfProtocolDecl();
1104611041 assert(proto && "Value witness constraint for a non-requirement");
11047- auto conformance = useDC->getParentModule()->lookupConformance(
11048- baseObjectType, proto);
11042+ auto conformance = lookupConformance(baseObjectType, proto);
1104911043 if (!conformance)
1105011044 return fail();
1105111045
0 commit comments