Skip to content

[ConstraintSystem] SE-0326: Temporarily prevent multi-statement closure inference in result builder contexts #40708

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

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Dec 27, 2021

Multi-statement closure inference doesn't play well with result builders
at the moment because it expects all of the information from the parent
statements to be inferred before solver starts working on the body of a
nested closure. Let's prevent inference for nested multi-statement closures
until result builders are ported to use conjunctions and solve the body
incrementally top-down instead of in one shot.

…erence`

Instead of checking the frontend flag directly, let's use dedicated
method on a constraint system to determine whether closure did
participate in inference or not.
…re inference in result builder contexts

Multi-statement closure inference doesn't play well with result builders
at the moment because it expects all of the information from the parent
statements to be inferred before solver starts working on the body of a
nested closure. Let's prevent inference for nested multi-statement closures
until result builders are ported to use conjunctions and solve the body
incrementally top-down instead of in one shot.
These are just invariant checks which will become obsolete as soon
as multi-statement closure inference is enabled by default.
…t closures

This test-case used to crash with multi-statement closure inference
enabled in result builder contexts.
@xedin xedin requested a review from hborla December 27, 2021 18:34
@xedin
Copy link
Contributor Author

xedin commented Dec 27, 2021

@swift-ci please clean test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - fe9224d

@xedin
Copy link
Contributor Author

xedin commented Jan 6, 2022

@swift-ci please test Linux platform

@xedin
Copy link
Contributor Author

xedin commented Jan 6, 2022

@swift-ci please test Windows platform

@xedin xedin merged commit 9f7d3fc into swiftlang:main Jan 6, 2022
xedin added a commit to xedin/swift that referenced this pull request Apr 4, 2022
… builder context

This is a follow-up to swiftlang#40708 which only considers
closures, but it missed the case when builder is applied to function body - in such
cases the declaration context is going to be a function/getter declaration.

Resolves: rdar://91150414
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