New J2K: consider in-context declarations while performing conversion on copy-paste plain text conversion

#KT-32602 fixed
This commit is contained in:
Ilya Kirillov
2019-07-16 18:16:26 +03:00
parent c865d74965
commit 96ca4712a0
17 changed files with 204 additions and 8 deletions
@@ -0,0 +1,6 @@
class A {
val str: String = TODO()
internal fun f() {
str.length
}
}
@@ -0,0 +1,4 @@
class A {
val str: String = TODO()
<caret>
}
@@ -0,0 +1,3 @@
void f() {
str.length();
}
@@ -0,0 +1,7 @@
class Test {
val str: Int = 10
fun test() {
val str: String = ""
val len = str.length
}
}
@@ -0,0 +1,7 @@
class Test {
val str: Int = 10
fun test() {
val str: String = ""
<caret>
}
}
@@ -0,0 +1 @@
int len = str.length();
@@ -0,0 +1,4 @@
fun test() {
val str: String = ""
val len = str.length
}
@@ -0,0 +1,4 @@
fun test() {
val str: String = ""
<caret>
}
@@ -0,0 +1 @@
int len = str.length();
@@ -0,0 +1,4 @@
val str: String = TODO()
internal fun f() {
str.length
}
@@ -0,0 +1,2 @@
val str: String = TODO()
<caret>
@@ -0,0 +1,3 @@
void f() {
str.length();
}
@@ -49,6 +49,11 @@ public class TextNewJavaToKotlinCopyPasteConversionTestGenerated extends Abstrac
runTest("nj2k/testData/copyPastePlainText/ImportResolve.txt");
}
@TestMetadata("InClassContextProperty.txt")
public void testInClassContextProperty() throws Exception {
runTest("nj2k/testData/copyPastePlainText/InClassContextProperty.txt");
}
@TestMetadata("InsideIdentifier.txt")
public void testInsideIdentifier() throws Exception {
runTest("nj2k/testData/copyPastePlainText/InsideIdentifier.txt");
@@ -89,6 +94,16 @@ public class TextNewJavaToKotlinCopyPasteConversionTestGenerated extends Abstrac
runTest("nj2k/testData/copyPastePlainText/KT32604.txt");
}
@TestMetadata("LocalAndMemberConflict.txt")
public void testLocalAndMemberConflict() throws Exception {
runTest("nj2k/testData/copyPastePlainText/LocalAndMemberConflict.txt");
}
@TestMetadata("LocalContextProperty.txt")
public void testLocalContextProperty() throws Exception {
runTest("nj2k/testData/copyPastePlainText/LocalContextProperty.txt");
}
@TestMetadata("MembersIntoClass.txt")
public void testMembersIntoClass() throws Exception {
runTest("nj2k/testData/copyPastePlainText/MembersIntoClass.txt");
@@ -119,6 +134,11 @@ public class TextNewJavaToKotlinCopyPasteConversionTestGenerated extends Abstrac
runTest("nj2k/testData/copyPastePlainText/StatementsIntoFunction.txt");
}
@TestMetadata("TopLevelContextProperty.txt")
public void testTopLevelContextProperty() throws Exception {
runTest("nj2k/testData/copyPastePlainText/TopLevelContextProperty.txt");
}
@TestMetadata("WholeFile.txt")
public void testWholeFile() throws Exception {
runTest("nj2k/testData/copyPastePlainText/WholeFile.txt");