Skip to content

[CodeCompletion] Use TypeContextInfo to get expected return types #33080

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 1 commit into from
Jul 24, 2020

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jul 23, 2020

If the type checked return type from the context has unresolved types, it can't be used for checking convertibility. Fallback to get TypeContextInfo of the closure position.

https://bugs.swift.org/browse/SR-13271 / rdar://problem/66002497

@rintaro
Copy link
Member Author

rintaro commented Jul 23, 2020

@swift-ci Please smoke test

@rintaro rintaro requested a review from benlangmuir July 23, 2020 21:08
// nothing.
if (candidates.empty() && ACE->getType() && !ACE->getType()->hasError()) {
candidates.push_back(ACE->getResultType());
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessasry return. Alternatively, maybe we should early-return everywhere above that adds candidates? It's not obvious that all the above cases are mutually exclusive.

If the type check return type from the context has unresolved types, it
can't be used for checking convertibility. Fallback to get
'TypeContextInfo' of the closure position.

rdar://problem/66002497
@rintaro rintaro force-pushed the ide-completion-rdar66002497 branch from 17e15d9 to dab216d Compare July 23, 2020 21:35
@rintaro
Copy link
Member Author

rintaro commented Jul 23, 2020

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Jul 23, 2020

@swift-ci Please smoke test macOS

@rintaro rintaro merged commit 6fe79fa into swiftlang:master Jul 24, 2020
@rintaro rintaro deleted the ide-completion-rdar66002497 branch July 25, 2020 00:44
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.

2 participants