diff --git a/idea/testData/refactoring/introduceProperty/extractToClassWithNameClashAndAnonymousInitializer.kt b/idea/testData/refactoring/introduceProperty/extractToClassWithNameClashAndAnonymousInitializer.kt new file mode 100644 index 00000000000..6bafa0602ed --- /dev/null +++ b/idea/testData/refactoring/introduceProperty/extractToClassWithNameClashAndAnonymousInitializer.kt @@ -0,0 +1,14 @@ +// EXTRACTION_TARGET: property with initializer + +class A { + val i: Int + + { + i = 1 + } + + fun foo(): Int { + return 1 + 2 + } +} + diff --git a/idea/testData/refactoring/introduceProperty/extractToClassWithNameClashAndAnonymousInitializer.kt.after b/idea/testData/refactoring/introduceProperty/extractToClassWithNameClashAndAnonymousInitializer.kt.after new file mode 100644 index 00000000000..56690b67f77 --- /dev/null +++ b/idea/testData/refactoring/introduceProperty/extractToClassWithNameClashAndAnonymousInitializer.kt.after @@ -0,0 +1,16 @@ +// EXTRACTION_TARGET: property with initializer + +class A { + val i: Int + + { + i = 1 + } + + private val i1 = 1 + 2 + + fun foo(): Int { + return i1 + } +} + diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java index 97fb93a4294..e366e0f9643 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/JetExtractionTestGenerated.java @@ -1965,6 +1965,12 @@ public class JetExtractionTestGenerated extends AbstractJetExtractionTest { doIntroducePropertyTest(fileName); } + @TestMetadata("extractToClassWithNameClashAndAnonymousInitializer.kt") + public void testExtractToClassWithNameClashAndAnonymousInitializer() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/introduceProperty/extractToClassWithNameClashAndAnonymousInitializer.kt"); + doIntroducePropertyTest(fileName); + } + @TestMetadata("extractToFileWithNameClash.kt") public void testExtractToFileWithNameClash() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/introduceProperty/extractToFileWithNameClash.kt");