ChangeFunctionParameterTypeFix for TYPE_MISMATCH error

This commit is contained in:
Wojciech Lopata
2013-05-08 18:34:13 +02:00
parent b99e46b6f9
commit 44fa32c617
13 changed files with 247 additions and 5 deletions
@@ -0,0 +1,5 @@
// "Change parameter 'x' type of function 'bar.foo' to '(String) -> Int'" "true"
package bar
fun foo(w: Int = 0, x: (String) -> Int, y: Int = 0, z: (Int) -> Int = {42}) {
foo(1, {(a: String) -> 42}<caret>, 1)
}
@@ -0,0 +1,4 @@
// "Change parameter 'y' type of function 'foo' to 'String'" "true"
fun foo(v: Int, w: Int = 0, x: Int = 0, y: String, z: (Int) -> Int = {42}) {
foo(0, 1, y = ""<caret>)
}
@@ -0,0 +1,4 @@
// "Change parameter 'z' type of function 'foo' to '(Int) -> Unit'" "true"
fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> Unit) {
foo(0, 1) {<caret>}
}
@@ -0,0 +1,5 @@
// "Change parameter 'x' type of function 'bar.foo' to '(String) -> Int'" "true"
package bar
fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> Int = {42}) {
foo(1, {(a: String) -> 42}<caret>, 1)
}
@@ -0,0 +1,4 @@
// "Change parameter 'y' type of function 'foo' to 'String'" "true"
fun foo(v: Int, w: Int = 0, x: Int = 0, y: Int, z: (Int) -> Int = {42}) {
foo(0, 1, y = ""<caret>)
}
@@ -0,0 +1,4 @@
// "Change parameter 'z' type of function 'foo' to '(Int) -> Unit'" "true"
fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> String) {
foo(0, 1) {<caret>}
}
@@ -0,0 +1,8 @@
// "Change parameter 'z' type of function 'foo' to '(Int) -> String'" "false"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
fun foo(y: Int = 0, z: (Int) -> String = {""}) {
foo {
""<caret>: Int
""
}
}
@@ -0,0 +1,5 @@
// "Change parameter 'y' type of function 'foo' to 'Int'" "false"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
fun foo(y: Int = 0, z: (Int) -> String = {""}) {
foo(""<caret>: Int)
}