this@ClassName supported

This commit is contained in:
Valentin Kipyatkov
2016-08-25 23:17:57 +03:00
parent 7687c1646b
commit ca2cd3d656
3 changed files with 15 additions and 3 deletions

View File

@@ -257,6 +257,12 @@ private class Processor(
return true
}
}
is KtContainerNode -> {
if (parent.node.elementType == KtNodeTypes.LABEL_QUALIFIER) {
return true // this@ClassName - it will be handled anyway because members and extensions are processed with plain search
}
}
}
if (element.getStrictParentOfType<KtImportDirective>() != null) return true // ignore usage in import

View File

@@ -2,7 +2,13 @@
// OPTIONS: usages
package pack
data class A(val <caret>n: Int, val s: String, val o: Any)
data class A(val <caret>n: Int, val s: String, val o: Any) {
fun f() {
"a".apply {
this@A.toString()
}
}
}
fun A.ext1() {
val (x, y) = getThis()

View File

@@ -1,5 +1,5 @@
[dataClass.0.kt] Value read 16 val (x, y) = get(0)
[dataClass.0.kt] Value read 8 val (x, y) = getThis()
[dataClass.0.kt] Value read 14 val (x, y) = getThis()
[dataClass.0.kt] Value read 22 val (x, y) = get(0)
[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()