Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ConstraintSystem] Add index value (as an impact of the score kind) to output of debug constraints. #78740

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion include/swift/Sema/ConstraintSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -1197,8 +1197,11 @@ struct Score {
for (unsigned int i = 0; i < NumScoreKinds; ++i) {
if (Data[i] != 0) {
out << " [component: ";
out << "#";
out << std::to_string(NumScoreKinds - i);
out << " ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think to clarify this even further we should use weight instead of index (which is opposite) and instead of value: -> impact:. This would better reflect the meaning of these values.

Copy link
Author

@kntkymt kntkymt Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for suggestion! I addressed at 88fba29

before this PR

Fixed score: [component: collection upcast conversion(s), value: 1] [component: empty-existential conversion(s), value: 1]

now

Fixed score: [component: #8 collection upcast conversion(s), impact: 1] [component: #6 empty-existential conversion(s), impact: 1]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in my previous comment, I think we need to change component: that you added into something which has clearer meaning i.e. weight and print it the inverse of it to indicate the scores placed at a higher index have a higher weight.

out << getNameFor(ScoreKind(i));
out << "(s), value: ";
out << "(s), impact: ";
out << std::to_string(Data[i]);
out << "]";
hasNonDefault = true;
Expand Down