From 408bf4ad4394e777cd51669d125dcd5f582e71a9 Mon Sep 17 00:00:00 2001 From: kntkymt Date: Sun, 19 Jan 2025 17:23:36 +0900 Subject: [PATCH 1/2] [ConstraintSystem] Add index value (as an impact of the score kind) to debug constraints. --- include/swift/Sema/ConstraintSystem.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/swift/Sema/ConstraintSystem.h b/include/swift/Sema/ConstraintSystem.h index 2fa61caf9b2dc..cbd95a77f7c42 100644 --- a/include/swift/Sema/ConstraintSystem.h +++ b/include/swift/Sema/ConstraintSystem.h @@ -1197,6 +1197,9 @@ struct Score { for (unsigned int i = 0; i < NumScoreKinds; ++i) { if (Data[i] != 0) { out << " [component: "; + out << "#"; + out << std::to_string(i); + out << " "; out << getNameFor(ScoreKind(i)); out << "(s), value: "; out << std::to_string(Data[i]); From 88fba2921584c501b6ab8e9d005d5f18321cc0c7 Mon Sep 17 00:00:00 2001 From: kntkymt Date: Tue, 21 Jan 2025 23:28:40 +0900 Subject: [PATCH 2/2] Use weight instead of index, change label 'value' -> 'impact' --- include/swift/Sema/ConstraintSystem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/swift/Sema/ConstraintSystem.h b/include/swift/Sema/ConstraintSystem.h index cbd95a77f7c42..a05d6b89186ad 100644 --- a/include/swift/Sema/ConstraintSystem.h +++ b/include/swift/Sema/ConstraintSystem.h @@ -1198,10 +1198,10 @@ struct Score { if (Data[i] != 0) { out << " [component: "; out << "#"; - out << std::to_string(i); + out << std::to_string(NumScoreKinds - i); out << " "; out << getNameFor(ScoreKind(i)); - out << "(s), value: "; + out << "(s), impact: "; out << std::to_string(Data[i]); out << "]"; hasNonDefault = true;