Skip to content

[5.9][CodeCompletion] Don't take opaque types subst map into account #65176

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

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Apr 14, 2023

Cherry-pick #65170 into release/5.9

Explanation: When a completion base type has multiple possible solutions, member lookup for code completion is performed on both types, then duplicated (decl and the type are the same) results are omitted. However, for opaque types, it used to fail to deduplicate them because they have different substitution map, although both have the same spelling. In this change, replace the opaque types substitution map with an empty one, so that it ignore the map when comparing.
Scope: Code completion related to opaque result type.
Risk: Low, the change only affects de-duplication
Testing: Added a regression test case
Issue: rdar://107669173
Reviewer: Ben Barham (@bnbarham), Alex Hoppen (@ahoppen)

for checking duplicated results from multiple type checker solutions.
e.g.

  protocol Proto {}
  struct Generic<T> {
    func retProto() -> some Proto
  }
  func foo() -> Generic<T1>
  func foo() -> Generic<T2>

  foo().<COMPLETION>

The return type of `Geric<T1>.retProto()` and `Geric<T2>.retProto()` is
different, but they both spelled 'some Proto'. So IDE consumers don't
care the difference.

rdar://107669173
(cherry picked from commit 20a8441)
@rintaro rintaro requested a review from a team as a code owner April 14, 2023 03:04
@rintaro
Copy link
Member Author

rintaro commented Apr 14, 2023

@swift-ci Please test

@rintaro rintaro merged commit 6aa0d5b into swiftlang:release/5.9 Apr 20, 2023
@AnthonyLatsis AnthonyLatsis added the 🍒 release cherry pick Flag: Release branch cherry picks label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants