Better behaviour of "Change Type" quickfixes in case of function types
This commit is contained in:
+7
@@ -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
|
||||
}
|
||||
+7
@@ -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}
|
||||
}
|
||||
+6
@@ -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>
|
||||
}
|
||||
+6
@@ -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>
|
||||
}
|
||||
Reference in New Issue
Block a user