Introduce Variable: Forbid inside of type references and 'super' references

#KT-8324 Fixed
This commit is contained in:
Alexey Sedunov
2015-09-02 17:59:40 +03:00
parent fa8fcb53c5
commit d7e79e7f28
18 changed files with 136 additions and 0 deletions
@@ -0,0 +1,5 @@
open class A(n: Int)
class B {
constructor(x: Int) : <selection>A</selection>(x + 1)
}
@@ -0,0 +1 @@
Cannot refactor in this place
@@ -0,0 +1,7 @@
interface T
object O : T
fun foo() {
val x = object : T by <selection>O</selection> {}
}
@@ -0,0 +1,8 @@
interface T
object O : T
fun foo() {
val o = O
val x = object : T by o {}
}
@@ -0,0 +1,7 @@
interface T
object O : T
fun foo() {
val x = object : <selection>T</selection> by O {}
}
@@ -0,0 +1 @@
Cannot refactor in this place
@@ -0,0 +1,5 @@
open class A(n: Int)
fun foo() {
val x = object : A(<selection>1</selection>) {}
}
@@ -0,0 +1,6 @@
open class A(n: Int)
fun foo() {
val i = 1
val x = object : A(i) {}
}
@@ -0,0 +1,3 @@
fun foo() {
val x = object : <selection>Any</selection>() {}
}
@@ -0,0 +1 @@
Cannot refactor in this place
@@ -0,0 +1,5 @@
interface T
fun foo() {
val x = object : <selection>T</selection> {}
}
@@ -0,0 +1 @@
Cannot refactor in this place
@@ -0,0 +1,11 @@
open class A {
open fun foo() {
}
}
class B : A() {
override fun foo() {
<selection>super</selection>.foo()
}
}
@@ -0,0 +1 @@
Cannot refactor in this place
@@ -0,0 +1,9 @@
class A {
fun bar() {
}
fun foo() {
<selection>this</selection>.foo()
}
}
@@ -0,0 +1,10 @@
class A {
fun bar() {
}
fun foo() {
val a = this
a.foo()
}
}