LookupVisibleDecls: Fix duplicate completion results when inheritance is used with protocol conformance
LookupVisibleDecls: Fix duplicate completion results when inheritance 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>.

shahmishal/swift,nathawes/swift,harlanhaskins/swift,aschwaighofer/swift,sschiau/swift,lorentey/swift,sschiau/swift,practicalswift/swift,gregomni/swift,CodaFi/swift,parkera/swift,shajrawi/swift,devincoughlin/swift,karwa/swift,xwu/swift,airspeedswift/swift,hooman/swift,aschwaighofer/swift,shahmishal/swift,gregomni/swift,ahoppen/swift,apple/swift,roambotics/swift,nathawes/swift,glessard/swift,lorentey/swift,xedin/swift,tkremenek/swift,shahmishal/swift,lorentey/swift,apple/swift,CodaFi/swift,stephentyrone/swift,xwu/swift,CodaFi/swift,karwa/swift,tkremenek/swift,shajrawi/swift,allevato/swift,jmgc/swift,harlanhaskins/swift,ahoppen/swift,xwu/swift,amraboelela/swift,roambotics/swift,CodaFi/swift,jckarter/swift,gribozavr/swift,practicalswift/swift,aschwaighofer/swift,jmgc/swift,jmgc/swift,tkremenek/swift,xedin/swift,allevato/swift,JGiola/swift,glessard/swift,airspeedswift/swift,aschwaighofer/swift,harlanhaskins/swift,JGiola/swift,airspeedswift/swift,nathawes/swift,ahoppen/swift,amraboelela/swift,sschiau/swift,allevato/swift,karwa/swift,harlanhaskins/swift,devincoughlin/swift,jckarter/swift,xedin/swift,amraboelela/swift,xwu/swift,gribozavr/swift,practicalswift/swift,CodaFi/swift,ahoppen/swift,practicalswift/swift,parkera/swift,parkera/swift,karwa/swift,tkremenek/swift,rudkx/swift,atrick/swift,jckarter/swift,CodaFi/swift,karwa/swift,atrick/swift,jckarter/swift,stephentyrone/swift,aschwaighofer/swift,JGiola/swift,parkera/swift,austinzheng/swift,xwu/swift,practicalswift/swift,gregomni/swift,karwa/swift,atrick/swift,airspeedswift/swift,stephentyrone/swift,CodaFi/swift,harlanhaskins/swift,apple/swift,airspeedswift/swift,shajrawi/swift,gregomni/swift,nathawes/swift,sschiau/swift,JGiola/swift,stephentyrone/swift,roambotics/swift,practicalswift/swift,harlanhaskins/swift,karwa/swift,austinzheng/swift,xwu/swift,stephentyrone/swift,lorentey/swift,benlangmuir/swift,shahmishal/swift,benlangmuir/swift,roambotics/swift,tkremenek/swift,gregomni/swift,hooman/swift,shahmishal/swift,gribozavr/swift,hooman/swift,roambotics/swift,hooman/swift,airspeedswift/swift,allevato/swift,amraboelela/swift,austinzheng/swift,xedin/swift,xedin/swift,shajrawi/swift,shahmishal/swift,gribozavr/swift,rudkx/swift,xedin/swift,allevato/swift,amraboelela/swift,gribozavr/swift,benlangmuir/swift,lorentey/swift,allevato/swift,austinzheng/swift,xedin/swift,hooman/swift,ahoppen/swift,harlanhaskins/swift,apple/swift,stephentyrone/swift,practicalswift/swift,gribozavr/swift,nathawes/swift,aschwaighofer/swift,lorentey/swift,devincoughlin/swift,hooman/swift,shajrawi/swift,rudkx/swift,devincoughlin/swift,nathawes/swift,glessard/swift,parkera/swift,jckarter/swift,austinzheng/swift,practicalswift/swift,benlangmuir/swift,benlangmuir/swift,lorentey/swift,lorentey/swift,sschiau/swift,gregomni/swift,gribozavr/swift,apple/swift,shajrawi/swift,JGiola/swift,devincoughlin/swift,glessard/swift,apple/swift,stephentyrone/swift,rudkx/swift,atrick/swift,austinzheng/swift,parkera/swift,atrick/swift,amraboelela/swift,parkera/swift,devincoughlin/swift,austinzheng/swift,ahoppen/swift,glessard/swift,roambotics/swift,jmgc/swift,shajrawi/swift,sschiau/swift,shahmishal/swift,rudkx/swift,sschiau/swift,xedin/swift,gribozavr/swift,parkera/swift,xwu/swift,devincoughlin/swift,shajrawi/swift,amraboelela/swift,atrick/swift,tkremenek/swift,tkremenek/swift,nathawes/swift,sschiau/swift,devincoughlin/swift,jmgc/swift,rudkx/swift,karwa/swift,jmgc/swift,jmgc/swift,benlangmuir/swift,airspeedswift/swift,jckarter/swift,aschwaighofer/swift,allevato/swift,JGiola/swift,shahmishal/swift,hooman/swift,glessard/swift,jckarter/swift