Better texts for quickfixes to change return type

This commit is contained in:
Valentin Kipyatkov
2016-09-20 19:15:05 +03:00
parent 8d67a65ed9
commit dab6f7d13d
86 changed files with 145 additions and 115 deletions
@@ -1,4 +1,4 @@
// "Change 'A.foo' function return type to 'Long'" "true"
// "Change return type of overridden function 'A.foo' to 'Long'" "true"
interface A {
fun foo(): Int
}
@@ -1,4 +1,4 @@
// "Change 'A.foo' function return type to 'Long'" "true"
// "Change return type of overridden function 'A.foo' to 'Long'" "true"
interface A {
fun foo(): Long
}
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Boolean'" "true"
// "Change return type to 'Boolean'" "true"
interface A {
fun foo(): Boolean
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Boolean'" "true"
// "Change return type to 'Boolean'" "true"
interface A {
fun foo(): Boolean
@@ -1,4 +1,4 @@
// "Change 'B.foo' function return type to 'T'" "true"
// "Change return type to 'T'" "true"
open class S {}
open class T : S() {}
@@ -1,4 +1,4 @@
// "Change 'B.foo' function return type to 'T'" "true"
// "Change return type to 'T'" "true"
open class S {}
open class T : S() {}
@@ -1,4 +1,4 @@
// "Change 'B.foo' function return type to 'Int'" "true"
// "Change return type to 'Int'" "true"
abstract class A {
abstract fun foo() : Int;
}
@@ -1,4 +1,4 @@
// "Change 'B.foo' function return type to 'Int'" "true"
// "Change return type to 'Int'" "true"
abstract class A {
abstract fun foo() : Int;
}
@@ -1,4 +1,4 @@
// "Change 'B.foo' function return type to 'Int'" "true"
// "Change return type to 'Int'" "true"
abstract class A {
abstract fun foo() : Int;
}
@@ -1,4 +1,4 @@
// "Change 'B.foo' function return type to 'Int'" "true"
// "Change return type to 'Int'" "true"
abstract class A {
abstract fun foo() : Int;
}
@@ -1,4 +1,4 @@
// "Remove explicitly specified return type in 'A.remove' function" "true"
// "Remove explicitly specified return type" "true"
abstract class A : java.util.Iterator<Int> {
public abstract override fun remove() : Int<caret>;
}
@@ -1,4 +1,4 @@
// "Remove explicitly specified return type in 'A.remove' function" "true"
// "Remove explicitly specified return type" "true"
abstract class A : java.util.Iterator<Int> {
public abstract override fun remove();
}
@@ -1,4 +1,4 @@
// "Change 'bar' function return type to 'A'" "true"
// "Change return type of current function 'bar' to 'A'" "true"
fun foo() {
open class A
@@ -1,4 +1,4 @@
// "Change 'bar' function return type to 'A'" "true"
// "Change return type of current function 'bar' to 'A'" "true"
fun foo() {
open class A
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'T'" "true"
// "Change return type of current function 'foo' to 'T'" "true"
interface T
fun foo() {
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'T'" "true"
// "Change return type of current function 'foo' to 'T'" "true"
interface T
fun foo(): T {
+1 -1
View File
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Any'" "true"
// "Change return type of current function 'foo' to 'Any'" "true"
fun foo() {
class A
+1 -1
View File
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Any'" "true"
// "Change return type of current function 'foo' to 'Any'" "true"
fun foo(): Any {
class A
@@ -1,3 +1,3 @@
// "Change 'bar' function return type to 'String'" "true"
// "Change return type of invoked function 'bar' to 'String'" "true"
fun bar(): Any = ""
fun foo(): String = bar(<caret>)
@@ -1,3 +1,3 @@
// "Change 'bar' function return type to 'String'" "true"
// "Change return type of invoked function 'bar' to 'String'" "true"
fun bar(): String = ""
fun foo(): String = bar(<caret>)
@@ -1,4 +1,4 @@
// "Change 'bar' function return type to 'HashSet<Int>'" "true"
// "Change return type of invoked function 'bar' to 'HashSet<Int>'" "true"
fun bar(): Any = java.util.LinkedHashSet<Int>()
fun foo(): java.util.HashSet<Int> = bar(<caret>)
@@ -1,6 +1,6 @@
import java.util.HashSet
// "Change 'bar' function return type to 'HashSet<Int>'" "true"
// "Change return type of invoked function 'bar' to 'HashSet<Int>'" "true"
fun bar(): HashSet<Int> = java.util.LinkedHashSet<Int>()
fun foo(): java.util.HashSet<Int> = bar()
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int'" "true"
// "Change return type of current function 'foo' to 'Int'" "true"
package foo.bar
fun test() {
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int'" "true"
// "Change return type of current function 'foo' to 'Int'" "true"
package foo.bar
fun test() {
@@ -1,4 +1,4 @@
// "Change 'Companion.foo' function return type to 'Int'" "true"
// "Change return type of current function 'Companion.foo' to 'Int'" "true"
package foo.bar
class A {
@@ -1,4 +1,4 @@
// "Change 'Companion.foo' function return type to 'Int'" "true"
// "Change return type of current function 'Companion.foo' to 'Int'" "true"
package foo.bar
class A {
@@ -1,4 +1,4 @@
// "Change 'A.foo' function return type to 'Int'" "true"
// "Change return type of current function 'A.foo' to 'Int'" "true"
package foo.bar
fun test() {
@@ -1,4 +1,4 @@
// "Change 'A.foo' function return type to 'Int'" "true"
// "Change return type of current function 'A.foo' to 'Int'" "true"
package foo.bar
fun test() {
@@ -1,4 +1,4 @@
// "Change 'B.foo' function return type to 'Int'" "true"
// "Change return type of current function 'B.foo' to 'Int'" "true"
package foo.bar
class A {
@@ -1,4 +1,4 @@
// "Change 'B.foo' function return type to 'Int'" "true"
// "Change return type of current function 'B.foo' to 'Int'" "true"
package foo.bar
class A {
@@ -1,4 +1,4 @@
// "Change 'A.foo' function return type to 'Int'" "true"
// "Change return type of current function 'A.foo' to 'Int'" "true"
package foo.bar
class A {
@@ -1,4 +1,4 @@
// "Change 'A.foo' function return type to 'Int'" "true"
// "Change return type of current function 'A.foo' to 'Int'" "true"
package foo.bar
class A {
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int?'" "true"
// "Change return type of current function 'foo' to 'Int?'" "true"
fun foo(): String {
val n: Int? = 1
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int?'" "true"
// "Change return type of current function 'foo' to 'Int?'" "true"
fun foo(): Int? {
val n: Int? = 1
@@ -1,4 +1,4 @@
// "Remove explicitly specified function return type" "true"
// "Remove explicitly specified return type of current function" "true"
// ERROR: Function declaration must have a name
fun (): Int {
return<caret>
@@ -1,4 +1,4 @@
// "Remove explicitly specified function return type" "true"
// "Remove explicitly specified return type of current function" "true"
// ERROR: Function declaration must have a name
fun () {
return<caret>
@@ -1,4 +1,4 @@
// "Change 'A.hasNext' function return type to 'Boolean'" "true"
// "Change return type of invoked function 'A.hasNext' to 'Boolean'" "true"
abstract class A {
abstract operator fun hasNext
abstract operator fun next(): Int
@@ -1,4 +1,4 @@
// "Change 'A.hasNext' function return type to 'Boolean'" "true"
// "Change return type of invoked function 'A.hasNext' to 'Boolean'" "true"
abstract class A {
abstract operator fun hasNext: Boolean
abstract operator fun next(): Int
@@ -1,4 +1,4 @@
// "Change 'A.compareTo' function return type to 'Int'" "true"
// "Change return type of invoked function 'A.compareTo' to 'Int'" "true"
interface A {
operator fun compareTo(other: Any): String
}
@@ -1,4 +1,4 @@
// "Change 'A.compareTo' function return type to 'Int'" "true"
// "Change return type of invoked function 'A.compareTo' to 'Int'" "true"
interface A {
operator fun compareTo(other: Any): Int
}
@@ -1,4 +1,4 @@
// "Change 'A.component1' function return type to 'Int'" "true"
// "Change return type of invoked function 'A.component1' to 'Int'" "true"
abstract class A {
abstract operator fun component1()
abstract operator fun component2(): Int
@@ -1,4 +1,4 @@
// "Change 'A.component1' function return type to 'Int'" "true"
// "Change return type of invoked function 'A.component1' to 'Int'" "true"
abstract class A {
abstract operator fun component1(): Int
abstract operator fun component2(): Int
@@ -1,4 +1,4 @@
// "Change 'A.component2' function return type to 'Int'" "true"
// "Change return type of invoked function 'A.component2' to 'Int'" "true"
abstract class A {
abstract operator fun component1(): Int
abstract operator fun component2(): String
@@ -1,4 +1,4 @@
// "Change 'A.component2' function return type to 'Int'" "true"
// "Change return type of invoked function 'A.component2' to 'Int'" "true"
abstract class A {
abstract operator fun component1(): Int
abstract operator fun component2(): Int
@@ -1,4 +1,4 @@
// "Remove explicitly specified return type in 'A.component2' function" "true"
// "Remove explicitly specified return type of invoked function 'A.component2'" "true"
abstract class A {
abstract operator fun component1(): Int
abstract operator fun component2(): Int
@@ -1,4 +1,4 @@
// "Remove explicitly specified return type in 'A.component2' function" "true"
// "Remove explicitly specified return type of invoked function 'A.component2'" "true"
abstract class A {
abstract operator fun component1(): Int
abstract operator fun component2()
@@ -1,4 +1,4 @@
// "Change 'A.component2' function return type to 'Unit'" "true"
// "Change return type of invoked function 'A.component2' to 'Unit'" "true"
// ERROR: The integer literal does not conform to the expected type Unit
abstract class A {
abstract operator fun component1(): Int
@@ -1,4 +1,4 @@
// "Change 'A.component2' function return type to 'Unit'" "true"
// "Change return type of invoked function 'A.component2' to 'Unit'" "true"
// ERROR: The integer literal does not conform to the expected type Unit
abstract class A {
abstract operator fun component1(): Int
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int'" "true"
// "Change return type of current function 'foo' to 'Int'" "true"
fun foo(): String {
return <caret>1
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int'" "true"
// "Change return type of current function 'foo' to 'Int'" "true"
fun foo(): Int {
return <caret>1
@@ -1,4 +1,4 @@
// "Change 'A.not' function return type to 'A'" "true"
// "Change return type of invoked function 'A.not' to 'A'" "true"
interface A {
operator fun not(): String
operator fun times(a: A): A
@@ -1,4 +1,4 @@
// "Change 'A.not' function return type to 'A'" "true"
// "Change return type of invoked function 'A.not' to 'A'" "true"
interface A {
operator fun not(): A
operator fun times(a: A): A
@@ -1,4 +1,4 @@
// "Change 'A.plus' function return type to '() -> Int'" "true"
// "Change return type of invoked function 'A.plus' to '() -> Int'" "true"
interface A {
operator fun plus(a: A): String
}
@@ -1,4 +1,4 @@
// "Change 'A.plus' function return type to '() -> Int'" "true"
// "Change return type of invoked function 'A.plus' to '() -> Int'" "true"
interface A {
operator fun plus(a: A): () -> Int
}
@@ -1,4 +1,4 @@
// "Change 'A.hasNext' function return type to 'Boolean'" "true"
// "Change return type of invoked function 'A.hasNext' to 'Boolean'" "true"
abstract class A {
abstract operator fun hasNext(): Int
abstract operator fun next(): Int
@@ -1,4 +1,4 @@
// "Change 'A.hasNext' function return type to 'Boolean'" "true"
// "Change return type of invoked function 'A.hasNext' to 'Boolean'" "true"
abstract class A {
abstract operator fun hasNext(): Boolean
abstract operator fun next(): Int
+1 -1
View File
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'U'" "true"
// "Change return type of current function 'foo' to 'U'" "true"
interface T
interface U
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'U'" "true"
// "Change return type of current function 'foo' to 'U'" "true"
interface T
interface U
+1 -1
View File
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'T'" "true"
// "Change return type of current function 'foo' to 'T'" "true"
interface T
fun foo() {
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'T'" "true"
// "Change return type of current function 'foo' to 'T'" "true"
interface T
fun foo(): T {
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'String?'" "true"
// "Change return type of current function 'foo' to 'String?'" "true"
fun foo(): String {
return <caret>null
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'String?'" "true"
// "Change return type of current function 'foo' to 'String?'" "true"
fun foo(): String? {
return null
@@ -1,3 +1,3 @@
// "Remove explicitly specified return type in 'foo' function" "true"
// "Remove explicitly specified return type of current function 'foo'" "true"
fun foo(): Int {
<caret>}
@@ -1,3 +1,3 @@
// "Remove explicitly specified return type in 'foo' function" "true"
// "Remove explicitly specified return type of current function 'foo'" "true"
fun foo() {
<caret>}
+1 -1
View File
@@ -1,4 +1,4 @@
// "Remove explicitly specified return type in 'foo' function" "true"
// "Remove explicitly specified return type of current function 'foo'" "true"
fun foo(): Int {
return<caret>
}
@@ -1,4 +1,4 @@
// "Remove explicitly specified return type in 'foo' function" "true"
// "Remove explicitly specified return type of current function 'foo'" "true"
fun foo() {
return<caret>
}
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to '(Long) -> Int'" "true"
// "Change return type of current function 'foo' to '(Long) -> Int'" "true"
fun foo(x: Any): Int {
return {x: Long -> 42}<caret>
}
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to '(Long) -> Int'" "true"
// "Change return type of current function 'foo' to '(Long) -> Int'" "true"
fun foo(x: Any): (Long) -> Int {
return {x: Long -> 42}<caret>
}
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to '() -> Any'" "true"
// "Change return type of current function 'foo' to '() -> Any'" "true"
fun foo(x: Any): () -> Int {
return {x<caret>}
}
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to '() -> Any'" "true"
// "Change return type of current function 'foo' to '() -> Any'" "true"
fun foo(x: Any): () -> Any {
return {x<caret>}
}
@@ -1,5 +1,5 @@
// "Change 'AA.f' function return type to 'Boolean'" "false"
// ACTION: Change 'AAA.g' function return type to 'Int'
// "Change return type of invoked function 'AA.f' to 'Boolean'" "false"
// ACTION: Change return type of current function 'AAA.g' to 'Int'
// ACTION: Convert to expression body
// ERROR: Type mismatch: inferred type is Int but Boolean was expected
interface A {
@@ -1,5 +1,5 @@
// "Change 'AA.contains' function return type to 'Int'" "false"
// ACTION: Change 'AAA.g' function return type to 'Boolean'
// "Change return type of invoked function 'AA.contains' to 'Int'" "false"
// ACTION: Change return type of current function 'AAA.g' to 'Boolean'
// ACTION: Convert to expression body
// ACTION: Replace overloaded operator with function call
// ERROR: Type mismatch: inferred type is Boolean but Int was expected
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int'" "true"
// "Change return type of current function 'foo' to 'Int'" "true"
fun foo(n: Int): Boolean {
n.let {
return <caret>1
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int'" "true"
// "Change return type of current function 'foo' to 'Int'" "true"
fun foo(n: Int): Int {
n.let {
return 1
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int'" "true"
// "Change return type of current function 'foo' to 'Int'" "true"
fun foo(n: Int): Boolean {
n.let {
return@foo <caret>1
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'Int'" "true"
// "Change return type of current function 'foo' to 'Int'" "true"
fun foo(n: Int): Int {
n.let {
return@foo 1
@@ -1,4 +1,4 @@
// "Change 'boo' function return type to 'String'" "true"
// "Change return type of current function 'boo' to 'String'" "true"
fun boo(): Int {
return ((if (true) {
val a = ""
@@ -1,4 +1,4 @@
// "Change 'boo' function return type to 'String'" "true"
// "Change return type of current function 'boo' to 'String'" "true"
fun boo(): String {
return ((if (true) {
val a = ""
@@ -1,2 +1,2 @@
// "Change 'foo' function return type to 'String'" "true"
// "Change return type of current function 'foo' to 'String'" "true"
fun foo(): Int = <caret>""
@@ -1,2 +1,2 @@
// "Change 'foo' function return type to 'String'" "true"
fun foo(): String = <caret>""
// "Change return type of current function 'foo' to 'String'" "true"
fun foo(): String = ""
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'String'" "true"
// "Change return type of current function 'foo' to 'String'" "true"
fun foo() {
return ""<caret>
}
@@ -1,4 +1,4 @@
// "Change 'foo' function return type to 'String'" "true"
// "Change return type of current function 'foo' to 'String'" "true"
fun foo(): String {
return ""<caret>
}