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");