ChangeFunctionReturnTypeFix quickfix

This commit is contained in:
Wojciech Lopata
2013-03-15 23:52:05 +01:00
committed by Andrey Breslav
parent 03f428d833
commit 13022922af
17 changed files with 298 additions and 1 deletions
@@ -0,0 +1,10 @@
// "Change 'A.hasNext' function return type to 'Boolean'" "true"
abstract class A {
abstract fun hasNext: Boolean
abstract fun next(): Int
abstract fun iterator(): A
}
fun test(notRange: A) {
for (i in notRange<caret>) {}
}
@@ -0,0 +1,9 @@
// "Change 'A.component1' function return type to 'Int'" "true"
abstract class A {
abstract fun component1(): Int
abstract fun component2(): Int
}
fun foo(a: A) {
val (w: Int, x: Int) = a<caret>
}
@@ -0,0 +1,9 @@
// "Change 'A.component2' function return type to 'Int'" "true"
abstract class A {
abstract fun component1(): Int
abstract fun component2(): Int
}
fun foo(a: A) {
val (w: Int, x: Int) = a<caret>
}
@@ -0,0 +1,9 @@
// "Remove explicitly specified return type in 'A.component2' function" "true"
abstract class A {
abstract fun component1(): Int
abstract fun component2()
}
fun foo(a: A) {
val (w: Int, x: Unit) = a<caret>
}
@@ -0,0 +1,10 @@
// "Change 'A.component2' function return type to 'Unit'" "true"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Unit</td></tr><tr><td>Found:</td><td>jet.Int</td></tr></table></html>
abstract class A {
abstract fun component1(): Int
fun component2(): Unit = 42
}
fun foo(a: A) {
val (w: Int, x: Unit) = a<caret>
}
@@ -0,0 +1,10 @@
// "Change 'A.hasNext' function return type to 'Boolean'" "true"
abstract class A {
abstract fun hasNext(): Boolean
abstract fun next(): Int
abstract fun iterator(): A
}
fun test(notRange: A) {
for (i in notRange<caret>) {}
}
@@ -0,0 +1,10 @@
// "Change 'A.hasNext' function return type to 'Boolean'" "true"
abstract class A {
abstract fun hasNext
abstract fun next(): Int
abstract fun iterator(): A
}
fun test(notRange: A) {
for (i in notRange<caret>) {}
}
@@ -0,0 +1,9 @@
// "Change 'A.component1' function return type to 'Int'" "true"
abstract class A {
abstract fun component1()
abstract fun component2(): Int
}
fun foo(a: A) {
val (w: Int, x: Int) = a<caret>
}
@@ -0,0 +1,9 @@
// "Change 'A.component2' function return type to 'Int'" "true"
abstract class A {
abstract fun component1(): Int
abstract fun component2(): String
}
fun foo(a: A) {
val (w: Int, x: Int) = a<caret>
}
@@ -0,0 +1,9 @@
// "Remove explicitly specified return type in 'A.component2' function" "true"
abstract class A {
abstract fun component1(): Int
abstract fun component2(): Int
}
fun foo(a: A) {
val (w: Int, x: Unit) = a<caret>
}
@@ -0,0 +1,10 @@
// "Change 'A.component2' function return type to 'Unit'" "true"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Unit</td></tr><tr><td>Found:</td><td>jet.Int</td></tr></table></html>
abstract class A {
abstract fun component1(): Int
fun component2() = 42
}
fun foo(a: A) {
val (w: Int, x: Unit) = a<caret>
}
@@ -0,0 +1,10 @@
// "Change 'A.hasNext' function return type to 'Boolean'" "true"
abstract class A {
abstract fun hasNext(): Int
abstract fun next(): Int
abstract fun iterator(): A
}
fun test(notRange: A) {
for (i in notRange<caret>) {}
}