diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/SpecifyTypeExplicitlyIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/SpecifyTypeExplicitlyIntention.kt index be2d1eaf53a..5b97bc51345 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/SpecifyTypeExplicitlyIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/SpecifyTypeExplicitlyIntention.kt @@ -22,6 +22,7 @@ import com.intellij.openapi.editor.Editor import com.intellij.psi.PsiDocumentManager import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade import org.jetbrains.kotlin.idea.util.* @@ -59,9 +60,19 @@ class SpecifyTypeExplicitlyIntention : SelfTargetingIntentionx + get(): Int = 42 \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/propertyWithGetterWithoutType.kt.after b/idea/testData/quickfix/typeAddition/propertyWithGetterWithoutType.kt.after new file mode 100644 index 00000000000..dd2e72d7be9 --- /dev/null +++ b/idea/testData/quickfix/typeAddition/propertyWithGetterWithoutType.kt.after @@ -0,0 +1,4 @@ +// "Specify type explicitly" "true" + +val x: Int + get(): Int = 42 \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/propertyWithSetterWithoutType.kt b/idea/testData/quickfix/typeAddition/propertyWithSetterWithoutType.kt new file mode 100644 index 00000000000..023d98d0443 --- /dev/null +++ b/idea/testData/quickfix/typeAddition/propertyWithSetterWithoutType.kt @@ -0,0 +1,12 @@ +// "Specify type explicitly" "true" + +class My { + + var yy = 0 + + var y + get() = yy + set(arg: Int) { + yy = arg + 1 + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/propertyWithSetterWithoutType.kt.after b/idea/testData/quickfix/typeAddition/propertyWithSetterWithoutType.kt.after new file mode 100644 index 00000000000..c944eb6355f --- /dev/null +++ b/idea/testData/quickfix/typeAddition/propertyWithSetterWithoutType.kt.after @@ -0,0 +1,12 @@ +// "Specify type explicitly" "true" + +class My { + + var yy = 0 + + var y: Int + get() = yy + set(arg: Int) { + yy = arg + 1 + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 6b4250a838f..467d0659683 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -6775,6 +6775,18 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { doTest(fileName); } + @TestMetadata("propertyWithGetterWithoutType.kt") + public void testPropertyWithGetterWithoutType() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeAddition/propertyWithGetterWithoutType.kt"); + doTest(fileName); + } + + @TestMetadata("propertyWithSetterWithoutType.kt") + public void testPropertyWithSetterWithoutType() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeAddition/propertyWithSetterWithoutType.kt"); + doTest(fileName); + } + @TestMetadata("protectedFunWithoutReturnType.kt") public void testProtectedFunWithoutReturnType() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeAddition/protectedFunWithoutReturnType.kt");