don't show "Change type arguments" fix when there's nothing to change
#KT-11178 Fixed
This commit is contained in:
@@ -38,7 +38,10 @@ class ChangeToStarProjectionFix(element: KtTypeElement) : KotlinQuickFixAction<K
|
||||
val typeReference = diagnostic.psiElement.getNonStrictParentOfType<KtBinaryExpressionWithTypeRHS>()?.right
|
||||
?: diagnostic.psiElement.getNonStrictParentOfType<KtTypeReference>()
|
||||
val typeElement = typeReference?.typeElement ?: return null
|
||||
return ChangeToStarProjectionFix(typeElement)
|
||||
if (typeElement.typeArgumentsAsTypes.isNotEmpty()) {
|
||||
return ChangeToStarProjectionFix(typeElement)
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Change type arguments to <>" "false"
|
||||
// ACTION: Convert to expression body
|
||||
fun <T> get(column: String, map: Map<String, Any>): T {
|
||||
return map[column] as <caret>T
|
||||
}
|
||||
@@ -413,6 +413,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/addStarProjections/cast/changeToStarProjectionNullable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("uncheckedCastOnTypeParameter.kt")
|
||||
public void testUncheckedCastOnTypeParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/addStarProjections/cast/uncheckedCastOnTypeParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/addStarProjections/checkType")
|
||||
|
||||
Reference in New Issue
Block a user