Complete type instantiation items after "by"

This commit is contained in:
Valentin Kipyatkov
2016-03-25 12:57:42 +03:00
parent ba6accd5f9
commit 0edc5c15e2
18 changed files with 153 additions and 50 deletions
@@ -1,15 +1,16 @@
import kotlin.reflect.KProperty
class Property<TOwner, TValue>
class Property<TOwner, TValue>(owner: TOwner, value: TValue)
operator fun <TValue, TOwner> Property<TOwner, TValue>.getValue(thisRef: TOwner, property: KProperty<*>): TValue {
throw Exception()
}
fun<TOwner, TValue> createProperty(): Property<TOwner, TValue> = Property()
fun<TOwner, TValue> createProperty(owner: TOwner, value: TValue): Property<TOwner, TValue> = Property(owner, value)
class C {
val v by create<caret>
val v by <caret>
}
// EXIST: { itemText: "createProperty", typeText: "Property<C, TValue>" }
// EXIST: Property
@@ -9,7 +9,8 @@ operator fun <TValue, TOwner> Property<TOwner, TValue>.getValue(thisRef: TOwner,
fun<TOwner, TValue> createProperty(): Property<TOwner, TValue> = Property()
class C {
val v: Int by create<caret>
val v: Int by <caret>
}
// EXIST: { itemText: "createProperty", typeText: "Property<C, Int>" }
// EXIST: Property
@@ -13,7 +13,8 @@ operator fun <TValue3, TOwner3> Property<TOwner3, TValue3>.setValue(thisRef: TOw
fun<TOwner4, TValue4> createProperty(): Property<TOwner4, TValue4> = Property()
class C {
var v by create<caret>
var v by <caret>
}
// EXIST: { itemText: "createProperty", typeText: "Property<C, TValue4>" }
// EXIST: Property
@@ -13,7 +13,8 @@ operator fun <TValue3, TOwner3> Property<TOwner3, TValue3>.setValue(thisRef: TOw
fun<TOwner4, TValue4> createProperty(): Property<TOwner4, TValue4> = Property()
class C {
var v: Int by create<caret>
var v: Int by <caret>
}
// EXIST: { itemText: "createProperty", typeText: "Property<C, Int>" }
// EXIST: Property
@@ -30,10 +30,17 @@ class C
val C.property by <caret>
// EXIST: lazy
// EXIST: createX1
// ABSENT: createX2
// EXIST: createX3
// EXIST: createY1
// ABSENT: createY2
// EXIST: createY3
/*TODO: add constructors*/
// EXIST: X1
// ABSENT: X2
// EXIST: X3
// EXIST: Y1
// ABSENT: Y2
// EXIST: Y3
@@ -35,8 +35,15 @@ class C
var C.property by <caret>
// ABSENT: lazy
// EXIST: createX1
// ABSENT: createX2
// ABSENT: createX3
// EXIST: createX4
// ABSENT: createX5
// EXIST: X1
// ABSENT: X2
// ABSENT: X3
// EXIST: X4
// ABSENT: X5
@@ -12,7 +12,7 @@ class X3 {
class Y1
class Y2
class Y3
abstract class Y3
operator fun Y1.getValue(thisRef: C, property: KProperty<*>): String = ""
operator fun Y2.getValue(thisRef: String, property: KProperty<*>): String = ""
@@ -36,4 +36,9 @@ class C {
// EXIST: createY1
// ABSENT: createY2
// EXIST: createY3
/*TODO: add constructors*/
// EXIST: X1
// ABSENT: X2
// EXIST: X3
// EXIST: Y1
// ABSENT: Y2
// ABSENT: Y3
@@ -24,6 +24,13 @@ class X5 {
operator fun setValue(thisRef: C, property: KProperty<*>, value: String) {}
}
class Y1
class Y2
operator fun Y1.getValue(thisRef: C, property: KProperty<*>): String = ""
operator fun Y1.setValue(thisRef: C, property: KProperty<*>, value: String) {}
operator fun Y2.getValue(thisRef: C, property: KProperty<*>): String = ""
fun createX1() = X1()
fun createX2() = X2()
fun createX3() = X3()
@@ -40,3 +47,10 @@ class C {
// ABSENT: createX3
// EXIST: createX4
// ABSENT: createX5
// EXIST: X1
// ABSENT: X2
// ABSENT: X3
// EXIST: X4
// ABSENT: X5
// EXIST: Y1
// ABSENT: Y2