-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Improve -debug-constraints
output for key path components
#24084
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
Improve -debug-constraints
output for key path components
#24084
Conversation
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! But I'd prefer we didn't iterate over type variables to find one associated with each component, that could be done separately though.
There are two places where we can dump an expr with types from the constraint solver. There should only be one.
ASTDumper doesn’t have any way to look up key path component types in the constraint solver, so they’re currently shown as null. This change adds a hook to look them up and looks in the key path component’s FunctionResult locator, which is where subscripts already keep their return type.
Previously, nearly all of the type vars for a key path component were dumped under the KeyPathExpr itself, whcih made them difficult to differentiate when debugging. Attach each one to “key path component #N -> function result” instead. # Conflicts: # lib/Sema/CSGen.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
f1c82f1
to
849b12e
Compare
@swift-ci please smoke test and merge |
1 similar comment
@swift-ci please smoke test and merge |
Avoids digging through the long list of type vars to find the ones related to key path components when dumping an expression.
We’ll use this instead of the function result, except for subscript components, which are already structured similarly to subscript expressions.
849b12e
to
760d4be
Compare
Missed a bug, and simplified history while I was at it. |
@swift-ci please smoke test |
@swift-ci please smoke test linux platform |
@swift-ci please smoke test Linux platform |
@swift-ci please test source compatibility |
The test failure didn't include any useful information; I'm hoping a re-run will either fix the issue or give me more leads. @swift-ci please smoke test Linux platform |
@swift-ci please smoke test Linux platform |
During constraint debugging, the AST dumper currently shows all
KeyPathExpr
components with<null>
types because it can't look into the constraint system to find type variables. This PR improves this debugging experience, which should help us fight some of the bugs in key path type-checking.Before
After