Skip to content

[5.1-04-24-2019] [code-completion] Add type context for single-expression function bodies #24288

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

benlangmuir
Copy link
Contributor

Cherry-pick #23587 to swift-5.1-branch-04-24-2019

Reviewed by @rintaro


Extend the support for single-expression closures to handle single-expression functions of all kinds. This allows, e.g.

func foo() -> MyEnum { . }
to complete members of MyEnum.

rdar://problem/48938531

Extend the support for single-expression closures to handle
single-expression functions of all kinds. This allows, e.g.

    func foo() -> MyEnum { .<here> }

to complete members of `MyEnum`.
This adds an implicit body so that we can dig out the return type
context the same way as a normal function. For now, we are also treating
the first expression in a multi-statement implicit getter body the same
way; we'll need to refactor how we complete in accessors to
differentiate those cases.
@benlangmuir benlangmuir requested a review from a team as a code owner April 25, 2019 20:57
@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 47c891a

@benlangmuir
Copy link
Contributor Author

@swift-ci please test macOS

@benlangmuir benlangmuir merged commit b8b6e37 into swiftlang:swift-5.1-branch-04-24-2019 Apr 26, 2019
@benlangmuir benlangmuir deleted the cc-omit-return-51-04-24-2019 branch April 26, 2019 15:43
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