Skip to content

[CodeCompletion] Be lenient in callee analysis #20964

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
Dec 4, 2018

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Dec 3, 2018

Accept getInterfaceType()->hasError() declarations. Even if the part of the declaration has error, we still have chance to get context info from the other part of it. For instance:

  func foo(x: Int, y: INt) { }
  foo(x: #^COMPLETE^#

We should resolve Int as the context type regardless of whether parameter y is an error type or not.

Accept `getInterfaceType->hasError()` declarations. Even if the part of
the declaration has error, we still have chance to get context info from
the other part of it. For instance:

  func foo(x: Int, y: INt) { }
  foo(x: #^COMPLETE^#

We should resolve 'Int' as the context type even if parameter `y` is an
error type.
@rintaro
Copy link
Member Author

rintaro commented Dec 3, 2018

@swift-ci Please smoke test

@rintaro rintaro requested a review from benlangmuir December 3, 2018 08:27
@benlangmuir
Copy link
Contributor

benlangmuir commented Dec 3, 2018

I'm okay with this, but it would be nice to not show <<error type>> anywhere (this is already an issue elsewhere in code-completion). How hard would it be to recover the original spelling and use that instead?

@rintaro
Copy link
Member Author

rintaro commented Dec 4, 2018

I guess it's possible if we use TypeLoc::getTypeRepr() for error types. But that will not be a trivial change. Let me do that in another PR.

@benlangmuir
Copy link
Contributor

SGTM

@rintaro rintaro merged commit c598733 into swiftlang:master Dec 4, 2018
@rintaro rintaro deleted the ide-completion-lenientcallee branch December 4, 2018 04:03
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