Improve Create property from Usage
Place generated property next to other properties #KT-14886 Fixed
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Create abstract property 'foo'" "true"
|
||||
abstract class A {
|
||||
fun bar(b: Boolean) {}
|
||||
|
||||
abstract val foo: Boolean<caret>
|
||||
|
||||
fun bar(b: Boolean) {}
|
||||
|
||||
fun test() {
|
||||
bar(foo)
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Create abstract property 'A.foo'" "true"
|
||||
abstract class A {
|
||||
fun bar(b: Boolean) {}
|
||||
|
||||
abstract val foo: Boolean<caret>
|
||||
|
||||
fun bar(b: Boolean) {}
|
||||
|
||||
fun test(a: A) {
|
||||
bar(a.foo)
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Create abstract property 'foo'" "true"
|
||||
interface A {
|
||||
fun bar(b: Boolean) {}
|
||||
|
||||
val foo: Boolean<caret>
|
||||
|
||||
fun bar(b: Boolean) {}
|
||||
|
||||
fun test() {
|
||||
bar(foo)
|
||||
}
|
||||
|
||||
+6
-6
@@ -3,14 +3,14 @@
|
||||
|
||||
import package1.A
|
||||
|
||||
private val package2.A.foo: Any
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
class X {
|
||||
init {
|
||||
val y = package2.A()
|
||||
val foo = y.foo
|
||||
}
|
||||
}
|
||||
|
||||
private val package2.A.foo: Any
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
Vendored
+4
-4
@@ -1,11 +1,11 @@
|
||||
// "Create extension property 'A.foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): String? {
|
||||
return A().foo
|
||||
}
|
||||
|
||||
private val A.foo: String?
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
fun test(): String? {
|
||||
return A().foo
|
||||
}
|
||||
Vendored
+4
-4
@@ -1,11 +1,11 @@
|
||||
// "Create extension property 'A.foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): String? {
|
||||
return A().foo
|
||||
}
|
||||
|
||||
private val A.foo: String?
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
fun test(): String? {
|
||||
return A().foo
|
||||
}
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
private val <T> T.bar: Int
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
// "Create extension property 'T.bar'" "true"
|
||||
fun consume(n: Int) {}
|
||||
|
||||
fun <T> foo(t: T) {
|
||||
consume(t.bar)
|
||||
}
|
||||
|
||||
private val <T> T.bar: Int
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
class K {
|
||||
lateinit var foo: String
|
||||
|
||||
lateinit var foo: String
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class K {
|
||||
|
||||
@JvmField
|
||||
var foo: String = TODO("initialize me")
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
@file:JvmName("TestKt")
|
||||
|
||||
fun test() {}
|
||||
|
||||
@JvmField
|
||||
var foo: String = TODO("initialize me")
|
||||
|
||||
fun test() {}
|
||||
Vendored
+2
-2
@@ -3,8 +3,8 @@ import kotlin.properties.ReadOnlyProperty
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
|
||||
val foo: ReadOnlyProperty<Nothing?, Int>
|
||||
|
||||
fun test() {
|
||||
val x: Int by foo
|
||||
}
|
||||
|
||||
val foo: ReadOnlyProperty<Nothing?, Int>
|
||||
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
private val String?.notExistingVal: Int
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
// "Create extension property 'String?.notExistingVal'" "true"
|
||||
fun foo(n: Int) {}
|
||||
|
||||
fun context(p: String?) {
|
||||
foo(p.notExistingVal)
|
||||
}
|
||||
|
||||
private val String?.notExistingVal: Int
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
val `!u00A0`: Int
|
||||
|
||||
// "Create property '!u00A0'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
fun test() {
|
||||
val t: Int = `!u00A0`
|
||||
}
|
||||
|
||||
val `!u00A0`: Int
|
||||
}
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
val foo: Cyclic<*>
|
||||
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
class Cyclic<E : Cyclic<E>>
|
||||
|
||||
fun test() {
|
||||
val c : Cyclic<*> = foo
|
||||
}
|
||||
|
||||
val foo: Cyclic<*>
|
||||
}
|
||||
Vendored
+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
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
|
||||
class Test {
|
||||
fun test(): Int {
|
||||
return <caret>foo
|
||||
}
|
||||
|
||||
val foo1 = 1
|
||||
}
|
||||
|
||||
val bar = 1
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
|
||||
class Test {
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
|
||||
private val foo: Int
|
||||
val foo1 = 1
|
||||
}
|
||||
|
||||
val bar = 1
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
|
||||
class Test {
|
||||
val foo1 = 1
|
||||
|
||||
fun test(): Int {
|
||||
return <caret>foo
|
||||
}
|
||||
|
||||
val foo2 = 42
|
||||
}
|
||||
|
||||
val bar = 1
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
|
||||
class Test {
|
||||
private val foo: Int
|
||||
val foo1 = 1
|
||||
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
|
||||
val foo2 = 42
|
||||
}
|
||||
|
||||
val bar = 1
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
|
||||
class Test {
|
||||
val foo1 = 1
|
||||
|
||||
fun test(): Int {
|
||||
return <caret>foo
|
||||
}
|
||||
}
|
||||
|
||||
val bar = 1
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
|
||||
class Test {
|
||||
private val foo: Int
|
||||
val foo1 = 1
|
||||
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
}
|
||||
|
||||
val bar = 1
|
||||
Vendored
+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
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
|
||||
fun test(): Int {
|
||||
return <caret>foo
|
||||
}
|
||||
|
||||
val bar = 1
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
|
||||
val foo: Int
|
||||
val bar = 1
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
|
||||
val bar = 1
|
||||
|
||||
fun test(): Int {
|
||||
return <caret>foo
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
|
||||
val foo: Int
|
||||
val bar = 1
|
||||
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
Vendored
+2
-2
@@ -3,8 +3,8 @@
|
||||
|
||||
package foo
|
||||
|
||||
val foo: Int
|
||||
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
|
||||
val foo: Int
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@
|
||||
|
||||
class A<T>(val n: T) {
|
||||
companion object {
|
||||
val foo: Int
|
||||
|
||||
val foo: Int
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
// "Create extension property 'Unit.foo'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
val a: Int = Unit.foo
|
||||
}
|
||||
|
||||
private val Unit.foo: Int
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a: Int = Unit.foo
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,13 +1,13 @@
|
||||
// "Create extension property 'Int.foo'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
private val Int.foo: A<Int>
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
fun test() {
|
||||
val a: A<Int> = 2.foo
|
||||
}
|
||||
|
||||
private val Int.foo: A<Int>
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,14 +1,14 @@
|
||||
// "Create extension property 'Int.foo'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
fun test() {
|
||||
2.foo = A("2")
|
||||
}
|
||||
|
||||
private var Int.foo: A<String>
|
||||
get() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
set() {}
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
fun test() {
|
||||
2.foo = A("2")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user