Remove unused function parameter: do not propose for property setter parameter
#KT-29606 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
5b0d1bb6e4
commit
804e03379d
@@ -70,7 +70,10 @@ class RemoveUnusedFunctionParameterFix(parameter: KtParameter) : KotlinQuickFixA
|
||||
override fun createAction(diagnostic: Diagnostic): KotlinQuickFixAction<KtParameter>? {
|
||||
val parameter = Errors.UNUSED_PARAMETER.cast(diagnostic).psiElement
|
||||
val parameterOwner = parameter.parent.parent
|
||||
if (parameterOwner is KtFunctionLiteral || (parameterOwner is KtNamedFunction && parameterOwner.name == null)) return null
|
||||
if (parameterOwner is KtFunctionLiteral
|
||||
|| (parameterOwner is KtNamedFunction && parameterOwner.name == null)
|
||||
|| parameterOwner is KtPropertyAccessor
|
||||
) return null
|
||||
return RemoveUnusedFunctionParameterFix(parameter)
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Remove parameter 'value'" "false"
|
||||
// ACTION: Specify type explicitly
|
||||
class Abacaba {
|
||||
var foo: String
|
||||
get() = ""
|
||||
set(<caret>value) {}
|
||||
}
|
||||
@@ -1909,6 +1909,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
runTest("idea/testData/quickfix/changeSignature/removeUnusedParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removeUnusedParameterOfPropertySetter.kt")
|
||||
public void testRemoveUnusedParameterOfPropertySetter() throws Exception {
|
||||
runTest("idea/testData/quickfix/changeSignature/removeUnusedParameterOfPropertySetter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removeUnusedParameterWithTypeParameter.kt")
|
||||
public void testRemoveUnusedParameterWithTypeParameter() throws Exception {
|
||||
runTest("idea/testData/quickfix/changeSignature/removeUnusedParameterWithTypeParameter.kt");
|
||||
|
||||
Reference in New Issue
Block a user