Initial implementation of smart completion after "by"
#KT-11787 Fixed
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class X1 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): CharSequence = ""
|
||||
}
|
||||
class X2 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
}
|
||||
class X3 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): Any = ""
|
||||
}
|
||||
|
||||
class Y1
|
||||
class Y2
|
||||
|
||||
operator fun Y1.getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun Y2.getValue(thisRef: C, property: KProperty<*>): Int = 1
|
||||
|
||||
fun createX1() = X1()
|
||||
fun createX2() = X2()
|
||||
fun createX3() = X3()
|
||||
fun createY1() = Y1()
|
||||
fun createY2() = Y2()
|
||||
|
||||
class C {
|
||||
val property: CharSequence by <caret>
|
||||
}
|
||||
|
||||
// EXIST: lazy
|
||||
// EXIST: createX1
|
||||
// EXIST: createX2
|
||||
// ABSENT: createX3
|
||||
// EXIST: createY1
|
||||
// ABSENT: createY2
|
||||
/*TODO: add constructors*/
|
||||
@@ -0,0 +1,29 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class X1 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun setValue(thisRef: C, property: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
class X2 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun setValue(thisRef: C, property: KProperty<*>, value: CharSequence) {}
|
||||
}
|
||||
|
||||
class X3 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): CharSequence = ""
|
||||
operator fun setValue(thisRef: C, property: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
fun createX1() = X1()
|
||||
fun createX2() = X2()
|
||||
fun createX3() = X3()
|
||||
|
||||
class C {
|
||||
var property: CharSequence by <caret>
|
||||
}
|
||||
|
||||
// ABSENT: lazy
|
||||
// ABSENT: createX1
|
||||
// EXIST: createX2
|
||||
// ABSENT: createX3
|
||||
@@ -0,0 +1,39 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class X1 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
}
|
||||
class X2 {
|
||||
operator fun getValue(thisRef: String, property: KProperty<*>): String = ""
|
||||
}
|
||||
class X3 {
|
||||
operator fun getValue(thisRef: Any, property: KProperty<*>): String = ""
|
||||
}
|
||||
|
||||
class Y1
|
||||
class Y2
|
||||
class Y3
|
||||
|
||||
operator fun Y1.getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun Y2.getValue(thisRef: String, property: KProperty<*>): String = ""
|
||||
operator fun Y3.getValue(thisRef: Any, property: KProperty<*>): String = ""
|
||||
|
||||
fun createX1() = X1()
|
||||
fun createX2() = X2()
|
||||
fun createX3() = X3()
|
||||
fun createY1() = Y1()
|
||||
fun createY2() = Y2()
|
||||
fun createY3() = Y3()
|
||||
|
||||
class C
|
||||
|
||||
val C.property by <caret>
|
||||
|
||||
// EXIST: lazy
|
||||
// EXIST: createX1
|
||||
// ABSENT: createX2
|
||||
// EXIST: createX3
|
||||
// EXIST: createY1
|
||||
// ABSENT: createY2
|
||||
// EXIST: createY3
|
||||
/*TODO: add constructors*/
|
||||
@@ -0,0 +1,42 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class X1 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun setValue(thisRef: C, property: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
class X2 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
}
|
||||
|
||||
class X3 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun setValue(thisRef: String, property: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
class X4 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun setValue(thisRef: C, property: KProperty<*>, value: CharSequence) {}
|
||||
}
|
||||
|
||||
class X5 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): CharSequence = ""
|
||||
operator fun setValue(thisRef: C, property: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
fun createX1() = X1()
|
||||
fun createX2() = X2()
|
||||
fun createX3() = X3()
|
||||
fun createX4() = X4()
|
||||
fun createX5() = X5()
|
||||
|
||||
class C
|
||||
|
||||
var C.property by <caret>
|
||||
|
||||
// ABSENT: lazy
|
||||
// EXIST: createX1
|
||||
// ABSENT: createX2
|
||||
// ABSENT: createX3
|
||||
// EXIST: createX4
|
||||
// ABSENT: createX5
|
||||
@@ -0,0 +1,39 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class X1 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
}
|
||||
class X2 {
|
||||
operator fun getValue(thisRef: String, property: KProperty<*>): String = ""
|
||||
}
|
||||
class X3 {
|
||||
operator fun getValue(thisRef: Any, property: KProperty<*>): String = ""
|
||||
}
|
||||
|
||||
class Y1
|
||||
class Y2
|
||||
class Y3
|
||||
|
||||
operator fun Y1.getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun Y2.getValue(thisRef: String, property: KProperty<*>): String = ""
|
||||
operator fun Y3.getValue(thisRef: Any, property: KProperty<*>): String = ""
|
||||
|
||||
fun createX1() = X1()
|
||||
fun createX2() = X2()
|
||||
fun createX3() = X3()
|
||||
fun createY1() = Y1()
|
||||
fun createY2() = Y2()
|
||||
fun createY3() = Y3()
|
||||
|
||||
class C {
|
||||
val property by <caret>
|
||||
}
|
||||
|
||||
// EXIST: lazy
|
||||
// EXIST: createX1
|
||||
// ABSENT: createX2
|
||||
// EXIST: createX3
|
||||
// EXIST: createY1
|
||||
// ABSENT: createY2
|
||||
// EXIST: createY3
|
||||
/*TODO: add constructors*/
|
||||
@@ -0,0 +1,42 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class X1 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun setValue(thisRef: C, property: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
class X2 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
}
|
||||
|
||||
class X3 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun setValue(thisRef: String, property: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
class X4 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): String = ""
|
||||
operator fun setValue(thisRef: C, property: KProperty<*>, value: CharSequence) {}
|
||||
}
|
||||
|
||||
class X5 {
|
||||
operator fun getValue(thisRef: C, property: KProperty<*>): CharSequence = ""
|
||||
operator fun setValue(thisRef: C, property: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
fun createX1() = X1()
|
||||
fun createX2() = X2()
|
||||
fun createX3() = X3()
|
||||
fun createX4() = X4()
|
||||
fun createX5() = X5()
|
||||
|
||||
class C {
|
||||
var property by <caret>
|
||||
}
|
||||
|
||||
// ABSENT: lazy
|
||||
// EXIST: createX1
|
||||
// ABSENT: createX2
|
||||
// ABSENT: createX3
|
||||
// EXIST: createX4
|
||||
// ABSENT: createX5
|
||||
+45
@@ -1436,6 +1436,51 @@ public class JvmSmartCompletionTestGenerated extends AbstractJvmSmartCompletionT
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/idea-completion/testData/smart/propertyDelegate")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PropertyDelegate extends AbstractJvmSmartCompletionTest {
|
||||
public void testAllFilesPresentInPropertyDelegate() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/smart/propertyDelegate"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("ExplicitValType.kt")
|
||||
public void testExplicitValType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/propertyDelegate/ExplicitValType.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExplicitVarType.kt")
|
||||
public void testExplicitVarType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/propertyDelegate/ExplicitVarType.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionVal.kt")
|
||||
public void testExtensionVal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/propertyDelegate/ExtensionVal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionVar.kt")
|
||||
public void testExtensionVar() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/propertyDelegate/ExtensionVar.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ValInClass.kt")
|
||||
public void testValInClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/propertyDelegate/ValInClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("VarInClass.kt")
|
||||
public void testVarInClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/propertyDelegate/VarInClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/idea-completion/testData/smart/smartCasts")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user