-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ConstraintSystem] A couple of improvements to multi-statement closure handling #58915
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] A couple of improvements to multi-statement closure handling #58915
Conversation
I failed to reduce a test-case for "Solver left free type variables" which a regular closure but that was triggered by #58879 in one of the result builder bodies, so we kind of have a test-case for that in the suite :) |
@swift-ci please test |
@swift-ci please test source compatibility |
@swift-ci please test source compatibility debug |
@swift-ci please test source compatibility release |
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.
Nice!
…holders during ambiguity Since conjunction is not going to continue current solver path after discovering an ambiguity, let's just mark all of the unbound outer variables as placeholders to produce a complete solution.
If missing member is found in e.g. case statement or a pattern, let's attach diagnostic directly to it.
d68a43c
to
e7ad6e4
Compare
While producing a combined solution, let's reflect the number of fixes and holes discovered in the conjunction, that way it would be possible to filter solutions and keep track of the fact that there were issues in the conjunction.
This was an incorrect locator since constraints do belong to a sequence expression and not to a contextual pattern.
e7ad6e4
to
f210442
Compare
@swift-ci please test |
Conjunction: Transform all unbound outer variables into placeholders during ambiguity
Since there is no solver follow-up after ambiguity has been detected in the body of a closure,
let's just mark all of the unbound type variables as holes while forming a solution, otherwise
CS.finalize()
would crash withSolver left free type variables
.Improve diagnostic precision by attaching missing member diagnostic to an affected pattern/statement.
Conjunction: Propagate fix and hole scores to outer solution
While producing a combined solution, let's reflect the number of
fixes and holes discovered in the conjunction, that way it would
be possible to filter solutions and keep track of the fact that
there were issues in the conjunction.
Resolves: rdar://92854767