JVM_IR KT-45103 optimize direct invoke for lambdas and callable refs
This commit is contained in:
committed by
teamcityserver
parent
bfb1a06f3d
commit
851980e36f
+3
-1
@@ -1,12 +1,14 @@
|
||||
// !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField
|
||||
|
||||
fun <T> eval(fn: () -> T) = fn()
|
||||
|
||||
class Outer {
|
||||
private companion object {
|
||||
val result = "OK"
|
||||
}
|
||||
|
||||
class Nested {
|
||||
fun foo() = { result }()
|
||||
fun foo() = eval { result }
|
||||
}
|
||||
|
||||
fun test() = Nested().foo()
|
||||
|
||||
+4
-2
@@ -1,12 +1,14 @@
|
||||
interface T
|
||||
|
||||
fun <T> eval(fn: () -> T) = fn()
|
||||
|
||||
object Foo {
|
||||
private fun foo(p: T) = p
|
||||
|
||||
private val v: Int = {
|
||||
private val v: Int = eval {
|
||||
val x = foo(O)
|
||||
42
|
||||
}()
|
||||
}
|
||||
|
||||
private object O : T
|
||||
|
||||
|
||||
Reference in New Issue
Block a user