Create from Usage: Place extension properties after the usage and generate stub getter
#KT-11795 Fixed
This commit is contained in:
+6
-3
@@ -3,11 +3,14 @@
|
||||
|
||||
import package1.A
|
||||
|
||||
private val package2.A.foo: Any<caret>
|
||||
|
||||
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
+6
-3
@@ -1,8 +1,11 @@
|
||||
// "Create extension property 'A.foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
private val A.foo: String?<caret>
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
Vendored
+6
-3
@@ -1,8 +1,11 @@
|
||||
// "Create extension property 'A.foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
private val A.foo: String?<caret>
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// "Create extension property 'T.bar'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
fun consume(n: Int) {}
|
||||
|
||||
fun <T> foo(t: T) {
|
||||
|
||||
+6
-4
@@ -1,9 +1,11 @@
|
||||
// "Create extension property 'T.bar'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
fun consume(n: Int) {}
|
||||
|
||||
private val <T> T.bar: 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.
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
+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
@@ -2,8 +2,8 @@
|
||||
// ERROR: Property must be initialized
|
||||
class Cyclic<E : Cyclic<E>>
|
||||
|
||||
val foo: Cyclic<*>
|
||||
|
||||
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
+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
|
||||
|
||||
Vendored
+2
-2
@@ -3,8 +3,8 @@
|
||||
|
||||
package foo
|
||||
|
||||
val foo: Int
|
||||
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
|
||||
val foo: Int
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// "Create extension property 'Unit.foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
|
||||
+5
-3
@@ -1,9 +1,11 @@
|
||||
// "Create extension property 'Unit.foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
// WITH_RUNTIME
|
||||
|
||||
private val Unit.foo: Int
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// "Create extension property 'Int.foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
+5
-3
@@ -1,11 +1,13 @@
|
||||
// "Create extension property 'Int.foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
private val Int.foo: A<Int>
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// "Create extension property 'Int.foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
+7
-3
@@ -1,11 +1,15 @@
|
||||
// "Create extension property 'Int.foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
private var Int.foo: A<String>
|
||||
|
||||
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() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user