Anonymous function to lambda: add lambda parameter if type parameter is used, even if parameter is unused

#KT-39393 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-06-05 10:47:42 +09:00
committed by igoriakovlev
parent 311b2d7969
commit e4a1c8dcef
8 changed files with 70 additions and 9 deletions
@@ -0,0 +1,6 @@
fun <T> foo(fn: (T) -> Unit) {}
fun test() {
foo(<caret>fun(x: String) {
})
}
@@ -0,0 +1,5 @@
fun <T> foo(fn: (T) -> Unit) {}
fun test() {
foo { x: String -> }
}
@@ -0,0 +1,6 @@
fun <T> foo(fn: (String) -> T) {}
fun test() {
foo(<caret>fun(x: String) {
})
}
@@ -0,0 +1,5 @@
fun <T> foo(fn: (String) -> T) {}
fun test() {
foo { }
}
@@ -0,0 +1,9 @@
fun foo(p: String) {}
fun <T> bar(vararg fn: (T) -> Unit) {}
fun test() {
bar(<caret>fun(x: String) {
foo(x)
})
}
@@ -0,0 +1,7 @@
fun foo(p: String) {}
fun <T> bar(vararg fn: (T) -> Unit) {}
fun test() {
bar({ x: String -> foo(x) })
}