Create From Usage: Place generated declarations next to original element container if they have common parent
#KT-6687 Fixed
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun test() = this.Foo(2, "2")
|
||||
|
||||
inner class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
|
||||
fun test() = this.Foo(2, "2")
|
||||
}
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class B<U>(val m: U) {
|
||||
fun test() = this.Foo(2, "2")
|
||||
|
||||
inner class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
|
||||
fun test() = this.Foo(2, "2")
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
|
||||
inner class B<U>(val m: U) {
|
||||
fun test() = this@A.Foo(2, "2")
|
||||
}
|
||||
|
||||
inner class Foo(i: Int, s: String) {
|
||||
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -3,10 +3,10 @@ package p
|
||||
|
||||
fun foo(): X = A
|
||||
|
||||
open class X {
|
||||
|
||||
}
|
||||
|
||||
object A : X() {
|
||||
|
||||
}
|
||||
|
||||
open class X {
|
||||
|
||||
}
|
||||
+4
-4
@@ -3,10 +3,10 @@ package p
|
||||
|
||||
fun foo(): X = A
|
||||
|
||||
trait X {
|
||||
|
||||
}
|
||||
|
||||
object A : X {
|
||||
|
||||
}
|
||||
|
||||
trait X {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// "Create function 'foo'" "true"
|
||||
|
||||
class A {
|
||||
val baz = 1
|
||||
|
||||
fun test() {
|
||||
val a: A = foo()
|
||||
}
|
||||
|
||||
private fun foo(): A {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Create function 'foo'" "true"
|
||||
|
||||
val baz = 1
|
||||
|
||||
fun test() {
|
||||
val a: Int = foo()
|
||||
}
|
||||
|
||||
fun foo(): Int {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Create function 'foo'" "true"
|
||||
|
||||
class A {
|
||||
val baz = 1
|
||||
|
||||
fun test() {
|
||||
val a: A = <caret>foo()
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Create function 'foo'" "true"
|
||||
|
||||
val baz = 1
|
||||
|
||||
fun test() {
|
||||
val a: Int = <caret>foo()
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
|
||||
val foo: String
|
||||
|
||||
fun test() {
|
||||
println("a = $foo")
|
||||
}
|
||||
|
||||
val foo: String
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
|
||||
val foo: Int
|
||||
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
|
||||
val foo: Int
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
|
||||
package foo
|
||||
|
||||
val foo: Int
|
||||
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
|
||||
val foo: Int
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// "Create extension property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
|
||||
val Unit.foo: Int
|
||||
|
||||
fun test() {
|
||||
val a: Int = Unit.foo
|
||||
}
|
||||
|
||||
val Unit.foo: Int
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
val Int.foo: A<Int>
|
||||
|
||||
fun test() {
|
||||
val a: A<Int> = 2.foo
|
||||
}
|
||||
|
||||
val Int.foo: A<Int>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
var Int.foo: A<String>
|
||||
|
||||
fun test() {
|
||||
2.foo = A("2")
|
||||
}
|
||||
|
||||
var Int.foo: A<String>
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
// "Create extension property 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
val A.foo: String?
|
||||
|
||||
fun test(): String? {
|
||||
return A().foo
|
||||
}
|
||||
|
||||
val A.foo: String?
|
||||
}
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
// "Create extension property 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
val A.foo: String?
|
||||
|
||||
fun test(): String? {
|
||||
return A().foo
|
||||
}
|
||||
|
||||
val A.foo: String?
|
||||
}
|
||||
Reference in New Issue
Block a user