Skip to content
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

[AST] Clean up handling of single-expression closures #32178

Merged

Conversation

DougGregor
Copy link
Member

The notion of a closure with a single-expression body is used to mean a
number of things in the type checker and AST. Start teasing those things
apart, so we separate notions of "was a closure type-checked as part
of it's enclosing expression" and "should it be type-checked as part of
it's enclosing expression", i.e., result from policy.

…ession

Rather than using various "applied function builder" and "is single
expression body" checks to determine whether a closure was
type-checked in its enclosing expression, record in the closure
expression whether it actually *was* type-checked as part of its
enclosing expression.
…osing expr

Introduce a new predicate, shouldTypeCheckInEnclosingExpression(), to
determine when the body of a closure should be checked as part of the
enclosing expression rather than separately, and use it in the various
places where "hasSingleExpressionBody()" was used for that purpose.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit 8e6840d into swiftlang:master Jun 4, 2020
@DougGregor DougGregor deleted the single-expression-closure-cleanup branch June 4, 2020 17:21
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.

None yet

2 participants