Plain search inside members and extensions

This commit is contained in:
Valentin Kipyatkov
2016-08-25 20:16:42 +03:00
parent 3910f31de9
commit 80520b44c0
7 changed files with 42 additions and 7 deletions
@@ -3,3 +3,13 @@
package pack
data class A(val <caret>n: Int, val s: String, val o: Any)
fun A.ext1() {
val (x, y) = getThis()
}
fun List<A>.ext1() {
val (x, y) = get(0)
}
fun <T> T.getThis(): T = this
@@ -1,3 +1,5 @@
[dataClass.0.kt] Value read 12 val (x, y) = get(0)
[dataClass.0.kt] Value read 8 val (x, y) = getThis()
[dataClass.1.kt] Value read 4 for ((x, y, z) in arrayOf<A>()) {
[dataClass.1.kt] Value read 8 val (x, y) = a
[dataClass.2.kt] Function call 6 a.component1()
@@ -1,7 +1,9 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtFunction
// OPTIONS: usages
class X
open class X
class Y : X()
operator fun X.component1(): Int = 0
operator fun X.<caret>component2(): Int = 1
@@ -12,3 +14,7 @@ fun f() = X()
fun test() {
val (x, y) = f()
}
fun Y.ext() {
val (a, b) = this
}
@@ -1 +1,2 @@
Value read 13 val (x, y) = f()
Value read 15 val (x, y) = f()
Value read 19 val (a, b) = this
@@ -4,10 +4,19 @@
open class X {
operator fun <caret>component1(): Int = 0
operator fun component2(): Int = 1
fun foo() {
val (x, y) = this
}
}
open class Y : X()
open class Z : Y()
open class Z : Y() {
fun bar() {
val (x, y) = this
}
}
fun f() = X()
fun g() = Y()
@@ -1,3 +1,5 @@
Value read 17 val (x, y) = f()
Value read 18 val (x1, y1) = g()
Value read 19 val (x2, y2) = h()
Value read 17 val (x, y) = this
Value read 26 val (x, y) = f()
Value read 27 val (x1, y1) = g()
Value read 28 val (x2, y2) = h()
Value read 9 val (x, y) = this