Correct substitutions for smart completion after "by" and "in"

This commit is contained in:
Valentin Kipyatkov
2016-03-24 22:02:52 +03:00
parent 7d3229538e
commit ba6accd5f9
14 changed files with 187 additions and 54 deletions
@@ -4,7 +4,7 @@ class C {
val v by Delegates.<caret>
}
// EXIST: notNull
// EXIST: observable
// EXIST: vetoable
// EXIST: { itemText: "notNull", typeText: "ReadWriteProperty<Any?, T>" }
// EXIST: { itemText: "observable", typeText: "ReadWriteProperty<Any?, T>" }
// EXIST: { itemText: "vetoable", typeText: "ReadWriteProperty<Any?, T>" }
// NOTHING_ELSE
@@ -0,0 +1,10 @@
import kotlin.properties.Delegates
class C {
val v: String by Delegates.<caret>
}
// EXIST: { itemText: "notNull", typeText: "ReadWriteProperty<Any?, String>" }
// EXIST: { itemText: "observable", typeText: "ReadWriteProperty<Any?, String>" }
// EXIST: { itemText: "vetoable", typeText: "ReadWriteProperty<Any?, String>" }
// NOTHING_ELSE
@@ -0,0 +1,15 @@
import kotlin.reflect.KProperty
class Property<TOwner, TValue>
operator fun <TValue, TOwner> Property<TOwner, TValue>.getValue(thisRef: TOwner, property: KProperty<*>): TValue {
throw Exception()
}
fun<TOwner, TValue> createProperty(): Property<TOwner, TValue> = Property()
class C {
val v by create<caret>
}
// EXIST: { itemText: "createProperty", typeText: "Property<C, TValue>" }
@@ -0,0 +1,15 @@
import kotlin.reflect.KProperty
class Property<TOwner, TValue>
operator fun <TValue, TOwner> Property<TOwner, TValue>.getValue(thisRef: TOwner, property: KProperty<*>): TValue {
throw Exception()
}
fun<TOwner, TValue> createProperty(): Property<TOwner, TValue> = Property()
class C {
val v: Int by create<caret>
}
// EXIST: { itemText: "createProperty", typeText: "Property<C, Int>" }
@@ -0,0 +1,19 @@
import kotlin.reflect.KProperty
class Property<TOwner1, TValue1>
operator fun <TValue2, TOwner2> Property<TOwner2, TValue2>.getValue(thisRef: TOwner2, property: KProperty<*>): TValue2 {
throw Exception()
}
operator fun <TValue3, TOwner3> Property<TOwner3, TValue3>.setValue(thisRef: TOwner3, property: KProperty<*>, value: TValue3) {
throw Exception()
}
fun<TOwner4, TValue4> createProperty(): Property<TOwner4, TValue4> = Property()
class C {
var v by create<caret>
}
// EXIST: { itemText: "createProperty", typeText: "Property<C, TValue4>" }
@@ -0,0 +1,19 @@
import kotlin.reflect.KProperty
class Property<TOwner1, TValue1>
operator fun <TValue2, TOwner2> Property<TOwner2, TValue2>.getValue(thisRef: TOwner2, property: KProperty<*>): TValue2 {
throw Exception()
}
operator fun <TValue3, TOwner3> Property<TOwner3, TValue3>.setValue(thisRef: TOwner3, property: KProperty<*>, value: TValue3) {
throw Exception()
}
fun<TOwner4, TValue4> createProperty(): Property<TOwner4, TValue4> = Property()
class C {
var v: Int by create<caret>
}
// EXIST: { itemText: "createProperty", typeText: "Property<C, Int>" }