Skip to content

More completion fixes #21718

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
Jan 8, 2019
Merged

Conversation

slavapestov
Copy link
Contributor

rdar://problem/20530021, rdar://problem/21161476, https://bugs.swift.org/browse/SR-1181.

… is used with protocol conformance

Consider this setup:

protocol Proto {
  func foo() {}
}

class Base : Proto {
  func foo() {}
}

class Derived : Base {
  ...
}

When completing members of a Derived instance, we find both the protocol's
foo() and the base class's foo(). These have the following types:

- Proto.foo: <Self : Proto> (Self) -> () -> ()
- Base.foo: (Base) -> () -> ()

If we simply substitute the base type (Derived) into the type of the protocol
member, we get (Derived) -> () -> (), which is different than the type of
Base.foo, so we get both declarations in the completion list.

Instead, use the 'Self' type for the specific class of the conformance,
which in this case is 'Base' even if we're looking at members of 'Derived'.

Fixes <rdar://problem/21161476>, <https://bugs.swift.org/browse/SR-1181>.
The logic here had diverged from UnqualifiedLookup. One day we'll merge
the two, for now clean it up a bit to match.

Note that all generic parameters now have 'Reason' reported as 'Local'.
I don't believe this really matters.

Fixes <rdar://problem/20530021>.
@slavapestov slavapestov requested a review from rintaro January 8, 2019 21:55
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit ed3196a into swiftlang:master Jan 8, 2019
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