Add intention to introduce import alias
#KT-16118 Fixed #KT-30007 Fixed
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
package my.simple.name
|
||||
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
val f: my.simple.name<caret>.Foo
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.IntroduceImportAliasIntention
|
||||
@@ -0,0 +1,15 @@
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Middle {
|
||||
fun test() {
|
||||
val i = Outer.Middle.Inner<caret>.SIZE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import Outer.Middle.Inner.Companion as Inner1
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Middle {
|
||||
fun test() {
|
||||
val i = Inner1.SIZE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import Outer.Middle.Inner as F
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Middle {
|
||||
fun test() {
|
||||
val i = Outer.Middle.Inner<caret>.SIZE
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import Outer.Middle.Inner as F
|
||||
import Outer.Middle.Inner.Companion as Inner1
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Middle {
|
||||
fun test() {
|
||||
val i = Inner1.SIZE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(list: List<caret><String>) {}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import kotlin.collections.List as List1
|
||||
|
||||
// WITH_RUNTIME
|
||||
fun foo(list: List1<String>) {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo() {
|
||||
val list: List<String>
|
||||
val secondList = List<caret>(5) { 1 }
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import kotlin.collections.List as List1
|
||||
|
||||
// WITH_RUNTIME
|
||||
fun foo() {
|
||||
val list: List1<String>
|
||||
val secondList = List1(5) { 1 }
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo() {
|
||||
val max = Int.MAX_VALUE<caret>
|
||||
val max2 = Int.Companion.MAX_VALUE
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import kotlin.Int.Companion.MAX_VALUE as MAX_VALUE1
|
||||
|
||||
// WITH_RUNTIME
|
||||
fun foo() {
|
||||
val max = MAX_VALUE1
|
||||
val max2 = MAX_VALUE1
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo() {
|
||||
val max = Int.MAX_VALUE
|
||||
val max2 = Int.Companion<caret>.MAX_VALUE
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import kotlin.Int.Companion as Companion1
|
||||
|
||||
// WITH_RUNTIME
|
||||
fun foo() {
|
||||
val max = Companion1.MAX_VALUE
|
||||
val max2 = Companion1.MAX_VALUE
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import Outer.Middle as P
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = Outer.Middle<caret>.Inner()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import Outer.Middle as Middle1
|
||||
import Outer.Middle as P
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = Middle1.Inner()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import Outer.Inner
|
||||
|
||||
class Outer {
|
||||
class Inner
|
||||
}
|
||||
|
||||
class Test(){
|
||||
fun test(){
|
||||
val i = Inner<caret>()
|
||||
}
|
||||
fun test2(){
|
||||
val i = Inner()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import Outer.Inner as Inner1
|
||||
|
||||
class Outer {
|
||||
class Inner
|
||||
}
|
||||
|
||||
class Test(){
|
||||
fun test(){
|
||||
val i = Inner1()
|
||||
}
|
||||
fun test2(){
|
||||
val i = Inner1()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner(val outer: Outer) {
|
||||
constructor() : this(Outer())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Middle {
|
||||
fun test() {
|
||||
val i = Outer.Middle.Inner<caret>(Outer())
|
||||
val b = Outer.Middle.Inner()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import Outer.Middle.Inner as Inner1
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner(val outer: Outer) {
|
||||
constructor() : this(Outer())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Middle {
|
||||
fun test() {
|
||||
val i = Inner1(Outer())
|
||||
val b = Inner1()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val foo = 1
|
||||
Outer.Middle.Inner.foo<caret>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import Outer.Middle.Inner.Companion.foo as foo1
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val foo = 1
|
||||
foo1()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import Outer.Middle as Middle1
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = Outer.Middle<caret>.Inner.SIZE
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val i = Middle1.Inner.SIZE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import Outer.Middle as Middle1
|
||||
import Outer.Middle as Middle2
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = Middle2.Inner.SIZE
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val i = Middle1.Inner.SIZE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import Outer.Middle.Inner
|
||||
import Outer.Middle.Inner.Companion.foo
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
fun foo() {}
|
||||
fun foo(a: Outer) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = Inner.foo<caret>()
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val i = Outer.Middle.Inner.foo(Outer())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import Outer.Middle.Inner
|
||||
import Outer.Middle.Inner.Companion.foo as foo1
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
fun foo() {}
|
||||
fun foo(a: Outer) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = foo1()
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val i = foo1(Outer())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import Outer.Middle
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = Middle<caret>.Inner.SIZE
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val i = Outer.Middle.Inner.SIZE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import Outer.Middle as Middle1
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = Middle1.Inner.SIZE
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val i = Middle1.Inner.SIZE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// IS_APPLICABLE: false
|
||||
import Outer.Inner as NotTestAlias
|
||||
|
||||
class Outer {
|
||||
class Inner
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = NotTestAlias<caret>()
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val i = NotTestAlias()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
class Foo
|
||||
|
||||
val i = Foo<caret>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = Test()
|
||||
val b = i<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
package my.simple.name
|
||||
|
||||
class Foo
|
||||
|
||||
fun foo() {
|
||||
val foo: my.simple.name<caret>.Foo
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// IS_APPLICABLE: false
|
||||
import Outer.*<caret>
|
||||
|
||||
class Outer {
|
||||
class Inner
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import Outer.Middle<caret>
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import Outer.Middle as Middle1
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Outer {
|
||||
class Middle<T> {}
|
||||
}
|
||||
|
||||
class B<T> {}
|
||||
|
||||
fun foo(b: B<Outer.Middle<caret><String>>) {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import Outer.Middle as Middle1
|
||||
|
||||
class Outer {
|
||||
class Middle<T> {}
|
||||
}
|
||||
|
||||
class B<T> {}
|
||||
|
||||
fun foo(b: B<Middle1<String>>) {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Outer {
|
||||
class Middle<T> {}
|
||||
class Middle1 {}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val t = Outer.Middle<Outer.Middle<caret><Outer.Middle1>>()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import Outer.Middle as Middle1
|
||||
|
||||
class Outer {
|
||||
class Middle<T> {}
|
||||
class Middle1 {}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val t = Middle1<Middle1<Outer.Middle1>>()
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import Outer.Middle
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = Middle.Inner.SIZE<caret>
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val i = Outer.Middle.Inner.SIZE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import Outer.Middle
|
||||
import Outer.Middle.Inner.Companion.SIZE as SIZE1
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
companion object {
|
||||
const val SIZE = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val i = SIZE1
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val i = SIZE1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user