Shorten References: Support 'this' simplification

This commit is contained in:
Alexey Sedunov
2015-01-15 16:06:38 +03:00
parent 3a7ae4303a
commit e68481557e
18 changed files with 208 additions and 17 deletions
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun foo(n: Int): Int = <selection>this.n + 1</selection>
}
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun foo(n: Int): Int = this.n + 1
}
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun A.foo(): Int = <selection>this@A.n + n + 1</selection>
}
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun A.foo(): Int = this@A.n + n + 1
}
@@ -0,0 +1,5 @@
class A(val n: Int) {
}
fun A.foo(): Int = <selection>this.n + 1</selection>
@@ -0,0 +1,5 @@
class A(val n: Int) {
}
fun A.foo(): Int = n + 1
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun foo(): Int = <selection>this.n + 1</selection>
}
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun foo(): Int = n + 1
}
@@ -0,0 +1,9 @@
class A {
fun test(b: B) {
<selection>this.b()</selection>
}
}
class B() {
fun A.invoke() {}
}
@@ -0,0 +1,9 @@
class A {
fun test(b: B) {
b()
}
}
class B() {
fun A.invoke() {}
}
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun foo(n: Int): Int = <selection>this@A.n + 1</selection>
}
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun foo(n: Int): Int = this.n + 1
}
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun foo(): Int = <selection>this@A.n + 1</selection>
}
@@ -0,0 +1,3 @@
class A(val n: Int) {
fun foo(): Int = n + 1
}
@@ -0,0 +1,11 @@
package test
fun foo(n: Int) {
}
class A(val n: Int) {
fun test() {
<selection>test.foo(this@A)</selection>
}
}
@@ -0,0 +1,11 @@
package test
fun foo(n: Int) {
}
class A(val n: Int) {
fun test() {
foo(this)
}
}