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] Avoid applying invalid solution with fixes #30592
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci please smoke test |
@swift-ci please smoke test macOS platform |
2 similar comments
@swift-ci please smoke test macOS platform |
@swift-ci please smoke test macOS platform |
hborla
reviewed
Mar 24, 2020
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.
Looks great! I just have one small comment about using SK_Hole
in other places
If solution score indicates that there should be a fix but none where recorded fail solution application and produce a fallback diagnostic to pin-point a problem. Resolves: rdar://problem/60663007
Introduce `SK_Hole` which is used to count a number of "holes" in a given solution. It is used to distinguish solutions with fewer holes. Also it makes it possible to check whether a solution has holes but no fixes, which is an issue and such solution shouldn't be applied to AST.
…neration `_` or discard assignment expression should only be used on the left-hand side of the assignment expression. Incorrect uses are easy to detect during constraint generation which also allows us to avoid complications related to other diagnostics when `_` is used incorrectly.
…xes/holes If score indicates that a solution should have at least one fix but it doesn't let's attempt to produce a fallback diagnostic inline.
Problems related to incorrect use of `_` where previously diagnosed by syntactic diagnostics which meant that it could only happen on type-checked AST. This is no longer a case so we don't have to allow incorrect uses of `_` to form solution without any fixes.
… holes `SK_Fix` was used to indicate that solver has encountered a hole along the current path but since there is `SK_Hole` now, increasing `SK_Fix` no longer makes sense.
xedin
force-pushed
the
fallback-diag-for-holes
branch
from
March 25, 2020 16:35
7c25e63
to
5f328ad
Compare
@swift-ci please smoke test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If solution score indicates that there should be a fix but
none where recorded fail solution application and produce
a fallback diagnostic to pin-point a problem.
Couple of points:
Start tracking number of holes involved in each solution, this allows us to:
a. Score solutions based on number of holes as a fallback for "fix" weight;
b. Identify cases where there are one or more holes but not "fixes".
Detect misuse of
_
(discard assignment expression) while performingconstraint generation which helps to avoid solutions with holes and no fixes
which used to be diagnosed by syntactic diagnostics before (in
MiscDiagnostics
).Resolves: rdar://problem/60663007