@@ -465,20 +465,25 @@ static bool paramIsIUO(const ValueDecl *decl, int paramNum) {
465465static bool isDeclAsSpecializedAs (DeclContext *dc, ValueDecl *decl1,
466466 ValueDecl *decl2,
467467 bool isDynamicOverloadComparison = false ,
468- bool allowMissingConformances = true ) {
468+ bool allowMissingConformances = true ,
469+ bool debugMode = false ) {
469470 return evaluateOrDefault (decl1->getASTContext ().evaluator ,
470471 CompareDeclSpecializationRequest{
471472 dc, decl1, decl2, isDynamicOverloadComparison,
472- allowMissingConformances},
473+ allowMissingConformances, debugMode },
473474 false );
474475}
475476
476477bool CompareDeclSpecializationRequest::evaluate (
477478 Evaluator &eval, DeclContext *dc, ValueDecl *decl1, ValueDecl *decl2,
478- bool isDynamicOverloadComparison, bool allowMissingConformances) const {
479+ bool isDynamicOverloadComparison, bool allowMissingConformances,
480+ bool debugMode) const {
479481 auto &C = decl1->getASTContext ();
482+ ConstraintSystemOptions options;
483+ if (debugMode)
484+ options |= ConstraintSystemFlags::DebugConstraints;
480485 // Construct a constraint system to compare the two declarations.
481- ConstraintSystem cs (dc, ConstraintSystemOptions () );
486+ ConstraintSystem cs (dc, options );
482487 if (cs.isDebugMode ()) {
483488 llvm::errs () << " Comparing declarations\n " ;
484489 decl1->print (llvm::errs ());
@@ -1174,15 +1179,15 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
11741179 // Determine whether one declaration is more specialized than the other.
11751180 bool firstAsSpecializedAs = false ;
11761181 bool secondAsSpecializedAs = false ;
1177- if (isDeclAsSpecializedAs (cs.DC , decl1, decl2,
1178- isDynamicOverloadComparison ,
1179- /* allowMissingConformances= */ false )) {
1182+ if (isDeclAsSpecializedAs (cs.DC , decl1, decl2, isDynamicOverloadComparison,
1183+ /* allowMissingConformances= */ false ,
1184+ cs. isDebugMode () )) {
11801185 score1 += weight;
11811186 firstAsSpecializedAs = true ;
11821187 }
1183- if (isDeclAsSpecializedAs (cs.DC , decl2, decl1,
1184- isDynamicOverloadComparison ,
1185- /* allowMissingConformances= */ false )) {
1188+ if (isDeclAsSpecializedAs (cs.DC , decl2, decl1, isDynamicOverloadComparison,
1189+ /* allowMissingConformances= */ false ,
1190+ cs. isDebugMode () )) {
11861191 score2 += weight;
11871192 secondAsSpecializedAs = true ;
11881193 }
0 commit comments