Navigate to receiver from this in extension function (KT-16991)

#KT-16991 Fixed
 #KT-13013 In Progress
This commit is contained in:
Nikolay Krasko
2017-03-22 01:42:35 +03:00
parent 9dfc92c55e
commit daaa59a1ad
7 changed files with 120 additions and 1 deletions
@@ -0,0 +1,13 @@
// FILE: before.kt
class A {
fun String.foo() {
this<caret>@A
}
}
// FILE: after.kt
class <caret>A {
fun String.foo() {
this@A
}
}
@@ -0,0 +1,13 @@
// FILE: before.kt
class A {
fun String.foo() {
this<caret>@foo
}
}
// FILE: after.kt
class A {
fun <caret>String.foo() {
this@foo
}
}
@@ -0,0 +1,18 @@
// FILE: before.kt
interface Foo
fun foo(a: Any) {}
fun Foo.bar() {
foo(this<caret>)
}
// FILE: after.kt
interface Foo
fun foo(a: Any) {}
fun <caret>Foo.bar() {
foo(this)
}
@@ -0,0 +1,21 @@
// FILE: before.kt
interface Foo
fun foo(a: Foo.() -> Unit) {}
fun bar() {
foo {
<caret>this
}
}
// FILE: after.kt
interface Foo
fun foo(a: Foo.() -> Unit) {}
fun bar() {
foo <caret>{
this
}
}
@@ -0,0 +1,7 @@
// FILE: before.kt
val String.test: String
get() { return <caret>this }
// FILE: after.kt
val <caret>String.test: String
get() { return this }