FIR CFG: process called-in-place lambdas as loops
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// See also KT-7186 and varCapturedInInlineClosure.kt
|
||||
// Standard library `forEach` calls lambda in-place by contract so smart cast is safe
|
||||
|
||||
fun indexOfMax(a: IntArray): Int? {
|
||||
var maxI: Int? = null
|
||||
a.forEachIndexed { i, value ->
|
||||
if (maxI == null || value >= a[maxI]) {
|
||||
maxI = i
|
||||
}
|
||||
}
|
||||
return maxI
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// KT-7186: False "Type mismatch" error
|
||||
// See also KT-7186 and varCapturedInInlineClosure.kt
|
||||
// Standard library `forEach` calls lambda in-place by contract so smart cast is safe
|
||||
|
||||
fun indexOfMax(a: IntArray): Int? {
|
||||
var maxI: Int? = null
|
||||
|
||||
Reference in New Issue
Block a user