FIR IDE: Fix completion in property setters

Property consists of getter and setter (both optional). The setter
have a single `value` parameter with type

Because of it, we have to make a separate 'frankenstein setter' with
original resolved header, but with the body of the fake one

It seems that getters does not have such issues
This commit is contained in:
Roman Golyshev
2020-09-08 15:06:16 +03:00
parent 5c1520305b
commit dcc22d3e5d
13 changed files with 204 additions and 1 deletions
@@ -0,0 +1,10 @@
// FIR_COMPARISON
fun localFun(): Int {}
val property: Int
get() {
<caret>
}
// EXIST: localFun
@@ -0,0 +1,8 @@
// FIR_COMPARISON
fun localFun(): Int {}
val property: Int
get() = <caret>
// EXIST: localFun
@@ -0,0 +1,8 @@
// FIR_COMPARISON
class LocalType
val property
get(): <caret>
// EXIST: LocalType
@@ -0,0 +1,7 @@
// FIR_COMPARISON
fun localFun(): Int {}
val property = <caret>
// EXIST: localFun
@@ -0,0 +1,11 @@
// FIR_COMPARISON
fun localFun() {}
var property: Int
get() = 1
set(value) {
<caret>
}
// EXIST: localFun
@@ -0,0 +1,9 @@
// FIR_COMPARISON
fun localFun() {}
var property: Int
get() = 1
set(value) = <caret>
// EXIST: localFun
@@ -0,0 +1,7 @@
// FIR_COMPARISON
class LocalType
val property: <caret>
// EXIST: LocalType
@@ -2362,6 +2362,41 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelClasses.kt");
}
@TestMetadata("topLevelPropertyGetterBodyCompletion.kt")
public void testTopLevelPropertyGetterBodyCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyGetterBodyCompletion.kt");
}
@TestMetadata("topLevelPropertyGetterExpressionCompletion.kt")
public void testTopLevelPropertyGetterExpressionCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyGetterExpressionCompletion.kt");
}
@TestMetadata("topLevelPropertyGetterTypeCompletion.kt")
public void testTopLevelPropertyGetterTypeCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyGetterTypeCompletion.kt");
}
@TestMetadata("topLevelPropertyInitializerCompletion.kt")
public void testTopLevelPropertyInitializerCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyInitializerCompletion.kt");
}
@TestMetadata("topLevelPropertySetterBodyCompletion.kt")
public void testTopLevelPropertySetterBodyCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertySetterBodyCompletion.kt");
}
@TestMetadata("topLevelPropertySetterExpressionCompletion.kt")
public void testTopLevelPropertySetterExpressionCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertySetterExpressionCompletion.kt");
}
@TestMetadata("topLevelPropertyTypeCompletion.kt")
public void testTopLevelPropertyTypeCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyTypeCompletion.kt");
}
@TestMetadata("topLevelVariablesAndFunctions.kt")
public void testTopLevelVariablesAndFunctions() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelVariablesAndFunctions.kt");
@@ -2362,6 +2362,41 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelClasses.kt");
}
@TestMetadata("topLevelPropertyGetterBodyCompletion.kt")
public void testTopLevelPropertyGetterBodyCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyGetterBodyCompletion.kt");
}
@TestMetadata("topLevelPropertyGetterExpressionCompletion.kt")
public void testTopLevelPropertyGetterExpressionCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyGetterExpressionCompletion.kt");
}
@TestMetadata("topLevelPropertyGetterTypeCompletion.kt")
public void testTopLevelPropertyGetterTypeCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyGetterTypeCompletion.kt");
}
@TestMetadata("topLevelPropertyInitializerCompletion.kt")
public void testTopLevelPropertyInitializerCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyInitializerCompletion.kt");
}
@TestMetadata("topLevelPropertySetterBodyCompletion.kt")
public void testTopLevelPropertySetterBodyCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertySetterBodyCompletion.kt");
}
@TestMetadata("topLevelPropertySetterExpressionCompletion.kt")
public void testTopLevelPropertySetterExpressionCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertySetterExpressionCompletion.kt");
}
@TestMetadata("topLevelPropertyTypeCompletion.kt")
public void testTopLevelPropertyTypeCompletion() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelPropertyTypeCompletion.kt");
}
@TestMetadata("topLevelVariablesAndFunctions.kt")
public void testTopLevelVariablesAndFunctions() throws Exception {
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/topLevelVariablesAndFunctions.kt");