KT-5959 Imports should be inserted on paste from java with conversion to Kotlin

#KT-5959 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-04-03 15:55:56 +03:00
parent 754567af07
commit 506f84fb8a
41 changed files with 462 additions and 172 deletions
@@ -0,0 +1,5 @@
import java.io.File
fun foo(file: File): List<String> {
return emptyList()
}
@@ -0,0 +1,9 @@
import java.io.File;
import java.util.Collections;
import java.util.List;
class C {
<selection> List<String> foo(File file) {
return Collections.emptyList();
}
</selection>}
@@ -0,0 +1 @@
<caret>
@@ -0,0 +1,3 @@
import java.io.File
fun foo(): List<File><caret>
@@ -0,0 +1,10 @@
// NO_CONVERSION_EXPECTED
import java.io.*;
import java.util.Collections;
import java.util.List;
class C {
<selection>List<File></selection> foo() {
return Collections.emptyList();
}
}
@@ -0,0 +1 @@
fun foo(): <caret>
@@ -0,0 +1,5 @@
import java.io.File
fun foo() {
list.add(File.separatorChar)<caret>
}
@@ -0,0 +1,9 @@
// NO_CONVERSION_EXPECTED
import java.io.*;
import java.util.*;
class C {
void foo(List<Character> list) {
<selection>list.add(File.separatorChar)</selection>
}
}
@@ -0,0 +1,3 @@
fun foo() {
<caret>
}
@@ -0,0 +1,8 @@
package ppp
import kotlin.platform.platformStatic
public object Dependency {
[platformStatic]
public val FIELD: Int = 1
}
@@ -0,0 +1,5 @@
import ppp.Dependency
fun f() {
return Dependency.FIELD<caret>
}
@@ -0,0 +1,7 @@
package ppp
class C {
char foo() {
<selection>return Dependency.FIELD;</selection>
}
}
@@ -0,0 +1,3 @@
fun f() {
<caret>
}
@@ -0,0 +1,3 @@
package ppp
class dummy0
@@ -0,0 +1,5 @@
import ppp.dummy0
fun f() {
return dummy0()<caret>
}
@@ -0,0 +1,7 @@
import ppp.*
class C {
dummy0 foo() {
<selection>return dummy0();</selection>
}
}
@@ -0,0 +1,3 @@
fun f() {
<caret>
}
@@ -1 +1 @@
No conversion performed
val v = b - c + d
@@ -1,3 +1,4 @@
// NO_CONVERSION_EXPECTED
public static void main(String[]args){
a + <selection>b - c + d</selection> - e
}
@@ -1 +1,4 @@
No conversion performed
fun main(args: Array<String>) {
reference(arg)
somethingElse()
}
@@ -1,3 +1,4 @@
// NO_CONVERSION_EXPECTED
class A {
public static void main(String[] args) {
qualifier.<selection>reference(arg)</selection>;
@@ -1 +1 @@
No conversion performed
}
@@ -1,3 +1,4 @@
// NO_CONVERSION_EXPECTED
class A {
public static void main(String[] args) {
//sdasd
@@ -1 +1,4 @@
No conversion performed
fun main(args: Array<String>) {
qualifier
somethingElse()
}
@@ -1,3 +1,4 @@
// NO_CONVERSION_EXPECTED
class A {
public static void main(String[] args) {
<selection>qualifier</selection>.reference(arg);
@@ -1 +1 @@
No conversion performed
class Some
@@ -1,3 +1,4 @@
// NO_CONVERSION_EXPECTED
<selection>class Some</selection>InterestingClass {
}