Better behaviour of "Change Type" quickfixes in case of function types

This commit is contained in:
Wojciech Lopata
2013-04-30 19:32:21 +02:00
parent 68d8716ba8
commit 35fa071e1b
16 changed files with 113 additions and 30 deletions
@@ -0,0 +1,7 @@
// "Change 'x' type to '(String) -> Int'" "true"
trait A {
var x: (String) -> Int
}
trait B : A {
override var x: (String) -> Int
}
@@ -0,0 +1,7 @@
// "Change 'x' type to '(String) -> Int'" "true"
trait A {
var x: (String) -> Int
}
trait B : A {
override var x: (Int) -> String<caret>
}
@@ -0,0 +1,5 @@
// "Change getter type to (String) -> Int" "true"
class A {
val x: (String) -> Int
get(): (String) -> Int<caret> = {42}
}
@@ -0,0 +1,5 @@
// "Change getter type to (String) -> Int" "true"
class A {
val x: (String) -> Int
get(): Int<caret> = {42}
}
@@ -0,0 +1,6 @@
// "Change type from 'String' to '(Int) -> String'" "true"
fun foo(f: ((Int) -> String) -> String) {
foo {
(f: (Int) -> String<caret>) -> f(42)
}
}
@@ -0,0 +1,4 @@
// "Change 'foo' function return type to '(Long) -> Int'" "true"
fun foo(x: Any): (Long) -> Int {
return {(x: Long) -> 42}<caret>
}
@@ -0,0 +1,6 @@
// "Change type from 'String' to '(Int) -> String'" "true"
fun foo(f: ((Int) -> String) -> String) {
foo {
(f: String<caret>) -> f(42)
}
}
@@ -0,0 +1,4 @@
// "Change 'foo' function return type to '(Long) -> Int'" "true"
fun foo(x: Any): Int {
return {(x: Long) -> 42}<caret>
}
@@ -0,0 +1,4 @@
// "Cast expression 'x' to '() -> Int'" "true"
fun foo(x: Any): () -> Int {
return x as () -> Int<caret>
}
@@ -0,0 +1,4 @@
// "Cast expression 'x' to '() -> Int'" "true"
fun foo(x: Any): () -> Int {
return x<caret>
}