Fix a bunch of IDE quick-fix tests (related to "convert to run/...")
These actions became available more often some days ago
This commit is contained in:
+2
@@ -4,6 +4,8 @@
|
||||
// ACTION: Add parameter to function 'foo'
|
||||
// ACTION: Create extension function 'X.foo'
|
||||
// ACTION: Create member function 'X.foo'
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
|
||||
package main
|
||||
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.ImportFix" "false"
|
||||
// ACTION: Rename reference
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: externalFun
|
||||
|
||||
package testing
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// ACTION: Convert property initializer to getter
|
||||
// ACTION: Create class 'SomeTest'
|
||||
// ACTION: Rename reference
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: SomeTest
|
||||
|
||||
package testing
|
||||
|
||||
Vendored
+2
@@ -1,6 +1,8 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create extension function 'Int.Foo'
|
||||
// ACTION: Rename reference
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: Foo
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
Vendored
+2
@@ -1,6 +1,8 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create extension function 'List<T>.Foo'
|
||||
// ACTION: Rename reference
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: Foo
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
Vendored
+2
@@ -3,6 +3,8 @@
|
||||
// ACTION: Create member function 'B.foo'
|
||||
// ACTION: Rename reference
|
||||
// ACTION: Add 'b =' to argument
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: foo
|
||||
abstract class A {
|
||||
fun bar(b: Boolean) {}
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
// "Create member function 'foo'" "false"
|
||||
// ACTION: Rename reference
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
// "Create member function 'foo'" "false"
|
||||
// ACTION: Create extension function 'A.foo'
|
||||
// ACTION: Rename reference
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int {
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
// "Create member function 'foo'" "false"
|
||||
// ACTION: Add names to call arguments
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: x
|
||||
|
||||
class A<T>(val n: T) {
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
// "Create member function 'bar'" "false"
|
||||
// ACTION: Create extension function 'T.bar'
|
||||
// ACTION: Rename reference
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: bar
|
||||
fun <T> foo(t: T) {
|
||||
t.<caret>bar()
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// ACTION: Create extension function 'A<Int>.bar'
|
||||
// ACTION: Create member function 'A.bar'
|
||||
// ACTION: Rename reference
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Unresolved reference: bar
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.replaceWith.DeprecatedSymbolUsageFix" "false"
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ACTION: Convert to also
|
||||
// ACTION: Convert to apply
|
||||
|
||||
fun foo() {
|
||||
val c = JavaClass()
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
// ACTION: Add '@MyExperimentalAPI' annotation to containing class 'Bar'
|
||||
// ACTION: Add '@UseExperimental(MyExperimentalAPI::class)' annotation to 'bar'
|
||||
// ACTION: Add '-Xuse-experimental=MyExperimentalAPI' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@UseExperimental(MyExperimentalAPI::class)'
|
||||
// ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@UseExperimental(MyExperimentalAPI::class)'
|
||||
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
// "Make 'doSth' protected" "false"
|
||||
// ACTION: Make 'doSth' public
|
||||
// ACTION: Make 'doSth' internal
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Cannot access 'doSth': it is private in 'A'
|
||||
|
||||
class A {
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// ACTION: Convert property initializer to getter
|
||||
// ACTION: Add names to call arguments
|
||||
// ACTION: Move to constructor
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Cannot access 'bar': it is private in 'First'
|
||||
|
||||
private data class Data(val x: Int)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Wrap with '?.let { ... }' call
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Reference has a nullable type '(String.() -> Unit)?', use explicit '?.invoke()' to make a function-like call instead
|
||||
|
||||
fun foo(exec: (String.() -> Unit)?) = "".exec<caret>()
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
// "Remove single lambda parameter declaration" "false"
|
||||
// ACTION: Remove explicit lambda parameter types (may break code)
|
||||
// ACTION: Rename to _
|
||||
// ACTION: Convert to also
|
||||
// ACTION: Convert to apply
|
||||
fun test() {
|
||||
val f = { <caret>i: Int -> foo() }
|
||||
bar(f)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Add non-null asserted (!!) call
|
||||
// ACTION: Replace with safe (?.) call
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
||||
|
||||
fun foo(arg: Int?) {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Replace with safe (?.) call
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
||||
|
||||
fun foo(arg: Int?) = arg<caret>.hashCode()
|
||||
@@ -1,6 +1,8 @@
|
||||
// "Surround with null check" "false"
|
||||
// ACTION: Add non-null asserted (!!) call
|
||||
// ACTION: Replace with safe (?.) call
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?
|
||||
|
||||
fun foo(s: String?) {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Replace with safe (?.) call
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?
|
||||
|
||||
class My(val x: String?) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Add non-null asserted (!!) call
|
||||
// ACTION: Replace with safe (?.) call
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
||||
|
||||
class My(var x: Int?) {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
// ACTION: Create function 'join'
|
||||
// ACTION: Flip ','
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Convert to also
|
||||
// ACTION: Convert to apply
|
||||
// ACTION: Put arguments on separate lines
|
||||
|
||||
//this test checks that there is no ArrayIndexOutOfBoundsException when there are more arguments than parameters
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Change to property access" "false"
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Expression 'fd' of type 'String' cannot be invoked as a function. The function 'invoke()' is not found
|
||||
class A(val fd: String)
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// ACTION: Add non-null asserted (!!) call
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Replace with safe (?.) call
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
||||
|
||||
fun foo(arg: Int?) {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Introduce local variable
|
||||
// ACTION: Replace with safe (?.) call
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
||||
|
||||
fun Int.bar() = this
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// WITH_RUNTIME
|
||||
// ACTION: Add non-null asserted (!!) call
|
||||
// ACTION: Replace with safe (?.) call
|
||||
// ACTION: Convert to run
|
||||
// ACTION: Convert to with
|
||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
||||
|
||||
fun Int.bar() {}
|
||||
|
||||
Reference in New Issue
Block a user