Skip to content

[5.1] [code-completion] Add type context for single-expression function bodies #24287

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 3 commits into from
Apr 26, 2019

Conversation

benlangmuir
Copy link
Contributor

@benlangmuir benlangmuir commented Apr 25, 2019

Cherry-pick #23587 to swift-5.1

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
Copy link
Contributor Author

@swift-ci please test

@benlangmuir benlangmuir merged commit 993568a into swiftlang:swift-5.1-branch Apr 26, 2019
@benlangmuir benlangmuir deleted the cc-omit-return-51 branch April 26, 2019 01:31
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.

1 participant