KT-33211 Quickfix "add parameter" for method references should infer functional type instead of KFunction (#2664)
* "Add parameter to function" quick fix: add function type instead of KFunction for method references #KT-33211 Fixed * Support suspend function references
This commit is contained in:
committed by
GitHub
parent
6e67e1e78d
commit
4d2caa8e76
+6
@@ -0,0 +1,6 @@
|
||||
// "Add parameter to function 'baz'" "true"
|
||||
fun baz() {}
|
||||
|
||||
fun foo() {
|
||||
baz(fun(i: Int): String { return i.toString() }<caret>)
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Add parameter to function 'baz'" "true"
|
||||
fun baz(function: (Int) -> String) {}
|
||||
|
||||
fun foo() {
|
||||
baz(fun(i: Int): String { return i.toString() }<caret>)
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Add parameter to function 'baz'" "true"
|
||||
fun bar(): Int = 42
|
||||
|
||||
fun baz() {}
|
||||
|
||||
fun foo() {
|
||||
baz(::bar<caret>)
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Add parameter to function 'baz'" "true"
|
||||
fun bar(): Int = 42
|
||||
|
||||
fun baz(kFunction0: () -> Int) {}
|
||||
|
||||
fun foo() {
|
||||
baz(::bar)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Add parameter to function 'baz'" "true"
|
||||
fun baz() {}
|
||||
|
||||
fun foo() {
|
||||
baz { i: Int -> i.toString() }<caret>
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Add parameter to function 'baz'" "true"
|
||||
fun baz(function: (Int) -> String) {}
|
||||
|
||||
fun foo() {
|
||||
baz { i: Int -> i.toString() }<caret>
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Add parameter to function 'baz'" "true"
|
||||
suspend fun bar(): Int = 42
|
||||
|
||||
suspend fun baz() {}
|
||||
|
||||
suspend fun foo() {
|
||||
baz(::bar<caret>)
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// "Add parameter to function 'baz'" "true"
|
||||
suspend fun bar(): Int = 42
|
||||
|
||||
suspend fun baz(kSuspendFunction0: suspend () -> Int) {}
|
||||
|
||||
suspend fun foo() {
|
||||
baz(::bar)
|
||||
}
|
||||
Reference in New Issue
Block a user