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
|
||||
}
|
||||
}
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// "Add annotation target" "false"
|
||||
// WITH_RUNTIME
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Add annotation target" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// "Add annotation target" "false"
|
||||
// WITH_RUNTIME
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ERROR: '@field:' annotations could be applied only to properties with backing fields
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Add annotation target" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Specify type explicitly
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// "Add default constructor to expect class" "false"
|
||||
// ENABLE_MULTIPLATFORM
|
||||
// ACTION: Create subclass
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Remove constructor call
|
||||
// ERROR: This class does not have a constructor
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Add default constructor to expect class" "false"
|
||||
// ACTION: Create subclass
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Remove constructor call
|
||||
// ERROR: This class does not have a constructor
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function 'invoke()' is not found
|
||||
// ACTION: Create extension function 'Some.invoke'
|
||||
// ACTION: Create member function 'Some.invoke'
|
||||
// ACTION: Introduce import alias
|
||||
|
||||
|
||||
package testing
|
||||
|
||||
+1
@@ -3,6 +3,7 @@
|
||||
// ERROR: Destructuring declaration initializer of type Some must have a 'component1()' function
|
||||
// ACTION: Create extension function 'Some.component1'
|
||||
// ACTION: Create member function 'Some.component1'
|
||||
// ACTION: Introduce import alias
|
||||
|
||||
|
||||
package testing
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// "Convert to anonymous object" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Interface I does not have constructors
|
||||
interface I {
|
||||
fun foo(): String
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Create type parameter in class 'X'" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: 2 type arguments expected for class X<T, U>
|
||||
class X<T, U>
|
||||
fun Y(x: X<<caret>String>) {}
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Create type parameter in class 'X'" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: No type arguments expected for class X
|
||||
|
||||
class X
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// "Create property 'address2' as constructor parameter" "false"
|
||||
// ACTION: Create property 'address' as constructor parameter
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make 'Person' data class
|
||||
// ERROR: Destructuring declaration initializer of type Person must have a 'component3()' function
|
||||
// ERROR: Destructuring declaration initializer of type Person must have a 'component4()' function
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Make 'foo' private" "false"
|
||||
// ACTION: Convert receiver to parameter
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make 'Private' protected
|
||||
// ACTION: Make 'Private' public
|
||||
// ERROR: 'protected (in My)' member exposes its 'private' receiver type argument Private
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Make '<init>' internal" "false"
|
||||
// DISABLE-ERRORS
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make 'My' public
|
||||
|
||||
internal class My
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// "Replace with 'New<T, U>'" "false"
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Remove explicit type specification
|
||||
|
||||
@Deprecated("Use New", replaceWith = ReplaceWith("New<T, U>"))
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Replace with 'NewClass'" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Replace usages of 'typealias Old = OldClass' in whole project
|
||||
// ACTION: Replace with 'New'
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// "Replace with 'New'" "false"
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Replace usages of '<init>(): Old /* = OldClass */' in whole project
|
||||
// ACTION: Replace with 'NewClass(12)'
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// "Replace with 'NewClass'" "false"
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Remove explicit type specification
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Replace with 'NewClass'" "false"
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Introduce local variable
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// COMPILER_ARGUMENTS: -version -Xuse-experimental=Something
|
||||
// DISABLE-ERRORS
|
||||
// WITH_RUNTIME
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// ACTION: Add '@MyExperimentalAPI' annotation to containing class 'Inner'
|
||||
// ACTION: Add '@UseExperimental(MyExperimentalAPI::class)' annotation to 'bar'
|
||||
// ACTION: Add '-Xuse-experimental=MyExperimentalAPI' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@UseExperimental(MyExperimentalAPI::class)'
|
||||
|
||||
@Experimental
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Make '<init>' public" "false"
|
||||
// "Make '<init>' internal" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Cannot access '<init>': it is private in 'SealedClass'
|
||||
// ERROR: This type is sealed, so it can be inherited by only its own nested classes or objects
|
||||
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
// ERROR: This type is final, so it cannot be inherited from
|
||||
// ACTION: Add names to call arguments
|
||||
// ACTION: Do not show hints for current method
|
||||
// ACTION: Introduce import alias
|
||||
data class A(val x: Int)
|
||||
class B: A<caret>(42)
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddModifierFix" "false"
|
||||
// ERROR: This type is final, so it cannot be inherited from
|
||||
// ACTION: Create test
|
||||
// ACTION: Introduce import alias
|
||||
class foo : <caret>JavaClass() {}
|
||||
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddModifierFix" "false"
|
||||
// ACTION: Create test
|
||||
// ACTION: Inline type parameter
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Remove final upper bound
|
||||
class foo<T : <caret>JavaClass>() {}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Add 'lateinit' modifier" "false"
|
||||
// ACTION: Add initializer
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make 'a' abstract
|
||||
// ACTION: Move to constructor parameters
|
||||
// ACTION: Move to constructor
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// "Make bar suspend" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Suspend function 'foo' should be called only from a coroutine or another suspend function
|
||||
|
||||
suspend fun foo() {}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Make bar suspend" "false"
|
||||
// ACTION: Convert property initializer to getter
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Suspend function 'foo' should be called only from a coroutine or another suspend function
|
||||
|
||||
suspend fun foo() = 42
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// "Move annotation to receiver type" "false"
|
||||
// ERROR: This annotation is not applicable to target 'declaration' and use site target '@receiver'
|
||||
// ACTION: Make internal
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make private
|
||||
// ACTION: Add annotation target
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// "Move annotation to receiver type" "false"
|
||||
// ERROR: This annotation is not applicable to target 'declaration' and use site target '@receiver'
|
||||
// ACTION: Make internal
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Make private
|
||||
// ACTION: Specify type explicitly
|
||||
// ACTION: Add annotation target
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Optimize imports" "false"
|
||||
// ACTION: Introduce import alias
|
||||
|
||||
import p1.SomeAlias<caret>
|
||||
import p1.AnnAlias
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// "Change type of overriden property 'A.x' to '(Int) -> Int'" "false"
|
||||
// ACTION: Change type to '(String) -> Int'
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Type of 'x' is not a subtype of the overridden property 'public abstract val x: (String) -> Int defined in A'
|
||||
interface A {
|
||||
val x: (String) -> Int
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// "Change 'B.foo' function return type to 'Int'" "false"
|
||||
// "Change 'B.foo' function return type to 'Long'" "false"
|
||||
// "Remove explicitly specified return type" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Return type of 'foo' is not a subtype of the return type of the overridden member 'public abstract fun foo(): Int defined in A'
|
||||
abstract class A {
|
||||
abstract fun foo() : Int;
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Change to constructor invocation" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: This type has a constructor, and thus must be initialized here
|
||||
// ERROR: This type is sealed, so it can be inherited by only its own nested classes or objects
|
||||
sealed class A
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Change to constructor invocation" "false"
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: This type has a constructor, and thus must be initialized here
|
||||
// ERROR: This type is sealed, so it can be inherited by only its own nested classes or objects
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Cast expression 'Foo<Number>()' to 'Foo<Int>'" "false"
|
||||
// ACTION: Change return type of enclosing function 'foo' to 'Foo<Number>'
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Type mismatch: inferred type is Foo<Number> but Foo<Int> was expected
|
||||
class Foo<T>
|
||||
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// "Change type to '(String) -> [ERROR : Ay]'" "false"
|
||||
// ACTION: Change type of base property 'A.x' to '(Int) -> Int'
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Type of 'x' is not a subtype of the overridden property 'public abstract val x: (String) -> [ERROR : Ay] defined in A'
|
||||
// ERROR: Unresolved reference: Ay
|
||||
interface A {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// ACTION: Change parameter 'block' type of function 'str' to 'Object'
|
||||
// ACTION: Create function 'str'
|
||||
// ACTION: Edit method contract of 'Object'
|
||||
// ACTION: Introduce import alias
|
||||
fun fn() {
|
||||
str(<caret>Object())
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Replace array of boxed with array of primitive" "false"
|
||||
// ERROR: Invalid type of annotation member
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Put parameters on one line
|
||||
annotation class SuperAnnotation(
|
||||
val foo: <caret>Array<*>,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// "Replace array of boxed with array of primitive" "false"
|
||||
// ACTION: Put parameters on one line
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Convert to vararg parameter (may break code)
|
||||
annotation class SuperAnnotation(
|
||||
val str: <caret>Array<String>
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// "Change to val" "false"
|
||||
// ACTION: Create extension function 'Delegate.getValue'
|
||||
// ACTION: Create member function 'Delegate.getValue'
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Missing 'getValue(Nothing?, KProperty<*>)' method on delegate of type 'Delegate'
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// "Change to val" "false"
|
||||
// ACTION: Create extension function 'Delegate.getValue', function 'Delegate.setValue'
|
||||
// ACTION: Create member function 'Delegate.getValue', function 'Delegate.setValue'
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Missing 'getValue(Nothing?, KProperty<*>)' method on delegate of type 'Delegate'
|
||||
// ERROR: Missing 'setValue(Nothing?, KProperty<*>, String)' method on delegate of type 'Delegate'
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// "Wrap with '?.let { ... }' call" "false"
|
||||
// WITH_RUNTIME
|
||||
// ACTION: Add non-null asserted (!!) call
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Replace with safe (this?.) call
|
||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?
|
||||
|
||||
Reference in New Issue
Block a user