mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] Port RemoveAtFromAnnotationArgument for K2
The following tests are muted (KTIJ-31896): - testArrayParam - testBrokenCode due to KT-72831. ^KTIJ-29520 Fixed GitOrigin-RevId: bf31a64c4f944b06ec4f30591968af34526b744d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
210874396e
commit
53f4d48ee1
+13
@@ -0,0 +1,13 @@
|
||||
// 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.RemoveAtFromAnnotationArgument
|
||||
|
||||
internal object AnnotationUsedAsAnnotationArgumentFixFactories {
|
||||
|
||||
val removeAtFromAnnotationArgumentFixFactory = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.AnnotationUsedAsAnnotationArgument ->
|
||||
listOf(RemoveAtFromAnnotationArgument(diagnostic.psi))
|
||||
}
|
||||
}
|
||||
+2
@@ -364,6 +364,8 @@ class KotlinK2QuickFixRegistrar : KotlinQuickFixRegistrar() {
|
||||
|
||||
registerFactory(ReplaceProtectedToPublishedApiCallFixFactory.protectedCallFromPublicInline)
|
||||
registerFactory(ReplaceProtectedToPublishedApiCallFixFactory.protectedCallFromPublicInlineError)
|
||||
|
||||
registerFactory(AnnotationUsedAsAnnotationArgumentFixFactories.removeAtFromAnnotationArgumentFixFactory)
|
||||
}
|
||||
|
||||
private val whenStatements = KtQuickFixesListBuilder.registerPsiQuickFix {
|
||||
|
||||
+32
@@ -10742,7 +10742,39 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../../idea/tests/testData/quickfix/removeAtFromAnnotationArgument")
|
||||
public static class RemoveAtFromAnnotationArgument 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("arrayParam.kt")
|
||||
public void testArrayParam() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/removeAtFromAnnotationArgument/arrayParam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("brokenCode.kt")
|
||||
public void testBrokenCode() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/removeAtFromAnnotationArgument/brokenCode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("namedParam.kt")
|
||||
public void testNamedParam() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/removeAtFromAnnotationArgument/namedParam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/removeAtFromAnnotationArgument/simple.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../../idea/tests/testData/quickfix/removeDefaultParameterValue")
|
||||
|
||||
+4
-1
@@ -7,4 +7,7 @@ annotation class X(val value: Array<Y>)
|
||||
@X(arrayOf(Y(), @Y()<caret>))
|
||||
fun foo() {
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
/* IGNORE_K2 */
|
||||
// KT-72831
|
||||
// KTIJ-31896
|
||||
+4
-1
@@ -7,4 +7,7 @@ annotation class X(val value: Array<Y>)
|
||||
@X(arrayOf(Y(), Y()))
|
||||
fun foo() {
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
/* IGNORE_K2 */
|
||||
// KT-72831
|
||||
// KTIJ-31896
|
||||
+4
-1
@@ -2,4 +2,7 @@
|
||||
// DISABLE-ERRORS
|
||||
@Suppress({ <caret>@x
|
||||
y() }) fun test() {}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
/* IGNORE_K2 */
|
||||
// KT-72831
|
||||
// KTIJ-31896
|
||||
+4
-1
@@ -2,4 +2,7 @@
|
||||
// DISABLE-ERRORS
|
||||
@Suppress({ <caret>x
|
||||
y() }) fun test() {}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
/* IGNORE_K2 */
|
||||
// KT-72831
|
||||
// KTIJ-31896
|
||||
+2
-1
@@ -7,4 +7,5 @@ annotation class X(val value: Y, val y: Y)
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
+2
-1
@@ -7,4 +7,5 @@ annotation class X(val value: Y, val y: Y)
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
+2
-1
@@ -6,4 +6,5 @@ annotation class X(val value: Y)
|
||||
@X(@Y()<caret>)
|
||||
fun foo() {
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
+2
-1
@@ -6,4 +6,5 @@ annotation class X(val value: Y)
|
||||
@X(Y())
|
||||
fun foo() {
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveAtFromAnnotationArgument
|
||||
+1
-1
@@ -167,7 +167,7 @@ internal fun MutableTWorkspace.generateK2FixTests() {
|
||||
model("$idea/quickfix/redundantVisibilityModifier", pattern = pattern, isIgnored = true)
|
||||
model("$idea/quickfix/removeAnnotation", pattern = pattern, isIgnored = true)
|
||||
model("$idea/quickfix/removeArgument", pattern = pattern)
|
||||
model("$idea/quickfix/removeAtFromAnnotationArgument", pattern = pattern, isIgnored = true)
|
||||
model("$idea/quickfix/removeAtFromAnnotationArgument", pattern = pattern)
|
||||
model("$idea/quickfix/removeDefaultParameterValue", pattern = pattern)
|
||||
model("$idea/quickfix/removeFinalUpperBound", pattern = pattern)
|
||||
model("$idea/quickfix/removeNoConstructor", pattern = pattern)
|
||||
|
||||
Reference in New Issue
Block a user