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
@@ -11,7 +11,7 @@ fun foo(a: A, cA: Collection<A>, cB: Collection<B>, cC: Collection<C>, cAny: Co
}
// EXIST: cA
// ABSENT: cB
// EXIST: cB
// ABSENT: cC
// EXIST: cAny
// EXIST: lA
@@ -19,6 +19,6 @@ fun foo(a: A, cA: Collection<A>, cB: Collection<B>, cC: Collection<C>, cAny: Co
// ABSENT: lC
// EXIST: lAny
// EXIST: aA
// ABSENT: aB
// EXIST: aB
// ABSENT: aC
// EXIST: aAny
@@ -2,4 +2,4 @@ fun foo(s: String) {
if (s in <caret>)
}
// EXIST: { lookupString:"listOf", itemText: "listOf", tailText: "(vararg elements: T) (kotlin.collections)", typeText:"List<T>" }
// EXIST: { lookupString:"listOf", itemText: "listOf", tailText: "(vararg elements: String) (kotlin.collections)", typeText:"List<String>" }
@@ -10,4 +10,4 @@ interface A {
}
}
// EXIST: { lookupString:"createX", itemText: "createX", tailText: "(t: T)", typeText:"X<T>" }
// EXIST: { lookupString:"createX", itemText: "createX", tailText: "(t: String)", typeText:"X<String>" }
@@ -10,4 +10,4 @@ interface A {
}
}
// EXIST: { lookupString:"createX", itemText: "createX", tailText: "(t: T)", typeText:"X<T>" }
// EXIST: { lookupString:"createX", itemText: "createX", tailText: "(t: String)", typeText:"X<String>" }
@@ -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>" }