@@ -8425,8 +8425,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
84258425 }
84268426
84278427 // Check whether this type conforms to the protocol.
8428- auto conformance = DC->getParentModule()->lookupConformance(
8429- type, protocol, /*allowMissing=*/true);
8428+ auto conformance = lookupConformance(type, protocol);
84308429 if (conformance) {
84318430 return recordConformance(conformance);
84328431 }
@@ -8546,8 +8545,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
85468545
85478546 if (auto rawValue = isRawRepresentable(*this, type)) {
85488547 if (!rawValue->isTypeVariableOrMember() &&
8549- TypeChecker::conformsToProtocol(rawValue, protocol,
8550- DC->getParentModule())) {
8548+ lookupConformance(rawValue, protocol)) {
85518549 auto *fix = UseRawValue::create(*this, type, protocolTy, loc);
85528550 // Since this is a conformance requirement failure (where the
85538551 // source is most likely an argument), let's increase its impact
@@ -8706,11 +8704,9 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyTransitivelyConformsTo(
87068704
87078705 auto *protocol = protocolTy->castTo<ProtocolType>()->getDecl();
87088706
8709- auto *M = DC->getParentModule();
8710-
87118707 // First, let's check whether the type itself conforms,
87128708 // if it does - we are done.
8713- if (M-> lookupConformance(resolvedTy, protocol))
8709+ if (lookupConformance(resolvedTy, protocol))
87148710 return SolutionKind::Solved;
87158711
87168712 // If the type doesn't conform, let's check whether
@@ -8782,10 +8778,9 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyTransitivelyConformsTo(
87828778 }
87838779 }
87848780
8785- return llvm::any_of(typesToCheck,
8786- [&](Type type) {
8787- return bool(M->lookupConformance(type, protocol));
8788- })
8781+ return llvm::any_of(
8782+ typesToCheck,
8783+ [&](Type type) { return bool(lookupConformance(type, protocol)); })
87898784 ? SolutionKind::Solved
87908785 : SolutionKind::Error;
87918786}
@@ -9372,7 +9367,7 @@ static bool mayBeForKeyPathSubscriptWithoutLabel(ConstraintSystem &cs,
93729367/// This is useful to figure out whether it makes sense to
93739368/// perform dynamic member lookup or not.
93749369static bool
9375- allFromConditionalConformances(DeclContext *DC , Type baseTy,
9370+ allFromConditionalConformances(ConstraintSystem &cs , Type baseTy,
93769371 ArrayRef<OverloadChoice> candidates) {
93779372 auto *NTD = baseTy->getAnyNominal();
93789373 if (!NTD)
@@ -9391,8 +9386,7 @@ allFromConditionalConformances(DeclContext *DC, Type baseTy,
93919386 }
93929387
93939388 if (auto *protocol = candidateDC->getSelfProtocolDecl()) {
9394- auto conformance = DC->getParentModule()->lookupConformance(
9395- baseTy, protocol);
9389+ auto conformance = cs.lookupConformance(baseTy, protocol);
93969390 if (!conformance.isConcrete())
93979391 return false;
93989392
@@ -10130,7 +10124,7 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
1013010124 const auto &candidates = result.ViableCandidates;
1013110125
1013210126 if ((candidates.empty() ||
10133- allFromConditionalConformances(DC , instanceTy, candidates)) &&
10127+ allFromConditionalConformances(*this , instanceTy, candidates)) &&
1013410128 !isSelfRecursiveKeyPathDynamicMemberLookup(*this, baseTy,
1013510129 memberLocator)) {
1013610130 auto &ctx = getASTContext();
@@ -10713,7 +10707,8 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
1071310707 // called within extensions to that type (usually adding 'clamp').
1071410708 bool treatAsViable =
1071510709 (member.isSimpleName("min") || member.isSimpleName("max")) &&
10716- allFromConditionalConformances(DC, baseTy, result.ViableCandidates);
10710+ allFromConditionalConformances(*this, baseTy,
10711+ result.ViableCandidates);
1071710712
1071810713 generateConstraints(
1071910714 candidates, memberTy, outerAlternatives, useDC, locator, llvm::None,
@@ -11121,8 +11116,7 @@ ConstraintSystem::simplifyValueWitnessConstraint(
1112111116 // conformance already?
1112211117 auto proto = requirement->getDeclContext()->getSelfProtocolDecl();
1112311118 assert(proto && "Value witness constraint for a non-requirement");
11124- auto conformance = useDC->getParentModule()->lookupConformance(
11125- baseObjectType, proto);
11119+ auto conformance = lookupConformance(baseObjectType, proto);
1112611120 if (!conformance)
1112711121 return fail();
1112811122
0 commit comments