Don't recognize IrVariable as declaration scope in inlining
#KT-42815 Fixed
This commit is contained in:
committed by
max-kammerer
parent
7f51f57998
commit
c5015c9294
@@ -0,0 +1,21 @@
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun myRun(x: () -> String) = x()
|
||||
|
||||
// FILE: 2.kt
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
class C {
|
||||
val x: String
|
||||
init {
|
||||
val y = myRun { { "OK" }() }
|
||||
x = y
|
||||
}
|
||||
|
||||
constructor(y: Int)
|
||||
constructor(y: String)
|
||||
}
|
||||
|
||||
fun box(): String = C("").x
|
||||
@@ -0,0 +1,30 @@
|
||||
// WITH_RUNTIME
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun myRun( x: () -> String): Lazy<String> {
|
||||
val value2 = x()
|
||||
return object : Lazy<String> {
|
||||
override val value: String
|
||||
get() = value2
|
||||
|
||||
override fun isInitialized(): Boolean = true
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
class C {
|
||||
val x: String
|
||||
init {
|
||||
val y by myRun { { "OK" }() }
|
||||
x = y
|
||||
}
|
||||
|
||||
constructor(y: Int)
|
||||
constructor(y: String)
|
||||
}
|
||||
|
||||
fun box(): String = C("").x
|
||||
Reference in New Issue
Block a user