Extract Function: Fix replacement of type references and constructor references

This commit is contained in:
Alexey Sedunov
2014-05-26 14:51:45 +04:00
parent 3d6fc6e015
commit 4463c67e28
18 changed files with 217 additions and 23 deletions
@@ -1 +1 @@
class foo.A will no longer be accessible after extraction
Cannot extract method since following types are not denotable in the target scope: foo.A
@@ -1 +1 @@
class foo.A will no longer be accessible after extraction
Cannot extract method since following types are not denotable in the target scope: foo.A
@@ -0,0 +1,8 @@
// SIBLING:
fun foo(a: Int): Int {
object A {
fun bar(): Int = a + 10
}
return <selection>A.bar()</selection>
}
@@ -0,0 +1 @@
Cannot extract method since following types are not denotable in the target scope: foo.A
@@ -0,0 +1,9 @@
// SIBLING:
class MyClass {
fun test() {
<selection>[P] val t: Int = 1
t</selection>
}
public annotation class P
}
@@ -0,0 +1,13 @@
// SIBLING:
class MyClass {
fun test() {
unit()
}
public annotation class P
}
fun unit() {
[MyClass.P] val t: Int = 1
t
}
@@ -0,0 +1,12 @@
// SIBLING:
class MyClass {
fun test() {
<selection>val t: P<P.Q>? = null</selection>
}
public class P<T> {
public class Q {
}
}
}
@@ -0,0 +1,16 @@
// SIBLING:
class MyClass {
fun test() {
unit()
}
public class P<T> {
public class Q {
}
}
}
fun unit() {
val t: MyClass.P<MyClass.P.Q>? = null
}
@@ -0,0 +1,17 @@
// SIBLING:
class MyClass {
fun test() {
<selection>val a: Any = P.Q()
val t = P.R<P.Q>(a as P.Q)</selection>
}
public class P<T> {
public class Q {
}
public class R<T>(val t: T) {
}
}
}
@@ -0,0 +1,21 @@
// SIBLING:
class MyClass {
fun test() {
unit()
}
public class P<T> {
public class Q {
}
public class R<T>(val t: T) {
}
}
}
fun unit() {
val a: Any = MyClass.P.Q()
val t = MyClass.P.R<MyClass.P.Q>(a as MyClass.P.Q)
}
@@ -0,0 +1,13 @@
// SIBLING:
class MyClass {
fun test() {
<selection>val t: P.Q = P.Q()
t</selection>
}
public class P {
public class Q {
}
}
}
@@ -0,0 +1,17 @@
// SIBLING:
class MyClass {
fun test() {
unit()
}
public class P {
public class Q {
}
}
}
fun unit() {
val t: MyClass.P.Q = MyClass.P.Q()
t
}
@@ -0,0 +1,9 @@
// SIBLING:
class MyClass {
fun test() {
<selection>val t: P = P()
t</selection>
}
public class P
}
@@ -0,0 +1,13 @@
// SIBLING:
class MyClass {
fun test() {
unit()
}
public class P
}
fun unit() {
val t: MyClass.P = MyClass.P()
t
}