From e0b71eb2870a063d2eefe0f11259a1c693ea3da5 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Mon, 25 Mar 2024 13:21:04 +0100 Subject: [PATCH] [kotlin] k2: additional testdata for extract function ^KTIJ-9144 fixed GitOrigin-RevId: 0c100bcc220db2dcfda0190b887ae8924232d83f --- .../introduce/ExtractionTestGenerated.java | 5 +++++ .../outputValues/outputValueByNullability.kt | 8 ++++++++ .../outputValues/outputValueByNullability.kt.after | 12 ++++++++++++ .../K2IntroduceFunctionTestGenerated.java | 5 +++++ 4 files changed, 30 insertions(+) create mode 100644 plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.kt create mode 100644 plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.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 4abc77c337df..e04e315b3109 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 @@ -1444,6 +1444,11 @@ public abstract class ExtractionTestGenerated extends AbstractExtractionTest { runTest("testData/refactoring/extractFunction/controlFlow/outputValues/nestedNonInlinableCall.kt"); } + @TestMetadata("outputValueByNullability.kt") + public void testOutputValueByNullability() throws Exception { + runTest("testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.kt"); + } + @TestMetadata("outputValueWithExpression.kt") public void testOutputValueWithExpression() throws Exception { runTest("testData/refactoring/extractFunction/controlFlow/outputValues/outputValueWithExpression.kt"); diff --git a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.kt b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.kt new file mode 100644 index 000000000000..9747990ddb41 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.kt @@ -0,0 +1,8 @@ +fun test(): String? { + arrayOf(1, 2, 3).forEach { + return "" + } + return null +} + +// IGNORE_K1 \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.kt.after b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.kt.after new file mode 100644 index 000000000000..a46dc4110fa3 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.kt.after @@ -0,0 +1,12 @@ +fun test(): String? { + return string() +} + +private fun string(): String? { + arrayOf(1, 2, 3).forEach { + return "" + } + return null +} + +// IGNORE_K1 \ No newline at end of file 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 3f685c62cf84..f878e7cf908e 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 @@ -665,6 +665,11 @@ public abstract class K2IntroduceFunctionTestGenerated extends AbstractK2Introdu runTest("../../idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/nestedNonInlinableCall.kt"); } + @TestMetadata("outputValueByNullability.kt") + public void testOutputValueByNullability() throws Exception { + runTest("../../idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueByNullability.kt"); + } + @TestMetadata("outputValueWithExpression.kt") public void testOutputValueWithExpression() throws Exception { runTest("../../idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/outputValueWithExpression.kt");