diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt index 414653539b8..c2e0df9280d 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt @@ -87,7 +87,7 @@ fun box(): String { suspendHere() result = "OK" } - }() + }.let { it() } } return "OK" diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt index 1cd923b36d9..8e57b32c1b0 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt @@ -86,7 +86,7 @@ fun box(): String { result = "OK" } } - } () + }.let { it() } return "OK" } diff --git a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit/override5.kt b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit/override5.kt index bd7f2e67b03..45520135302 100644 --- a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit/override5.kt +++ b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit/override5.kt @@ -18,7 +18,7 @@ interface Base { inline fun inlineMe(crossinline c: suspend () -> Unit) = object : Base { override suspend fun generic(): Unit { c(); - {}() + {}.let { it() } } } diff --git a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/kt42253.kt b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/kt42253.kt index 1f4bb05cdaa..5a4e8b47055 100644 --- a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/kt42253.kt +++ b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/kt42253.kt @@ -10,7 +10,7 @@ object C { inline fun inlineFun() = { val O by "K" O - }() + }.let { it() } } fun box(): String = ForceOutOfOrder.callInline() diff --git a/compiler/testData/codegen/box/reflection/properties/localDelegated/inLambdaInInline.kt b/compiler/testData/codegen/box/reflection/properties/localDelegated/inLambdaInInline.kt index ea2bb60aa89..f04ffc79070 100644 --- a/compiler/testData/codegen/box/reflection/properties/localDelegated/inLambdaInInline.kt +++ b/compiler/testData/codegen/box/reflection/properties/localDelegated/inLambdaInInline.kt @@ -12,7 +12,7 @@ inline operator fun String.getValue(t:Any?, p: KProperty<*>): String = inline fun foo(crossinline f: () -> String) = { val x by f() x -}() +}.let { it() } // FILE: 2.kt import test.* diff --git a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt index 0d83d5346c3..aa827afccb7 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt @@ -4,7 +4,7 @@ package test inline fun bar(crossinline y: () -> String) = { - { { call(y) }() }() + { { call(y) }.let { it() } }.let { it() } } public inline fun call(f: () -> T): T = f() diff --git a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt index db1605835d3..e99f2187daa 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt @@ -4,10 +4,10 @@ package test inline fun bar(crossinline y: () -> String) = { - { { call(y) }() }() + { { call(y) }.let { it() } }.let { it() } } -public inline fun call(crossinline f: () -> T): T = {{ f() }()}() +public inline fun call(crossinline f: () -> T): T = {{ f() }.let { it() }}.let { it() } // FILE: 2.kt @@ -20,5 +20,5 @@ fun box(): String { } inline fun bar2(crossinline y: () -> String) = { - { { call(y) }() }() + { { call(y) }.let { it() } }.let { it() } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInConstLambda.kt b/compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInConstLambda.kt index a1bd16a0116..a0a051eaa1e 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInConstLambda.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInConstLambda.kt @@ -6,7 +6,7 @@ internal class A { inline fun doSomething(): String { return { "OK" - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInLambda.kt b/compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInLambda.kt index e31ce7b1575..36764b690d2 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInLambda.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInLambda.kt @@ -6,7 +6,7 @@ internal class A { inline fun doSomething(s: String): String { return { s - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt13133.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt13133.kt index 43705f544cf..3b2ad4c56df 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt13133.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt13133.kt @@ -5,11 +5,13 @@ package test inline fun inf(crossinline cif: Any.() -> String): () -> String { - return { + // Approximate the types manually to avoid running into KT-30696 + val factory: () -> () -> String = { object : () -> String { override fun invoke() = cif() } - }() + } + return factory() } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt13182.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt13182.kt index 012d6a2ae86..6790b6af290 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt13182.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt13182.kt @@ -4,7 +4,7 @@ package test inline fun test(cond: Boolean, crossinline cif: () -> String): String { return if (cond) { - { cif() }() + { cif() }.let { it() } } else { cif() @@ -19,6 +19,6 @@ fun box(): String { return test(true) { { s - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt14011.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt14011.kt index c3998dbd9e3..f3b5bac2627 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt14011.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt14011.kt @@ -3,7 +3,7 @@ package test inline fun inline1(crossinline action: () -> Unit) { action(); - { action() }() + { action() }.let { it() } } inline fun inline2(crossinline action: () -> Unit) = { action() } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt14011_3.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt14011_3.kt index f9ffa64c370..8cd3678e738 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt14011_3.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt14011_3.kt @@ -17,7 +17,7 @@ import test.* var result = "fail" fun box(): String { inline1 { - inline2 { { result ="OK" }() }() + inline2 { { result ="OK" }.let { it() } }() } return result diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt19399.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt19399.kt index c2410c592f6..5dcebdf7e60 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt19399.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt19399.kt @@ -26,7 +26,7 @@ class Foo { ifNotBusyPerform { ifNotBusySayHello() } - }() + }.let { it() } } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt index a515aefe61e..ccbe1e6ffe1 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt42815.kt @@ -10,7 +10,7 @@ import test.* class C { val x: String init { - val y = myRun { { "OK" }() } + val y = myRun { { "OK" }.let { it() } } x = y } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt index ad5a8ceefc1..ffa329d3d90 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt @@ -19,7 +19,7 @@ import test.* class C { val x: String init { - val y by myRun { { "OK" }() } + val y by myRun { { "OK" }.let { it() } } x = y } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt9877.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt9877.kt index 97ea11fc598..ef756b8ff97 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt9877.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt9877.kt @@ -27,7 +27,7 @@ fun box(): String { { locusMap = value gene = "OK" - }() + }.let { it() } } } return gene diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt9877_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt9877_2.kt index 74159b48cb9..4ff0cb417c7 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt9877_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt9877_2.kt @@ -20,7 +20,7 @@ fun box(): String { { value gene = "OK" - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/inlineChain.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/inlineChain.kt index ff2504b3164..9244805eefc 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/inlineChain.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/inlineChain.kt @@ -15,7 +15,7 @@ inline fun testNested(crossinline f: (String) -> Unit) { } inline fun test(crossinline f: (String) -> Unit) { - testNested { it -> { f(it) }()} + testNested { it -> { f(it) }.let { it() } } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain.kt index 317e87c1467..a445d58b475 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain.kt @@ -20,10 +20,10 @@ fun box(): String { { { result = param + c + a - }() - }() + }.let { it() } + }.let { it() } } - }() + }.let { it() } } return if (result == "start12") "OK" else "fail: $result" diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChainSimple.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChainSimple.kt index 8cba9323d98..6c6d7de18ed 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChainSimple.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChainSimple.kt @@ -5,7 +5,7 @@ package test inline fun inlineFun(arg: T, crossinline f: (T) -> Unit) { { f(arg) - }() + }.let { it() } } // FILE: 2.kt @@ -19,7 +19,7 @@ fun box(): String { inlineFun("2") { a -> { result = param + a - }() + }.let { it() } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_2.kt index b746026fa96..de70a08a278 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_2.kt @@ -5,7 +5,7 @@ package test inline fun inlineFun(arg: T, crossinline f: (T) -> Unit) { { f(arg) - }() + }.let { it() } } // FILE: 2.kt @@ -21,10 +21,10 @@ fun box(): String { { { result = param + c + a - }() - }() + }.let { it() } + }.let { it() } } - }() + }.let { it() } } return if (result == "start12") "OK" else "fail: $result" diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_3.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_3.kt index a65c88f9e09..3f288a410ac 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_3.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_3.kt @@ -5,7 +5,7 @@ package test inline fun inlineFun(arg: T, crossinline f: (T) -> Unit) { { f(arg) - }() + }.let { it() } } // FILE: 2.kt @@ -20,9 +20,9 @@ fun box(): String { inlineFun("2") { a -> { result = param + c + a - }() + }.let { it() } } - }() + }.let { it() } } return if (result == "start12") "OK" else "fail: $result" diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/noInlineLambda.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/noInlineLambda.kt index 8aa242bb0fd..fd645be493f 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/noInlineLambda.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/noInlineLambda.kt @@ -15,7 +15,7 @@ inline fun testNested(crossinline f: (String) -> Unit) { } fun test(f: (String) -> Unit) { - testNested { it -> { f(it) }()} + testNested { it -> { f(it) }.let { it() } } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlineChain.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlineChain.kt index 324fa7fb4b2..e81905e89cc 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlineChain.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlineChain.kt @@ -17,7 +17,7 @@ class B(val o: String, val k: String) { } inline fun test(crossinline f: (String) -> Unit) { - testNested { it -> { f(it + k) }() } + testNested { it -> { f(it + k) }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlinelambdaChain.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlinelambdaChain.kt index 99175772043..d9bf2bbb2ec 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlinelambdaChain.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlinelambdaChain.kt @@ -11,7 +11,7 @@ class A { inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { { f(arg + addParam) - }() + }.let { it() } } fun box(): String { @@ -21,12 +21,12 @@ class A { { { result = param + c + a - }() - }() + }.let { it() } + }.let { it() } } } - }() + }.let { it() } return if (result == "start1_additional_2_additional_") "OK" else "fail: $result" } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain.kt index fd2de6c7348..acaeb1a15e0 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain.kt @@ -19,10 +19,10 @@ class A { { { result = param + c + a - }() - }() + }.let { it() } + }.let { it() } } - }() + }.let { it() } } return if (result == "start1_additional_2_additional_") "OK" else "fail: $result" diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple.kt index 805e2f35db2..2cc562f550e 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple.kt @@ -11,7 +11,7 @@ class A { inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { { f(arg + addParam) - }() + }.let { it() } } @@ -19,7 +19,7 @@ class A { inlineFun("2") { a -> { result = param + a - }() + }.let { it() } } return if (result == "start2_additional_") "OK" else "fail: $result" } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple_2.kt index 5b10abfcb76..b2e1f2ba603 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple_2.kt @@ -11,7 +11,7 @@ class A { inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { { f(arg + addParam) - }() + }.let { it() } } @@ -20,9 +20,9 @@ class A { inlineFun("2") { a -> { result = param + a - }() + }.let { it() } } - }() + }.let { it() } return if (result == "start2_additional_") "OK" else "fail: $result" } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_2.kt index b71f39b14dc..dde7c69a80d 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_2.kt @@ -11,7 +11,7 @@ class A { inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { { f(arg + addParam) - }() + }.let { it() } } fun box(): String { @@ -21,10 +21,10 @@ class A { { { result = param + c + a - }() - }() + }.let { it() } + }.let { it() } } - }() + }.let { it() } } return if (result == "start1_additional_2_additional_") "OK" else "fail: $result" diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_3.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_3.kt index 1c9b689beb6..4f6919dfe91 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_3.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_3.kt @@ -11,7 +11,7 @@ class A { inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { { f(arg + addParam) - }() + }.let { it() } } fun box(): String { @@ -20,9 +20,9 @@ class A { inlineFun("2") { a -> { result = param + c + a - }() + }.let { it() } } - }() + }.let { it() } } return if (result == "start1_additional_2_additional_") "OK" else "fail: $result" diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noCapturedThisOnCallSite.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noCapturedThisOnCallSite.kt index 867a8a040bb..0277d48b169 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noCapturedThisOnCallSite.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noCapturedThisOnCallSite.kt @@ -17,7 +17,7 @@ class B(val o: String, val k: String) { } inline fun test(crossinline f: (String) -> Unit) { - testNested { it -> { f(it + "K") }() } + testNested { it -> { f(it + "K") }.let { it() } } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noInlineLambda.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noInlineLambda.kt index 72c687a32c5..667bd6d4b01 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noInlineLambda.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noInlineLambda.kt @@ -18,7 +18,7 @@ class B(val o: String, val k: String) { } fun test(f: (String) -> Unit) { - testNested { it -> { f(it + k) }() } + testNested { it -> { f(it + k) }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex.kt index 2459a2f67e6..ba09b1e3ba0 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex.kt @@ -20,8 +20,8 @@ class B(val o: String, val k: String) { inline fun test(crossinline f: (String) -> Unit) { call { { - testNested ({ it -> { f(it + o) }() }) { it -> { f(it + k) }() } - }() + testNested ({ it -> { f(it + o) }.let { it() } }) { it -> { f(it + k) }.let { it() } } + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex_2.kt index 472657d058b..0f44e5fcf3b 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex_2.kt @@ -21,8 +21,8 @@ class B(val o: String, val k: String) { call { f("start"); { - testNested ({ it -> { f(it + o) }() }) { it -> { f(it + k) }() } - }() + testNested ({ it -> { f(it + o) }.let { it() } }) { it -> { f(it + k) }.let { it() } } + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/safeCall.kt b/compiler/testData/codegen/boxInline/anonymousObject/safeCall.kt index 761baaab332..4b61c751c45 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/safeCall.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/safeCall.kt @@ -7,7 +7,7 @@ class W(val value: Any) inline fun W.safe(crossinline body : Any.() -> Unit) { { this.value?.body() - }() + }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt index ed67f8175f0..e1a1882770c 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt @@ -7,7 +7,7 @@ class W(val value: Any) inline fun W.safe(crossinline body : Any.() -> Unit) { { this.value?.body() - }() + }.let { it() } } // FILE: 2.kt @@ -19,7 +19,7 @@ fun box(): String { W("OK").safe { { result = this as String - }() + }.let { it() } } return result diff --git a/compiler/testData/codegen/boxInline/anonymousObject/sam/kt17091.kt b/compiler/testData/codegen/boxInline/anonymousObject/sam/kt17091.kt index 6db6c12e32b..bcdd531330a 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/sam/kt17091.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/sam/kt17091.kt @@ -6,7 +6,7 @@ package test inline fun foo(value: String, crossinline s: () -> String): String { val x = { value } - return java.util.concurrent.Callable(x).call() + { s() }() + return java.util.concurrent.Callable(x).call() + { s() }.let { it() } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/sam/kt21671_3.kt b/compiler/testData/codegen/boxInline/anonymousObject/sam/kt21671_3.kt index 915f31f1570..12fd8dc5662 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/sam/kt21671_3.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/sam/kt21671_3.kt @@ -6,7 +6,7 @@ package test import java.util.concurrent.Executors inline fun doWork(noinline job: ()-> Unit) { - { Executors.callable(job).call() } () + { Executors.callable(job).call() }.let { it() } Executors.callable(job).call() } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/sam/kt22304.kt b/compiler/testData/codegen/boxInline/anonymousObject/sam/kt22304.kt index 84b94ee69ad..434619d37bf 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/sam/kt22304.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/sam/kt22304.kt @@ -10,7 +10,7 @@ fun test(): String = "" inline fun String.switchMapOnce(crossinline mapper: (String) -> String): String { Callable(::test) - return { mapper(this) }() + return { mapper(this) }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt b/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt index fc112e9a37d..1a39eb77aba 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt @@ -18,7 +18,7 @@ class A { inline fun test(crossinline l: () -> String): String { return { l() + callK() - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_nested.kt b/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_nested.kt index 7c6b9c68918..22876a04385 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_nested.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_nested.kt @@ -5,7 +5,7 @@ class C(val x: String) { fun f(y: String) = C(y).g { x } inline fun g(crossinline h: () -> String) = - { { h() + x }() }() + { { h() + x }.let { it() } }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_nested_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_nested_2.kt index 2cf776c3eed..8d1554ed31f 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_nested_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_nested_2.kt @@ -5,7 +5,7 @@ class C(val x: String) { inline fun f(crossinline h: () -> String) = C("").g { x + h() } inline fun g(crossinline h: () -> String) = - { { h() + x }() }() + { { h() + x }.let { it() } }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/argumentOrder/captured.kt b/compiler/testData/codegen/boxInline/argumentOrder/captured.kt index 0388cd57054..31ec8a6597d 100644 --- a/compiler/testData/codegen/boxInline/argumentOrder/captured.kt +++ b/compiler/testData/codegen/boxInline/argumentOrder/captured.kt @@ -3,7 +3,7 @@ package test inline fun test(a: Int, b: Long, crossinline c: () -> String): String { - return { "${a}_${b}_${c()}"} () + return { "${a}_${b}_${c()}" }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/argumentOrder/capturedInExtension.kt b/compiler/testData/codegen/boxInline/argumentOrder/capturedInExtension.kt index 2d4c61f4d5d..c5f9e3a7843 100644 --- a/compiler/testData/codegen/boxInline/argumentOrder/capturedInExtension.kt +++ b/compiler/testData/codegen/boxInline/argumentOrder/capturedInExtension.kt @@ -3,8 +3,7 @@ package test inline fun Double.test(a: Int, b: Long, crossinline c: () -> String): String { - - return { "${this}_${a}_${b}_${c()}"} () + return { "${this}_${a}_${b}_${c()}" }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/callableReference/kt15449.kt b/compiler/testData/codegen/boxInline/callableReference/kt15449.kt index 9dc7865787b..e109965e037 100644 --- a/compiler/testData/codegen/boxInline/callableReference/kt15449.kt +++ b/compiler/testData/codegen/boxInline/callableReference/kt15449.kt @@ -24,7 +24,7 @@ class A { apply2 { this@linearLayout2::calc }() - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/complex/with.kt b/compiler/testData/codegen/boxInline/complex/with.kt index 757747ff928..24c6f73f2d2 100644 --- a/compiler/testData/codegen/boxInline/complex/with.kt +++ b/compiler/testData/codegen/boxInline/complex/with.kt @@ -31,7 +31,7 @@ public fun Input.copyTo(output: Output, size: Int): Long { } -public inline fun with2(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}() +public inline fun with2(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}.let { it() } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/complexStack/asCheck2.kt b/compiler/testData/codegen/boxInline/complexStack/asCheck2.kt index 18a0bd3273d..ce91725bcc9 100644 --- a/compiler/testData/codegen/boxInline/complexStack/asCheck2.kt +++ b/compiler/testData/codegen/boxInline/complexStack/asCheck2.kt @@ -7,7 +7,7 @@ object ContentTypeByExtension { { val ext = B("OK") operation(ext.toLowerCase()) - }() + }.let { it() } } diff --git a/compiler/testData/codegen/boxInline/contracts/crossinlineCallableReference.kt b/compiler/testData/codegen/boxInline/contracts/crossinlineCallableReference.kt index dc3a129ba3d..f0380117e30 100644 --- a/compiler/testData/codegen/boxInline/contracts/crossinlineCallableReference.kt +++ b/compiler/testData/codegen/boxInline/contracts/crossinlineCallableReference.kt @@ -21,7 +21,7 @@ inline fun vBox(crossinline action: () -> Unit) { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } - return { action() }() + return { action() }.let { it() } } inline fun button(onAction: () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/contracts/exactlyOnceCrossinline2.kt b/compiler/testData/codegen/boxInline/contracts/exactlyOnceCrossinline2.kt index 73c78c95499..58bb66169e5 100644 --- a/compiler/testData/codegen/boxInline/contracts/exactlyOnceCrossinline2.kt +++ b/compiler/testData/codegen/boxInline/contracts/exactlyOnceCrossinline2.kt @@ -26,7 +26,7 @@ inline fun baz(crossinline exactly_once: () -> Unit) { callsInPlace(exactly_once, InvocationKind.EXACTLY_ONCE) }; - { exactly_once() }() + { exactly_once() }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/contracts/valInitializationAndUsageInNestedLambda.kt b/compiler/testData/codegen/boxInline/contracts/valInitializationAndUsageInNestedLambda.kt index 68a634d2a0a..c38443f925f 100644 --- a/compiler/testData/codegen/boxInline/contracts/valInitializationAndUsageInNestedLambda.kt +++ b/compiler/testData/codegen/boxInline/contracts/valInitializationAndUsageInNestedLambda.kt @@ -25,7 +25,7 @@ fun box(): String { x = 42 { x - }() + }.let { it() } } return if (res == 42 && x.inc() == 43) "OK" else "Fail: ${x.inc()}" } diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt index fa7546a6ec0..48035c5200b 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt @@ -5,7 +5,7 @@ package test inline fun String.inlineFun(crossinline lambda: () -> String = { this }): String { return { this + lambda() - }() + }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt index 010f23532a5..52c1928c055 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt @@ -5,7 +5,7 @@ package test inline fun String.inlineFun(crossinline lambda: () -> String, crossinline dlambda: () -> String = { this }): String { return { "${this} ${lambda()} ${dlambda()}" - }() + }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt index 2dd9da0bb30..d0ef379989d 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt @@ -8,7 +8,7 @@ class A(val value: String) { inline fun String.inlineFun(crossinline lambda: () -> String = { this }): String { return { "$value ${this} ${lambda()}" - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt index dc997cf42f7..c231ed444a3 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt @@ -7,7 +7,7 @@ class A(val value: String) { inline fun String.inlineFun(crossinline lambda: () -> String, crossinline dlambda: () -> String = { this }): String { return { "$value ${this} ${lambda()} ${dlambda()}" - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt index 7dc67f06c84..6a4fcea95f5 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt @@ -6,8 +6,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String = { { this }() }): return { { this + lambda() - }() - }() + }.let { it() } + }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt index dd75a5131da..70a7e0ec0fd 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt @@ -8,8 +8,8 @@ class A(val value: String) { return { { this + lambda() - }() - }() + }.let { it() } + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/delegatedProperty/localDeclaredInLambda.kt b/compiler/testData/codegen/boxInline/delegatedProperty/localDeclaredInLambda.kt index bf82f109b31..f5b26d2fcc1 100644 --- a/compiler/testData/codegen/boxInline/delegatedProperty/localDeclaredInLambda.kt +++ b/compiler/testData/codegen/boxInline/delegatedProperty/localDeclaredInLambda.kt @@ -10,7 +10,7 @@ object C { inline fun inlineFun() = { val O by "K" O - }() + }.let { it() } } // FILE: box.kt diff --git a/compiler/testData/codegen/boxInline/enclosingInfo/inlineChain2.kt b/compiler/testData/codegen/boxInline/enclosingInfo/inlineChain2.kt index dcd7ee68837..a50afda6b44 100644 --- a/compiler/testData/codegen/boxInline/enclosingInfo/inlineChain2.kt +++ b/compiler/testData/codegen/boxInline/enclosingInfo/inlineChain2.kt @@ -4,7 +4,7 @@ package test -inline fun call(crossinline s: () -> R) = { s() }() +inline fun call(crossinline s: () -> R) = { s() }.let { it() } inline fun test(crossinline z: () -> String) = { z() } diff --git a/compiler/testData/codegen/boxInline/enum/kt18254.kt b/compiler/testData/codegen/boxInline/enum/kt18254.kt index 5d8d2851ed0..61908213453 100644 --- a/compiler/testData/codegen/boxInline/enum/kt18254.kt +++ b/compiler/testData/codegen/boxInline/enum/kt18254.kt @@ -14,5 +14,5 @@ enum class Z { import test.* fun box(): String { - return { enumValueOf("OK").name } () + return { enumValueOf("OK").name }.let { it() } } diff --git a/compiler/testData/codegen/boxInline/enum/valueOfCapturedType.kt b/compiler/testData/codegen/boxInline/enum/valueOfCapturedType.kt index 963673a35a4..d9627731f3d 100644 --- a/compiler/testData/codegen/boxInline/enum/valueOfCapturedType.kt +++ b/compiler/testData/codegen/boxInline/enum/valueOfCapturedType.kt @@ -4,7 +4,7 @@ package test inline fun > myValueOf(): String { - return { enumValueOf("OK") }().name + return { enumValueOf("OK") }.let { it() }.name } enum class Z { diff --git a/compiler/testData/codegen/boxInline/enum/valueOfChainCapturedType.kt b/compiler/testData/codegen/boxInline/enum/valueOfChainCapturedType.kt index e2a20c7c902..12d3ca9845b 100644 --- a/compiler/testData/codegen/boxInline/enum/valueOfChainCapturedType.kt +++ b/compiler/testData/codegen/boxInline/enum/valueOfChainCapturedType.kt @@ -8,7 +8,7 @@ inline fun > myValueOf(): String { } inline fun > myValueOf2(): String { - return { enumValueOf("OK").name }() + return { enumValueOf("OK").name }.let { it() } } diff --git a/compiler/testData/codegen/boxInline/enum/valuesCapturedType.kt b/compiler/testData/codegen/boxInline/enum/valuesCapturedType.kt index 1e767ec10fa..8be8bd94990 100644 --- a/compiler/testData/codegen/boxInline/enum/valuesCapturedType.kt +++ b/compiler/testData/codegen/boxInline/enum/valuesCapturedType.kt @@ -5,7 +5,7 @@ package test inline fun > myValues(): String { - val values = { enumValues() }() + val values = { enumValues() }.let { it() } return values.joinToString("") } diff --git a/compiler/testData/codegen/boxInline/enum/valuesChainCapturedType.kt b/compiler/testData/codegen/boxInline/enum/valuesChainCapturedType.kt index 13833186ccc..d1e62b39e49 100644 --- a/compiler/testData/codegen/boxInline/enum/valuesChainCapturedType.kt +++ b/compiler/testData/codegen/boxInline/enum/valuesChainCapturedType.kt @@ -5,7 +5,7 @@ package test inline fun > myValues2(): String { - val values = { enumValues() }() + val values = { enumValues() }.let { it() } return values.joinToString("") } diff --git a/compiler/testData/codegen/boxInline/innerClasses/kt10259.kt b/compiler/testData/codegen/boxInline/innerClasses/kt10259.kt index e879292fbf7..8ea7c24a0b8 100644 --- a/compiler/testData/codegen/boxInline/innerClasses/kt10259.kt +++ b/compiler/testData/codegen/boxInline/innerClasses/kt10259.kt @@ -24,8 +24,8 @@ fun box(): String { { val q = object {} s2 = q.javaClass.enclosingMethod.declaringClass.toString() - }() - }() + }.let { it() } + }.let { it() } } return "OK" diff --git a/compiler/testData/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt b/compiler/testData/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt index eab8722d15a..77fd932b30a 100644 --- a/compiler/testData/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt +++ b/compiler/testData/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt @@ -18,9 +18,9 @@ import zzz.* fun box(): String { - val p = { calc { 11 }} () + val p = { calc { 11 } }.let { it() } - val z = { calc { 12 }}() + val z = { calc { 12 } }.let { it() } if (p == z) return "fail" diff --git a/compiler/testData/codegen/boxInline/lambdaClassClash/noInlineLambdaX2.kt b/compiler/testData/codegen/boxInline/lambdaClassClash/noInlineLambdaX2.kt index 0a8cb8dd274..7bdf23fa5d4 100644 --- a/compiler/testData/codegen/boxInline/lambdaClassClash/noInlineLambdaX2.kt +++ b/compiler/testData/codegen/boxInline/lambdaClassClash/noInlineLambdaX2.kt @@ -9,7 +9,7 @@ inline fun Int.inlineMethod() : Int { return noInlineLambda() } -inline fun Int.noInlineLambda() = { s++ } () +inline fun Int.noInlineLambda() = { s++ }.let { it() } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaCloning.kt b/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaCloning.kt index 5a4c427b89c..eac78696ead 100644 --- a/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaCloning.kt +++ b/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaCloning.kt @@ -4,11 +4,11 @@ package test inline fun doSmth(a: T) : String { - return {a.toString()}() + return { a.toString() }.let { it() } } inline fun doSmth2(a: T) : String { - return {{a.toString()}()}() + return { { a.toString() }.let { it() } }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt b/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt index c14d3bf90a1..886c4696f39 100644 --- a/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt +++ b/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt @@ -54,7 +54,7 @@ inline fun test2(crossinline param: () -> String): String { inline fun test22(crossinline param: () -> String): String { var result = "fail1" - {{result = param()}()}() + { { result = param() }.let { it() } }.let { it() } return result } diff --git a/compiler/testData/codegen/boxInline/lambdaTransformation/regeneratedLambdaName.kt b/compiler/testData/codegen/boxInline/lambdaTransformation/regeneratedLambdaName.kt index 98826899e95..c6e7e93da87 100644 --- a/compiler/testData/codegen/boxInline/lambdaTransformation/regeneratedLambdaName.kt +++ b/compiler/testData/codegen/boxInline/lambdaTransformation/regeneratedLambdaName.kt @@ -5,7 +5,7 @@ package test inline fun call(crossinline f: () -> R) : R { - return {f()} () + return { f() }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/lambdaTransformation/regeneratedLambdaName2.kt b/compiler/testData/codegen/boxInline/lambdaTransformation/regeneratedLambdaName2.kt index 44b199d52c1..45d572758ef 100644 --- a/compiler/testData/codegen/boxInline/lambdaTransformation/regeneratedLambdaName2.kt +++ b/compiler/testData/codegen/boxInline/lambdaTransformation/regeneratedLambdaName2.kt @@ -4,7 +4,7 @@ package test inline fun call(crossinline f: () -> R) : R { - return { f() }() + return { f() }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/localFunInLambda/defaultParam.kt b/compiler/testData/codegen/boxInline/localFunInLambda/defaultParam.kt index 77b4f54128a..d3d17ed1c76 100644 --- a/compiler/testData/codegen/boxInline/localFunInLambda/defaultParam.kt +++ b/compiler/testData/codegen/boxInline/localFunInLambda/defaultParam.kt @@ -47,7 +47,7 @@ fun fooLongCallableReference(): String { val r = "O" val a = run { fun f(x: Long, y: String? = null): String = r + x + y - (::f)(4, "K") + (::f).let { it(4, "K") } } return a } @@ -59,7 +59,7 @@ class A { override fun run(captured: String): String { return { callPrivate(capt, captured) - }() + }.let { it() } } private fun callPrivate(x: Int, y: String?): String = "O" + x + y diff --git a/compiler/testData/codegen/boxInline/noInline/noInlineLambdaChain.kt b/compiler/testData/codegen/boxInline/noInline/noInlineLambdaChain.kt index 00b697703a9..310610305ab 100644 --- a/compiler/testData/codegen/boxInline/noInline/noInlineLambdaChain.kt +++ b/compiler/testData/codegen/boxInline/noInline/noInlineLambdaChain.kt @@ -19,10 +19,10 @@ fun test1(param: String): String { { { result = param + c + a - }() - }() + }.let { it() } + }.let { it() } } - }() + }.let { it() } } return result @@ -35,8 +35,8 @@ fun test2(param: String): String { { { result = param + a - }() - }() + }.let { it() } + }.let { it() } } return result @@ -51,10 +51,10 @@ fun test3(param: String): String { { { result = param + c + a - }() - }() + }.let { it() } + }.let { it() } } - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/noInline/noInlineLambdaChainWithCapturedInline.kt b/compiler/testData/codegen/boxInline/noInline/noInlineLambdaChainWithCapturedInline.kt index e13b49aea6a..2da9954a8ff 100644 --- a/compiler/testData/codegen/boxInline/noInline/noInlineLambdaChainWithCapturedInline.kt +++ b/compiler/testData/codegen/boxInline/noInline/noInlineLambdaChainWithCapturedInline.kt @@ -19,10 +19,10 @@ inline fun test1(crossinline param: () -> String): String { { { result = param() + c + a - }() - }() + }.let { it() } + }.let { it() } } - }() + }.let { it() } } return result @@ -35,8 +35,8 @@ inline fun test2(crossinline param: () -> String): String { { { result = param() + a - }() - }() + }.let { it() } + }.let { it() } } return result @@ -51,10 +51,10 @@ inline fun test3(crossinline param: () -> String): String { { { result = param() + c + a - }() - }() + }.let { it() } + }.let { it() } } - }() + }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/kt9304.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/kt9304.kt index daab8cff900..07e82acb8ab 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/kt9304.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/kt9304.kt @@ -14,4 +14,4 @@ inline fun foo(f: () -> Unit) { fun box(): String = (bar@ l@ fun(): String { foo { return@bar "OK" } return "fail" -}) () +}).let { it() } diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/returnFromFunctionExpr.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/returnFromFunctionExpr.kt index e7d0494bfd1..22c7c893d1d 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/returnFromFunctionExpr.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/returnFromFunctionExpr.kt @@ -10,12 +10,12 @@ inline fun foo(f: () -> Unit) { fun test(): String = fun (): String { foo { return "OK" } return "fail" -} () +}.let { it() } fun test2(): String = (l@ fun (): String { foo { return@l "OK" } return "fail" -}) () +}).let { it() } fun box(): String { if (test() != "OK") return "fail 1: ${test()}" diff --git a/compiler/testData/codegen/boxInline/reified/defaultLambda/nested.kt b/compiler/testData/codegen/boxInline/reified/defaultLambda/nested.kt index a089d91293b..14028888df4 100644 --- a/compiler/testData/codegen/boxInline/reified/defaultLambda/nested.kt +++ b/compiler/testData/codegen/boxInline/reified/defaultLambda/nested.kt @@ -5,7 +5,7 @@ // FILE: 1.kt package test -inline fun inlineFun(p: String, lambda: () -> String = { { p + T::class.java.simpleName } () }): String { +inline fun inlineFun(p: String, lambda: () -> String = { { p + T::class.java.simpleName }.let { it() } }): String { return lambda() } diff --git a/compiler/testData/codegen/boxInline/reified/defaultLambda/nested2.kt b/compiler/testData/codegen/boxInline/reified/defaultLambda/nested2.kt index 17b939a9711..b75e95c6c88 100644 --- a/compiler/testData/codegen/boxInline/reified/defaultLambda/nested2.kt +++ b/compiler/testData/codegen/boxInline/reified/defaultLambda/nested2.kt @@ -4,10 +4,10 @@ // FILE: 1.kt package test -inline fun inlineFun(p: String, crossinline lambda: () -> String = { { p + T::class.java.simpleName } () }): String { +inline fun inlineFun(p: String, crossinline lambda: () -> String = { { p + T::class.java.simpleName }.let { it() } }): String { return { lambda() - } () + }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/reified/defaultLambda/nested2Static.kt b/compiler/testData/codegen/boxInline/reified/defaultLambda/nested2Static.kt index d6f64036cd8..e53a5c7bff2 100644 --- a/compiler/testData/codegen/boxInline/reified/defaultLambda/nested2Static.kt +++ b/compiler/testData/codegen/boxInline/reified/defaultLambda/nested2Static.kt @@ -4,10 +4,10 @@ // FILE: 1.kt package test -inline fun inlineFun(crossinline lambda: () -> String = { { T::class.java.simpleName } () }): String { +inline fun inlineFun(crossinline lambda: () -> String = { { T::class.java.simpleName }.let { it() } }): String { return { lambda() - } () + }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/reified/defaultLambda/nestedStatic.kt b/compiler/testData/codegen/boxInline/reified/defaultLambda/nestedStatic.kt index 548b58c77a4..0f59e681f28 100644 --- a/compiler/testData/codegen/boxInline/reified/defaultLambda/nestedStatic.kt +++ b/compiler/testData/codegen/boxInline/reified/defaultLambda/nestedStatic.kt @@ -5,7 +5,7 @@ // FILE: 1.kt package test -inline fun inlineFun(lambda: () -> String = { { T::class.java.simpleName } () }): String { +inline fun inlineFun(lambda: () -> String = { { T::class.java.simpleName }.let { it() } }): String { return lambda() } diff --git a/compiler/testData/codegen/boxInline/reified/kt46584.kt b/compiler/testData/codegen/boxInline/reified/kt46584.kt index bec5cefc22d..a6655c7c44e 100644 --- a/compiler/testData/codegen/boxInline/reified/kt46584.kt +++ b/compiler/testData/codegen/boxInline/reified/kt46584.kt @@ -1,9 +1,9 @@ // FILE: 1.kt package test -inline fun foo(crossinline x: () -> String) = { x() }() +inline fun foo(crossinline x: () -> String) = { x() }.let { it() } -inline fun bar() = foo { { T::class.simpleName!! }() } +inline fun bar() = foo { { T::class.simpleName!! }.let { it() } } // FILE: 2.kt import test.* diff --git a/compiler/testData/codegen/boxInline/reified/kt46584_2.kt b/compiler/testData/codegen/boxInline/reified/kt46584_2.kt index ebc8d2a3629..cc4e8589fae 100644 --- a/compiler/testData/codegen/boxInline/reified/kt46584_2.kt +++ b/compiler/testData/codegen/boxInline/reified/kt46584_2.kt @@ -3,7 +3,7 @@ package test inline fun foo(x: () -> String) = x() -inline fun bar() = { foo { { T::class.simpleName!! }() } }() +inline fun bar() = { foo { { T::class.simpleName!! }.let { it() } } }.let { it() } // FILE: 2.kt import test.* diff --git a/compiler/testData/codegen/boxInline/reified/kt6990.kt b/compiler/testData/codegen/boxInline/reified/kt6990.kt index 4b39aa8ad9e..7e2c7d605bd 100644 --- a/compiler/testData/codegen/boxInline/reified/kt6990.kt +++ b/compiler/testData/codegen/boxInline/reified/kt6990.kt @@ -10,7 +10,7 @@ public inline fun inlineMeIfYouCan(): String? = f { T::class.java.getName() } - }() + }.let { it() } inline fun f(x: () -> String) = x() diff --git a/compiler/testData/codegen/boxInline/reified/kt9637_2.kt b/compiler/testData/codegen/boxInline/reified/kt9637_2.kt index c73c2638623..ec8da0a48c0 100644 --- a/compiler/testData/codegen/boxInline/reified/kt9637_2.kt +++ b/compiler/testData/codegen/boxInline/reified/kt9637_2.kt @@ -6,7 +6,7 @@ import kotlin.reflect.KClass inline fun injectFnc(): KClass = { T::class -} () +}.let { it() } public class Box diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/kt19175.kt b/compiler/testData/codegen/boxInline/smap/anonymous/kt19175.kt index 5a673bf38c3..bfd8f16a7b1 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/kt19175.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/kt19175.kt @@ -4,8 +4,8 @@ package test abstract class Introspector { abstract inner class SchemaRetriever(val transaction: String) { - inline fun inSchema(crossinline modifier: (String) -> Unit) = - { modifier.invoke(transaction) }() + inline fun inSchema(crossinline modifier: (String) -> Unit) + { val lambda = { modifier.invoke(transaction) }; lambda() } } } diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/kt19175.smap b/compiler/testData/codegen/boxInline/smap/anonymous/kt19175.smap index cac2acf0a38..0dbde6a77d5 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/kt19175.smap +++ b/compiler/testData/codegen/boxInline/smap/anonymous/kt19175.smap @@ -5,7 +5,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/Introspector$SchemaRetriever$inSchema$1 +test/Introspector$SchemaRetriever$inSchema$lambda$1 *L 1#1,12:1 *E @@ -37,7 +37,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/Introspector$SchemaRetriever$inSchema$1 +test/Introspector$SchemaRetriever$inSchema$lambda$1 + 2 2.kt IntrospectorImpl$SchemaRetriever *L diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.kt b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.kt index 9a35ec2e9dc..5ff7e6cfe15 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.kt @@ -5,9 +5,9 @@ package builders inline fun call(crossinline init: () -> Unit) { - return { + val lambda = { init() - }() + }; lambda() } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.smap b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.smap index 133f8d6dee6..37db878d610 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.smap +++ b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.smap @@ -5,7 +5,7 @@ Kotlin *S Kotlin *F + 1 1.kt -builders/_1Kt$call$1 +builders/_1Kt$call$lambda$1 *L 1#1,13:1 *E @@ -22,13 +22,13 @@ _2Kt builders/_1Kt *L 1#1,31:1 -8#2:32 +8#2,4:32 *S KotlinDebug *F + 1 2.kt _2Kt *L -20#1:32 +20#1:32,4 *E SMAP @@ -37,7 +37,7 @@ Kotlin *S Kotlin *F + 1 1.kt -builders/_1Kt$call$1 +builders/_1Kt$call$lambda$1 + 2 2.kt _2Kt *L diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnCallSite.kt b/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnCallSite.kt index 20b1a1be810..e9a4e093c7e 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnCallSite.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnCallSite.kt @@ -17,9 +17,9 @@ fun test(): String { var res = "Fail" call { - { + val lambda ={ res = "OK" - }() + }; lambda() } return res diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.kt b/compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.kt index e3050bde68d..40712306f6c 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.kt @@ -3,8 +3,8 @@ package test -inline fun annotatedWith2(crossinline predicate: () -> Boolean) = - { any { predicate() } }() +inline fun annotatedWith2(crossinline predicate: () -> Boolean) + { val lambda = { any { predicate() } }; lambda() } inline fun annotatedWith(crossinline predicate: () -> Boolean) = diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.smap b/compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.smap index 6838dd6dbc8..d3a0f977fd7 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.smap +++ b/compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.smap @@ -27,7 +27,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$annotatedWith2$1 +test/_1Kt$annotatedWith2$lambda$1 + 2 1.kt test/_1Kt + 3 2.kt @@ -41,7 +41,7 @@ _2Kt *S KotlinDebug *F + 1 1.kt -test/_1Kt$annotatedWith2$1 +test/_1Kt$annotatedWith2$lambda$1 *L 7#1:20 7#1:23 diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt index 635ffe33422..85ca3460037 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt @@ -28,10 +28,10 @@ package test //A lot of blank lines [Don't delete] //A lot of blank lines [Don't delete] -inline fun kValue(crossinline s: () -> String) = { s() + "K" }() +inline fun kValue(crossinline s: () -> String): String { val lambda = { s() + "K" }; return lambda() } inline fun lParams(initParams: () -> String = { - { "" + kValue { "O" } }() + val lambda = { "" + kValue { "O" } }; lambda() }): String { val z = "body" return initParams() diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.smap-nonseparate-compilation b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.smap-nonseparate-compilation index aedfd40148c..9c316245fba 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.smap-nonseparate-compilation +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.smap-nonseparate-compilation @@ -16,7 +16,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$lParams$1$1 +test/_1Kt$lParams$1$lambda$1 + 2 1.kt test/_1Kt *L @@ -25,7 +25,7 @@ test/_1Kt *S KotlinDebug *F + 1 1.kt -test/_1Kt$lParams$1$1 +test/_1Kt$lParams$1$lambda$1 *L 34#1:41 *E @@ -36,9 +36,9 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 + 2 1.kt -test/_1Kt$lParams$1$1 +test/_1Kt$lParams$1$lambda$1 *L 1#1,40:1 34#2:41 @@ -50,7 +50,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 *L 1#1,40:1 *E diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.smap-separate-compilation b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.smap-separate-compilation index 1cb7c6ea776..d996fd7d27a 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.smap-separate-compilation +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.smap-separate-compilation @@ -16,7 +16,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$lParams$1$1 +test/_1Kt$lParams$1$lambda$1 + 2 1.kt test/_1Kt *L @@ -25,7 +25,7 @@ test/_1Kt *S KotlinDebug *F + 1 1.kt -test/_1Kt$lParams$1$1 +test/_1Kt$lParams$1$lambda$1 *L 34#1:41 *E @@ -36,9 +36,9 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 + 2 1.kt -test/_1Kt$lParams$1$1 +test/_1Kt$lParams$1$lambda$1 *L 1#1,40:1 34#2:41 @@ -50,7 +50,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 *L 1#1,40:1 *E @@ -86,7 +86,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$lParams$1$1 +test/_1Kt$lParams$1$lambda$1 + 2 1.kt test/_1Kt *L @@ -95,7 +95,7 @@ test/_1Kt *S KotlinDebug *F + 1 1.kt -test/_1Kt$lParams$1$1 +test/_1Kt$lParams$1$lambda$1 *L 34#1:41 *E @@ -106,9 +106,9 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 + 2 1.kt -test/_1Kt$lParams$1$1 +test/_1Kt$lParams$1$lambda$1 *L 1#1,40:1 34#2:41 diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt index 496d4812b0f..52e41cefe9a 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt @@ -29,7 +29,7 @@ package test //A lot of blank lines [Don't delete] //A lot of blank lines [Don't delete] -inline fun kValue(crossinline s: () -> String) = { s() + "K" }() +inline fun kValue(crossinline s: () -> String): String { val lambda = { s() + "K" }; return lambda() } inline fun lParams(initParams: () -> String = { "" + kValue { "O" } diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.smap-nonseparate-compilation b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.smap-nonseparate-compilation index 0fad28d53a7..1f08175d0c9 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.smap-nonseparate-compilation +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.smap-nonseparate-compilation @@ -25,7 +25,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 + 2 1.kt test/_1Kt$lParams$1 *L @@ -39,7 +39,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 *L 1#1,41:1 *E diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.smap-separate-compilation b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.smap-separate-compilation index de4af09ebf8..7c8c2f986dc 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.smap-separate-compilation +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.smap-separate-compilation @@ -25,7 +25,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 + 2 1.kt test/_1Kt$lParams$1 *L @@ -39,7 +39,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 *L 1#1,41:1 *E @@ -77,7 +77,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 + 2 1.kt test/_1Kt$lParams$1 *L diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt index 54ad48f24e1..18f98686f7b 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt @@ -29,7 +29,7 @@ package test //A lot of blank lines [Don't delete] //A lot of blank lines [Don't delete] -inline fun kValue(crossinline s: () -> String) = { s() + "K" }() +inline fun kValue(crossinline s: () -> String): String { val lambda = { s() + "K" }; return lambda() } inline fun lParams(initParams: () -> String = { "" + kValue { "O" } diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.smap-nonseparate-compilation b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.smap-nonseparate-compilation index 4cf0e7993a8..226eebc9738 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.smap-nonseparate-compilation +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.smap-nonseparate-compilation @@ -25,7 +25,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 + 2 1.kt test/_1Kt$lParams$1 *L @@ -39,7 +39,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 *L 1#1,41:1 *E diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.smap-separate-compilation b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.smap-separate-compilation index 4cac326cfa2..156550b916f 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.smap-separate-compilation +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.smap-separate-compilation @@ -25,7 +25,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 + 2 1.kt test/_1Kt$lParams$1 *L @@ -39,7 +39,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 *L 1#1,41:1 *E @@ -77,7 +77,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$kValue$1 +test/_1Kt$kValue$lambda$1 + 2 1.kt test/_1Kt$lParams$1 *L diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.kt index 3e6db989d49..c62acb4c334 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.kt @@ -5,9 +5,9 @@ package test inline fun inlineFun(capturedParam: String, crossinline lambda: () -> String = { capturedParam }): String { - return { + val lambda2 = { lambda() - }() + }; return lambda2() } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.smap b/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.smap index cbebe8d2951..4a9ca28145b 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.smap +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.smap @@ -5,7 +5,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$inlineFun$2 +test/_1Kt$inlineFun$lambda2$1 *L 1#1,13:1 *E @@ -33,13 +33,13 @@ _2Kt test/_1Kt *L 1#1,20:1 -7#2,2:21 +7#2,4:21 *S KotlinDebug *F + 1 2.kt _2Kt *L -18#1:21,2 +18#1:21,4 *E SMAP @@ -48,7 +48,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$inlineFun$2 +test/_1Kt$inlineFun$lambda2$1 + 2 1.kt test/_1Kt$inlineFun$1 *L diff --git a/compiler/testData/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.kt b/compiler/testData/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.kt index d4529a58e90..9bdf7351c2e 100644 --- a/compiler/testData/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.kt +++ b/compiler/testData/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.kt @@ -8,11 +8,11 @@ inline fun myrun(s: () -> Unit) { } inline fun test(crossinline s: () -> Unit) { - { + val lambda = { val z = 1; myrun(s) val x = 1; - }() + }; lambda() } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.smap b/compiler/testData/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.smap index 9aa907d6c45..e6eb7614bd7 100644 --- a/compiler/testData/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.smap +++ b/compiler/testData/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.smap @@ -5,7 +5,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$test$1 +test/_1Kt$test$lambda$1 + 2 1.kt test/_1Kt *L @@ -14,7 +14,7 @@ test/_1Kt *S KotlinDebug *F + 1 1.kt -test/_1Kt$test$1 +test/_1Kt$test$lambda$1 *L 13#1:19,3 *E @@ -46,7 +46,7 @@ Kotlin *S Kotlin *F + 1 1.kt -test/_1Kt$test$1 +test/_1Kt$test$lambda$1 + 2 1.kt test/_1Kt + 3 2.kt @@ -59,7 +59,7 @@ _2Kt *S KotlinDebug *F + 1 1.kt -test/_1Kt$test$1 +test/_1Kt$test$lambda$1 *L 13#1:19,2 13#1:23 diff --git a/compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt b/compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt index 1bf35f4f44d..004e2f3f7c2 100644 --- a/compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt +++ b/compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt @@ -14,7 +14,7 @@ inline fun test(crossinline foo: String.() -> String): String { { cycle.foo() - }() + }.let { it() } return cycle.foo() diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt index 8f4c8f59191..9359c2a5668 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/objectInsideLambdas.kt @@ -17,8 +17,8 @@ inline fun inlineMe(crossinline c: suspend () -> Unit) = { } } sr - }() -}() + }.let { it() } +}.let { it() } // FILE: box.kt import helpers.* diff --git a/compiler/testData/codegen/boxInline/suspend/twiceRegeneratedAnonymousObject.kt b/compiler/testData/codegen/boxInline/suspend/twiceRegeneratedAnonymousObject.kt index 981965abf3f..a8fba04e150 100644 --- a/compiler/testData/codegen/boxInline/suspend/twiceRegeneratedAnonymousObject.kt +++ b/compiler/testData/codegen/boxInline/suspend/twiceRegeneratedAnonymousObject.kt @@ -8,7 +8,7 @@ inline fun foo(crossinline x: () -> Unit) = suspend { try { } finally { // This object is regenerated twice (normal return & "catch Throwable, execute finally, and rethrow") // It doesn't *need* to be, but this should work regardless. - { x() }() + { x() }.let { it() } } } diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.kt index 03ba10fb886..4c537ca0f60 100644 --- a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.kt +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.kt @@ -4,7 +4,7 @@ package test inline fun call(crossinline s: () -> String): String { - return { s() } () + return { s() }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.kt index 601ff564e81..8edebf54683 100644 --- a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.kt +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.kt @@ -6,7 +6,7 @@ package test inline fun call(crossinline s: () -> String): String { return { s() - }() + }.let { it() } } // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInDefaultStubArgument.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInDefaultStubArgument.kt index 3583093ea0d..0c65263997e 100644 --- a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInDefaultStubArgument.kt +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInDefaultStubArgument.kt @@ -2,7 +2,7 @@ package test // Argument `f` of `call$default` is technically nullable and inline. -inline fun call(other: Int = 1, crossinline f: () -> String = { "fail" }) = { f() }() +inline fun call(other: Int = 1, crossinline f: () -> String = { "fail" }) = { f() }.let { it() } // FILE: 2.kt import test.* diff --git a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.kt b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.kt index 8ba4ec259d5..4c827d658de 100644 --- a/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.kt +++ b/compiler/testData/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.kt @@ -6,7 +6,7 @@ package test inline fun call(crossinline s: () -> String): String { return { s() - }() + }.let { it() } } open class Base { diff --git a/compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicWithInline.kt b/compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicWithInline.kt index b14fce28ab3..e26766657ed 100644 --- a/compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicWithInline.kt +++ b/compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicWithInline.kt @@ -2,7 +2,7 @@ inline fun test(crossinline s: (String) -> String): String { var result = "1" + s("2") + "3" + 4 + { "5" + s("6") + "7" - }() + }.let { it() } result += object { fun run() = "8" + s("9") + "10" diff --git a/compiler/testData/codegen/bytecodeListing/inline/enclosingInfo/crossinlineLambdaChain.kt b/compiler/testData/codegen/bytecodeListing/inline/enclosingInfo/crossinlineLambdaChain.kt index c3bdc7e74de..b84bca2c578 100644 --- a/compiler/testData/codegen/bytecodeListing/inline/enclosingInfo/crossinlineLambdaChain.kt +++ b/compiler/testData/codegen/bytecodeListing/inline/enclosingInfo/crossinlineLambdaChain.kt @@ -2,7 +2,7 @@ package test -inline fun call(crossinline s: () -> R) = { s() }() +inline fun call(crossinline s: () -> R) = { s() }.let { it() } inline fun test(crossinline z: () -> String) = { z() } diff --git a/compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt b/compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt index f571772dc6c..c7b0f256f49 100644 --- a/compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt +++ b/compiler/testData/codegen/bytecodeText/companion/inlineFunctionObjectCompanionPropertyAccess.kt @@ -9,7 +9,7 @@ class A { f() s v = "OK" - } () + }.let { it() } } inline fun g2(crossinline f: () -> Unit) { @@ -19,7 +19,7 @@ class A { s v = "OK" } - }.run () + }.run() } inline fun use() { diff --git a/compiler/testData/codegen/bytecodeText/inline/finallyMarkers.kt b/compiler/testData/codegen/bytecodeText/inline/finallyMarkers.kt index 5d06d15ad72..f3706355218 100644 --- a/compiler/testData/codegen/bytecodeText/inline/finallyMarkers.kt +++ b/compiler/testData/codegen/bytecodeText/inline/finallyMarkers.kt @@ -1,7 +1,7 @@ inline fun test(crossinline l: () -> String) { { l() - }() + }.let { it() } object { val z = l() //constuctor diff --git a/compiler/testData/codegen/bytecodeText/kt10259_2.kt b/compiler/testData/codegen/bytecodeText/kt10259_2.kt index a7bf15def8d..75030bb1932 100644 --- a/compiler/testData/codegen/bytecodeText/kt10259_2.kt +++ b/compiler/testData/codegen/bytecodeText/kt10259_2.kt @@ -11,8 +11,8 @@ inline fun test(crossinline s: () -> Unit) { { { s() - }() - }() + }.let { it() } + }.let { it() } } // 3 INNERCLASS Kt10259_2Kt\$test\$1 null diff --git a/compiler/testData/codegen/bytecodeText/kt10259_3.kt b/compiler/testData/codegen/bytecodeText/kt10259_3.kt index b765e567015..bfd670ca1be 100644 --- a/compiler/testData/codegen/bytecodeText/kt10259_3.kt +++ b/compiler/testData/codegen/bytecodeText/kt10259_3.kt @@ -15,8 +15,8 @@ inline fun test(crossinline s: () -> Unit) { { { s() - }() - }() + }.let { it() } + }.let { it() } } // 2 INNERCLASS Kt10259_3Kt\$box\$\$inlined\$test\$1\s