@@ -465,20 +465,25 @@ static bool paramIsIUO(const ValueDecl *decl, int paramNum) {
465
465
static bool isDeclAsSpecializedAs (DeclContext *dc, ValueDecl *decl1,
466
466
ValueDecl *decl2,
467
467
bool isDynamicOverloadComparison = false ,
468
- bool allowMissingConformances = true ) {
468
+ bool allowMissingConformances = true ,
469
+ bool debugMode = false ) {
469
470
return evaluateOrDefault (decl1->getASTContext ().evaluator ,
470
471
CompareDeclSpecializationRequest{
471
472
dc, decl1, decl2, isDynamicOverloadComparison,
472
- allowMissingConformances},
473
+ allowMissingConformances, debugMode },
473
474
false );
474
475
}
475
476
476
477
bool CompareDeclSpecializationRequest::evaluate (
477
478
Evaluator &eval, DeclContext *dc, ValueDecl *decl1, ValueDecl *decl2,
478
- bool isDynamicOverloadComparison, bool allowMissingConformances) const {
479
+ bool isDynamicOverloadComparison, bool allowMissingConformances,
480
+ bool debugMode) const {
479
481
auto &C = decl1->getASTContext ();
482
+ ConstraintSystemOptions options;
483
+ if (debugMode)
484
+ options |= ConstraintSystemFlags::DebugConstraints;
480
485
// Construct a constraint system to compare the two declarations.
481
- ConstraintSystem cs (dc, ConstraintSystemOptions () );
486
+ ConstraintSystem cs (dc, options );
482
487
if (cs.isDebugMode ()) {
483
488
llvm::errs () << " Comparing declarations\n " ;
484
489
decl1->print (llvm::errs ());
@@ -1174,15 +1179,15 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
1174
1179
// Determine whether one declaration is more specialized than the other.
1175
1180
bool firstAsSpecializedAs = false ;
1176
1181
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 () )) {
1180
1185
score1 += weight;
1181
1186
firstAsSpecializedAs = true ;
1182
1187
}
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 () )) {
1186
1191
score2 += weight;
1187
1192
secondAsSpecializedAs = true ;
1188
1193
}
0 commit comments