mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
[kotlin] Port AddEmptyArgumentListFix for K2
^KTIJ-29476 GitOrigin-RevId: d2f975b5edaea2c4b81f1a77f597a87fe362d823
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fc7d7156dc
commit
304abca6b7
+16
@@ -0,0 +1,16 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.k2.codeinsight.fixes
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.fir.diagnostics.KaFirDiagnostic
|
||||
import org.jetbrains.kotlin.idea.codeinsight.api.applicators.fixes.KotlinQuickFixFactory
|
||||
import org.jetbrains.kotlin.idea.quickfix.AddEmptyArgumentListFix
|
||||
import org.jetbrains.kotlin.psi.KtCallExpression
|
||||
|
||||
internal object AddEmptyArgumentListFixFactory {
|
||||
|
||||
val addEmptyArgumentListFixFactory = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.ModifierFormForNonBuiltInSuspend ->
|
||||
listOfNotNull(
|
||||
(diagnostic.psi as? KtCallExpression)?.let { AddEmptyArgumentListFix(it) }
|
||||
)
|
||||
}
|
||||
}
|
||||
+1
@@ -122,6 +122,7 @@ class KotlinK2QuickFixRegistrar : KotlinQuickFixRegistrar() {
|
||||
registerFactory(LiftAssignmentOutOfTryFixFactory.liftAssignmentOutOfTryFix)
|
||||
registerFactory(RenameModToRemFixFactory.deprecatedBinaryModFactory)
|
||||
registerFactory(RenameModToRemFixFactory.forbiddenBinaryModFactory)
|
||||
registerFactory(AddEmptyArgumentListFixFactory.addEmptyArgumentListFixFactory)
|
||||
}
|
||||
|
||||
private val addAbstract = KtQuickFixesListBuilder.registerPsiQuickFix {
|
||||
|
||||
+17
@@ -5736,7 +5736,24 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../../idea/tests/testData/quickfix/addEmptyArgumentList")
|
||||
public static class AddEmptyArgumentList extends AbstractHighLevelQuickFixTest {
|
||||
@java.lang.Override
|
||||
@org.jetbrains.annotations.NotNull
|
||||
public final KotlinPluginMode getPluginMode() {
|
||||
return KotlinPluginMode.K2;
|
||||
}
|
||||
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("suspend.kt")
|
||||
public void testSuspend() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/addEmptyArgumentList/suspend.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../../idea/tests/testData/quickfix/addEqEqTrue")
|
||||
|
||||
@@ -4,4 +4,5 @@ fun suspend(fn: () -> Unit) {}
|
||||
fun callSuspend() {
|
||||
suspend<caret> { }
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddEmptyArgumentListFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddEmptyArgumentListFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddEmptyArgumentListFix
|
||||
@@ -4,4 +4,5 @@ fun suspend(fn: () -> Unit) {}
|
||||
fun callSuspend() {
|
||||
suspend() { }
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddEmptyArgumentListFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddEmptyArgumentListFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddEmptyArgumentListFix
|
||||
+1
-1
@@ -68,7 +68,7 @@ internal fun MutableTWorkspace.generateK2FixTests() {
|
||||
model("$idea/quickfix/addDataModifier", pattern = pattern)
|
||||
model("$idea/quickfix/addDefaultConstructor", pattern = pattern, isIgnored = true)
|
||||
model("$idea/quickfix/addElseBranchToIf", pattern = pattern)
|
||||
model("$idea/quickfix/addEmptyArgumentList", pattern = pattern, isIgnored = true)
|
||||
model("$idea/quickfix/addEmptyArgumentList", pattern = pattern)
|
||||
model("$idea/quickfix/addEqEqTrue", pattern = pattern)
|
||||
model("$idea/quickfix/addFunModifier", pattern = pattern)
|
||||
model("$idea/quickfix/addGenericUpperBound", pattern = pattern, isIgnored = true)
|
||||
|
||||
Reference in New Issue
Block a user