KT-15311 "Add Import" intention generates incorrect code

#KT-15311 fixed
This commit is contained in:
Simon Ogorodnik
2017-01-24 19:07:38 +03:00
committed by Simon Ogorodnik
parent 1613ad0505
commit cd73d17bd4
15 changed files with 126 additions and 11 deletions
+7
View File
@@ -0,0 +1,7 @@
// INTENTION_TEXT: "Add import for 'java.util.ArrayList'"
// WITH_RUNTIME
fun test() {
val myList = java.util<caret>.ArrayList<Int>()
val otherList = java.util.ArrayList<String>()
}
@@ -0,0 +1,9 @@
import java.util.ArrayList
// INTENTION_TEXT: "Add import for 'java.util.ArrayList'"
// WITH_RUNTIME
fun test() {
val myList = ArrayList<Int>()
val otherList = ArrayList<String>()
}
@@ -0,0 +1,5 @@
package p
object A {
var some: Any? = null
}
@@ -0,0 +1,6 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun usage() {
println(p.A.some?.<caret>toString())
}
@@ -0,0 +1,8 @@
package p
object Container {
class Nested {
}
}
@@ -0,0 +1,8 @@
package p
object Container {
class Nested {
}
}
@@ -0,0 +1,4 @@
// INTENTION_TEXT: "Add import for 'p.Container.Nested'"
fun test() {
p.Container.<caret>Nested()
}
@@ -0,0 +1,6 @@
import p.Container.Nested
// INTENTION_TEXT: "Add import for 'p.Container.Nested'"
fun test() {
Nested()
}
@@ -0,0 +1,8 @@
package p
object Container {
class Nested {
}
}
@@ -0,0 +1,8 @@
package p
object Container {
class Nested {
}
}
@@ -0,0 +1,4 @@
// INTENTION_TEXT: "Add import for 'p.Container.Nested'"
fun test() {
p.<caret>Container.Nested()
}
@@ -0,0 +1,6 @@
import p.Container.Nested
// INTENTION_TEXT: "Add import for 'p.Container.Nested'"
fun test() {
Nested()
}