Fixed completion for extension function after removing members for implicit receiver from scope.

This commit is contained in:
Stanislav Erokhin
2015-08-18 15:52:08 +03:00
parent a1274f91ba
commit ec43f49ab4
9 changed files with 209 additions and 77 deletions
@@ -12,4 +12,6 @@ fun f(pair: Pair<out Any, out Any>) {
// EXIST: { lookupString: "hashCode", attributes: "bold" }
// EXIST: { lookupString: "forString", attributes: "grayed" }
// EXIST: { lookupString: "forAny", attributes: "bold" }
// EXIST: { lookupString: "forT", attributes: "" }
/*TODO: { lookupString: "forT", attributes: "" }*/
// EXIST: { lookupString: "forT", attributes: "grayed" }
@@ -0,0 +1,15 @@
interface A {
fun foo(): Any
fun bar()
}
interface B: A {
override fun foo(): String
}
fun f(pair: Pair<out A, out Any>) {
if (pair.first !is B) return
pair.first.<caret>
}
/*TODO: { lookupString: "foo", "typeText":"Any", attributes: "bold" } */
// EXIST: { lookupString: "foo", "typeText":"String", attributes: "bold" }
// EXIST: { lookupString: "bar", attributes: "bold" }
@@ -0,0 +1,20 @@
class B {
fun A.extFunInBForA() {}
fun B.extFunInBForB() {}
}
class A {
fun B.extFunInAForB() {}
fun A.extFunInAForA() {}
}
fun A.test() {
with(B()) {
<caret>
}
}
// EXIST: extFunInAForA
// EXIST: extFunInBForA
// EXIST: extFunInAForB
// EXIST: extFunInBForB
@@ -0,0 +1,12 @@
class A {
fun String.foo() {}
}
fun Any.test() { // see KT-8865 Member extension after this smart cast not working
if (this is A) {
"".<caret>
}
}
// EXIST: foo
@@ -0,0 +1,21 @@
interface A {
fun memberA()
}
interface B {
fun memberB()
}
interface C {
fun memberC()
}
fun C.test(a: Any) {
if (a is A && a is B) {
a.<caret>
}
}
// EXIST: memberA
// EXIST: memberB
// ABSENT: memberC