Skip to content

[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

Merged
merged 4 commits into from
May 18, 2022

Conversation

xedin
Copy link
Contributor

@xedin xedin commented May 13, 2022

  • 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 with Solver 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

@xedin xedin requested a review from hborla May 13, 2022 23:25
@xedin
Copy link
Contributor Author

xedin commented May 13, 2022

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 :)

@xedin
Copy link
Contributor Author

xedin commented May 17, 2022

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented May 17, 2022

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented May 17, 2022

@swift-ci please test source compatibility debug

@xedin
Copy link
Contributor Author

xedin commented May 17, 2022

@swift-ci please test source compatibility release

Copy link
Member

@hborla hborla left a comment

Choose a reason for hiding this comment

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

Nice!

xedin added 2 commits May 18, 2022 00:28
…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.
@xedin xedin force-pushed the multi-statement-closure-improvements branch from d68a43c to e7ad6e4 Compare May 18, 2022 07:28
xedin added 2 commits May 18, 2022 00:32
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.
@xedin xedin force-pushed the multi-statement-closure-improvements branch from e7ad6e4 to f210442 Compare May 18, 2022 07:32
@xedin
Copy link
Contributor Author

xedin commented May 18, 2022

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants