From 2db4d477e8a03648fa72f886f0f1fb7002ce9925 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Wed, 27 Mar 2024 09:46:33 +0100 Subject: [PATCH] [kotlin] k2 extract function: additional test data ^KTIJ-10882 fixed GitOrigin-RevId: 70235fef1f911c4da79ac93f684c6d459756c7e4 --- .../introduce/ExtractionTestGenerated.java | 5 +++++ .../extractFunction/basic/typedFunctionLiteral.kt | 10 ++++++++++ .../basic/typedFunctionLiteral.kt.after | 12 ++++++++++++ .../K2IntroduceFunctionTestGenerated.java | 5 +++++ 4 files changed, 32 insertions(+) create mode 100644 plugins/kotlin/idea/tests/testData/refactoring/extractFunction/basic/typedFunctionLiteral.kt create mode 100644 plugins/kotlin/idea/tests/testData/refactoring/extractFunction/basic/typedFunctionLiteral.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 87d0e13b7fdc..e77aa249386e 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 @@ -1080,6 +1080,11 @@ public abstract class ExtractionTestGenerated extends AbstractExtractionTest { runTest("testData/refactoring/extractFunction/basic/topLevelValUnderSmartCast.kt"); } + @TestMetadata("typedFunctionLiteral.kt") + public void testTypedFunctionLiteral() throws Exception { + runTest("testData/refactoring/extractFunction/basic/typedFunctionLiteral.kt"); + } + @TestMetadata("unnecessaryNullabilityAnnotation.kt") public void testUnnecessaryNullabilityAnnotation() throws Exception { runTest("testData/refactoring/extractFunction/basic/unnecessaryNullabilityAnnotation.kt"); diff --git a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/basic/typedFunctionLiteral.kt b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/basic/typedFunctionLiteral.kt new file mode 100644 index 000000000000..08cfa3602a08 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/basic/typedFunctionLiteral.kt @@ -0,0 +1,10 @@ +class Bar + +class Foo { + fun bar(block: (Bar) -> Int) {} + init { + bar({ bar -> 1 }) + } +} + +// IGNORE_K1 \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/basic/typedFunctionLiteral.kt.after b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/basic/typedFunctionLiteral.kt.after new file mode 100644 index 000000000000..943ed989df90 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/basic/typedFunctionLiteral.kt.after @@ -0,0 +1,12 @@ +class Bar + +class Foo { + fun bar(block: (Bar) -> Int) {} + init { + bar(function()) + } + + private fun function(): (Bar) -> Int = { bar -> 1 } +} + +// IGNORE_K1 diff --git a/plugins/kotlin/refactorings/kotlin.refactorings.tests.k2/test/org/jetbrains/kotlin/idea/k2/refactoring/introduceFunction/K2IntroduceFunctionTestGenerated.java b/plugins/kotlin/refactorings/kotlin.refactorings.tests.k2/test/org/jetbrains/kotlin/idea/k2/refactoring/introduceFunction/K2IntroduceFunctionTestGenerated.java index 165d3e132478..a3239b8e13a4 100644 --- a/plugins/kotlin/refactorings/kotlin.refactorings.tests.k2/test/org/jetbrains/kotlin/idea/k2/refactoring/introduceFunction/K2IntroduceFunctionTestGenerated.java +++ b/plugins/kotlin/refactorings/kotlin.refactorings.tests.k2/test/org/jetbrains/kotlin/idea/k2/refactoring/introduceFunction/K2IntroduceFunctionTestGenerated.java @@ -301,6 +301,11 @@ public abstract class K2IntroduceFunctionTestGenerated extends AbstractK2Introdu runTest("../../idea/tests/testData/refactoring/extractFunction/basic/topLevelValUnderSmartCast.kt"); } + @TestMetadata("typedFunctionLiteral.kt") + public void testTypedFunctionLiteral() throws Exception { + runTest("../../idea/tests/testData/refactoring/extractFunction/basic/typedFunctionLiteral.kt"); + } + @TestMetadata("unnecessaryNullabilityAnnotation.kt") public void testUnnecessaryNullabilityAnnotation() throws Exception { runTest("../../idea/tests/testData/refactoring/extractFunction/basic/unnecessaryNullabilityAnnotation.kt");