Do not suggest quickfix 'Specify type explicitly' with existing type

So #KT-15180 Fixed
This commit is contained in:
Toshiaki Kameyama
2017-12-21 14:08:08 +03:00
committed by Mikhail Glukhikh
parent 5475f99cec
commit 5e765c525e
3 changed files with 13 additions and 0 deletions
@@ -41,6 +41,7 @@ class SpecifyTypeExplicitlyFix : PsiElementBaseIntentionAction() {
override fun isAvailable(project: Project, editor: Editor, element: PsiElement): Boolean {
val declaration = declarationByElement(element)
if (declaration?.typeReference != null) return false
text = when (declaration) {
is KtProperty -> "Specify type explicitly"
is KtNamedFunction -> "Specify return type explicitly"
@@ -0,0 +1,6 @@
// "Specify return type explicitly" "false"
// ACTION: Add getter
// ACTION: Add initializer
// ACTION: Convert property to function
// ERROR: Property must be initialized
val <caret>test: Int
@@ -11012,6 +11012,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
doTest(fileName);
}
@TestMetadata("propertyHasType.kt")
public void testPropertyHasType() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeAddition/propertyHasType.kt");
doTest(fileName);
}
@TestMetadata("propertyWithGetterWithBlockBody.kt")
public void testPropertyWithGetterWithBlockBody() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeAddition/propertyWithGetterWithBlockBody.kt");