From da233bc77b29815513421bba9e2a0771a1128465 Mon Sep 17 00:00:00 2001 From: aleksandrina-streltsova Date: Wed, 10 Apr 2024 15:53:40 +0300 Subject: [PATCH] [kotlin] k2: use `KotlinNamesValidator` ^KTIJ-28946 Fixed GitOrigin-RevId: 44ab38ef40abc92c2a84464fdb5f5256c2f20939 --- .../idea/refactoring/introduce/ExtractionTestGenerated.java | 5 +++++ .../refactoring/introduceVariable/invalidInplaceName.kt | 5 +++++ .../introduceVariable/invalidInplaceName.kt.after | 6 ++++++ .../plugin/common/resources/META-INF/refactorings.xml | 1 + .../plugin/k1/resources/META-INF/refactorings-fe10.xml | 2 -- .../introduceVariable/K2IntroduceVariableTestGenerated.java | 5 +++++ 6 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 plugins/kotlin/idea/tests/testData/refactoring/introduceVariable/invalidInplaceName.kt create mode 100644 plugins/kotlin/idea/tests/testData/refactoring/introduceVariable/invalidInplaceName.kt.after diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/refactoring/introduce/ExtractionTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/refactoring/introduce/ExtractionTestGenerated.java index 84c7ac3b7374..7fe8b9032802 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/refactoring/introduce/ExtractionTestGenerated.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/refactoring/introduce/ExtractionTestGenerated.java @@ -503,6 +503,11 @@ public abstract class ExtractionTestGenerated extends AbstractExtractionTest { runTest("testData/refactoring/introduceVariable/introduceToFile.kt"); } + @TestMetadata("invalidInplaceName.kt") + public void testInvalidInplaceName() throws Exception { + runTest("testData/refactoring/introduceVariable/invalidInplaceName.kt"); + } + @TestMetadata("It.kt") public void testIt() throws Exception { runTest("testData/refactoring/introduceVariable/It.kt"); diff --git a/plugins/kotlin/idea/tests/testData/refactoring/introduceVariable/invalidInplaceName.kt b/plugins/kotlin/idea/tests/testData/refactoring/introduceVariable/invalidInplaceName.kt new file mode 100644 index 000000000000..a6b1f610d520 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/refactoring/introduceVariable/invalidInplaceName.kt @@ -0,0 +1,5 @@ +// INPLACE_VARIABLE_NAME: val +/* this test is required to check KTIJ-28946, but the current expected result is not correct, see KTIJ-29410 */ +fun test(): Int { + return 1 +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/refactoring/introduceVariable/invalidInplaceName.kt.after b/plugins/kotlin/idea/tests/testData/refactoring/introduceVariable/invalidInplaceName.kt.after new file mode 100644 index 000000000000..a4e623304c2b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/refactoring/introduceVariable/invalidInplaceName.kt.after @@ -0,0 +1,6 @@ +// INPLACE_VARIABLE_NAME: val +/* this test is required to check KTIJ-28946, but the current expected result is not correct, see KTIJ-29410 */ +fun test(): Int { + val val = 1 + return val +} \ No newline at end of file diff --git a/plugins/kotlin/plugin/common/resources/META-INF/refactorings.xml b/plugins/kotlin/plugin/common/resources/META-INF/refactorings.xml index 526bf10f599b..3d8d51436628 100644 --- a/plugins/kotlin/plugin/common/resources/META-INF/refactorings.xml +++ b/plugins/kotlin/plugin/common/resources/META-INF/refactorings.xml @@ -16,6 +16,7 @@ + diff --git a/plugins/kotlin/plugin/k1/resources/META-INF/refactorings-fe10.xml b/plugins/kotlin/plugin/k1/resources/META-INF/refactorings-fe10.xml index 8f9f6fc2e6df..4ef2ed97f555 100644 --- a/plugins/kotlin/plugin/k1/resources/META-INF/refactorings-fe10.xml +++ b/plugins/kotlin/plugin/k1/resources/META-INF/refactorings-fe10.xml @@ -16,8 +16,6 @@ - -