Extract Function: Allow capturing local function references as lambda parameters
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
// OPTIONS: true, false, false, false, true
|
||||
// PARAM_DESCRIPTOR: local final fun bar(m: kotlin.Int): Int defined in foo
|
||||
// PARAM_DESCRIPTOR: value-parameter val n: kotlin.Int defined in foo
|
||||
// PARAM_TYPES: (kotlin.Int) -> Int
|
||||
// PARAM_TYPES: kotlin.Int
|
||||
fun foo(n: Int): Int {
|
||||
fun bar(m: Int) = m * n
|
||||
|
||||
return i(::bar, n)
|
||||
}
|
||||
|
||||
private fun i(bar: (Int) -> Int, n: Int) = bar(n + 1)
|
||||
Reference in New Issue
Block a user