diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt index 45d8272f61565..896dbb3266ed8 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt @@ -18,8 +18,6 @@ package androidx.compose.compiler.plugins.kotlin import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue -import org.junit.Ignore -import org.junit.Rule import org.junit.Test /* ktlint-disable max-line-length */ diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testDexNaming[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testDexNaming[useFir = true].txt index dd6f362d7915b..56063a5dfc3e4 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testDexNaming[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testDexNaming[useFir = true].txt @@ -12,5 +12,5 @@ val myProperty: () -> Unit @Composable get() { public final class TestKt { public final static getMyProperty(Landroidx/compose/runtime/Composer;I)Lkotlin/jvm/functions/Function0; - private final static _get_myProperty_%lambda%0()Lkotlin/Unit; + private final static _get_myProperty_%lambda%1%lambda%0()Lkotlin/Unit; } diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testFunInterfacesInComposableCall[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testFunInterfacesInComposableCall[useFir = true].txt index eb031a02dd362..107febbfc2f13 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testFunInterfacesInComposableCall[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testFunInterfacesInComposableCall[useFir = true].txt @@ -27,5 +27,5 @@ public abstract interface MeasurePolicy { public final class TestKt { public final static Text(Landroidx/compose/runtime/Composer;I)V public final static Layout(LMeasurePolicy;Landroidx/compose/runtime/Composer;I)V - private final static Text%lambda%0(I)V + private final static Text%lambda%1%lambda%0(I)V } diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testLambdaReorderedParameter[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testLambdaReorderedParameter[useFir = true].txt index 2522d97817958..96250b50374c6 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testLambdaReorderedParameter[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamSignatureTests/testLambdaReorderedParameter[useFir = true].txt @@ -15,6 +15,6 @@ public final class TestKt { public final static Foo(Ljava/lang/String;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V public final static Example(Landroidx/compose/runtime/Composer;I)V private final static Foo%lambda%0(Ljava/lang/String;Lkotlin/jvm/functions/Function0;ILandroidx/compose/runtime/Composer;I)Lkotlin/Unit; - private final static Example%lambda%1()Lkotlin/Unit; - private final static Example%lambda%2(ILandroidx/compose/runtime/Composer;I)Lkotlin/Unit; + private final static Example%lambda%2%lambda%1()Lkotlin/Unit; + private final static Example%lambda%3(ILandroidx/compose/runtime/Composer;I)Lkotlin/Unit; } diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/composableLocalFunctionInsideLocalClass[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/composableLocalFunctionInsideLocalClass[useFir = true].txt index 07aa13196a0d8..6d95382ab7804 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/composableLocalFunctionInsideLocalClass[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/composableLocalFunctionInsideLocalClass[useFir = true].txt @@ -33,11 +33,18 @@ fun test() { } @Composable fun B(%composer: Composer?, %changed: Int) { - sourceInformationMarkerStart(%composer, <>, "C(B):Test.kt") + sourceInformationMarkerStart(%composer, <>, "C(B)<{}>,:Test.kt") if (isTraceInProgress()) { traceEventStart(<>, %changed, -1, <>) } - Button({ + Button({ + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + { + } + } + sourceInformationMarkerEnd(%composer) + tmp0_group }, ComposableSingletons%TestKt.lambda-1, %composer, 0b00110110) if (isTraceInProgress()) { traceEventEnd() diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/testDexNaming[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/testDexNaming[useFir = true].txt index 22f4969a3b04a..a7575b3c2fbd7 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/testDexNaming[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/testDexNaming[useFir = true].txt @@ -24,11 +24,18 @@ val myProperty: () -> Unit @Composable get() { val myProperty: Function0 @Composable @JvmName(name = "getMyProperty") get() { - sourceInformationMarkerStart(%composer, <>, "C:Test.kt#2487m") + sourceInformationMarkerStart(%composer, <>, "C<{>:Test.kt#2487m") if (isTraceInProgress()) { traceEventStart(<>, %changed, -1, <>) } - val tmp0 = { + val tmp0 = { + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp1_group = %composer.cache(false) { + { + } + } + sourceInformationMarkerEnd(%composer) + tmp1_group } if (isTraceInProgress()) { traceEventEnd() diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testComposeIrSkippingWithDefaultsRelease[useFir = false].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testComposeIrSkippingWithDefaultsRelease[useFir = false].txt index 84fb7a8459700..09fb5be6c4d75 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testComposeIrSkippingWithDefaultsRelease[useFir = false].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testComposeIrSkippingWithDefaultsRelease[useFir = false].txt @@ -2,10 +2,8 @@ // Source // ------------------------------------------ -import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.runtime.* import androidx.compose.foundation.layout.* -import androidx.compose.foundation.text.KeyboardActions object Ui {} diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testComposeIrSkippingWithDefaultsRelease[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testComposeIrSkippingWithDefaultsRelease[useFir = true].txt index 84fb7a8459700..09fb5be6c4d75 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testComposeIrSkippingWithDefaultsRelease[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testComposeIrSkippingWithDefaultsRelease[useFir = true].txt @@ -2,10 +2,8 @@ // Source // ------------------------------------------ -import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.runtime.* import androidx.compose.foundation.layout.* -import androidx.compose.foundation.text.KeyboardActions object Ui {} diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testRepeatedCallsToEffects[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testRepeatedCallsToEffects[useFir = true].txt index 3dede05dc617e..2b51391811ca5 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testRepeatedCallsToEffects[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.ControlFlowTransformTests/testRepeatedCallsToEffects[useFir = true].txt @@ -39,21 +39,35 @@ fun Test(%composer: Composer?, %changed: Int) { } internal object ComposableSingletons%TestKt { val lambda-1: Function2 = composableLambdaInstance(<>, false) { %composer: Composer?, %changed: Int -> - sourceInformation(%composer, "C:Test.kt") + sourceInformation(%composer, "C<{>,:Test.kt") if (%changed and 0b0011 != 0b0010 || !%composer.skipping) { if (isTraceInProgress()) { traceEventStart(<>, %changed, -1, <>) } %composer.startReplaceGroup(<>) - sourceInformation(%composer, "*") + sourceInformation(%composer, "*<{>,") repeat(number) { it: Int -> - effects[it] = effect({ - 0 + effects[it] = effect({ + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + { + 0 + } + } + sourceInformationMarkerEnd(%composer) + tmp0_group }, %composer, 0b0110) } %composer.endReplaceGroup() - outside = effect({ - "0" + outside = effect({ + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + { + "0" + } + } + sourceInformationMarkerEnd(%composer) + tmp0_group }, %composer, 0b0110) if (isTraceInProgress()) { traceEventEnd() diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionBodySkippingTransformTests/testBasicText[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionBodySkippingTransformTests/testBasicText[useFir = true].txt index acc54375c76fb..526101cea0e75 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionBodySkippingTransformTests/testBasicText[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionBodySkippingTransformTests/testBasicText[useFir = true].txt @@ -29,7 +29,7 @@ fun BasicText( @Composable fun BasicText(style: TextStyle?, onTextLayout: Function1?, overflow: TextOverflow, %composer: Composer?, %changed: Int, %default: Int) { %composer = %composer.startRestartGroup(<>) - sourceInformation(%composer, "C(BasicText)P(2!,1:c#ui.text.style.TextOverflow):Test.kt") + sourceInformation(%composer, "C(BasicText)P(2!,1:c#ui.text.style.TextOverflow)<{}>:Test.kt") val %dirty = %changed if (%default and 0b0001 != 0) { %dirty = %dirty or 0b0110 @@ -51,7 +51,14 @@ fun BasicText(style: TextStyle?, onTextLayout: Function1 style = Companion.Default } if (%default and 0b0010 != 0) { - onTextLayout = { it: TextLayoutResult -> + onTextLayout = { + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + { it: TextLayoutResult -> + } + } + sourceInformationMarkerEnd(%composer) + tmp0_group } } if (%default and 0b0100 != 0) { diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionBodySkippingTransformTests/testStaticDetection[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionBodySkippingTransformTests/testStaticDetection[useFir = true].txt index 6203ee4950c46..0a86aaf59ce25 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionBodySkippingTransformTests/testStaticDetection[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionBodySkippingTransformTests/testStaticDetection[useFir = true].txt @@ -40,14 +40,21 @@ import androidx.compose.runtime.ReadOnlyComposable @Composable fun A(%composer: Composer?, %changed: Int) { %composer = %composer.startRestartGroup(<>) - sourceInformation(%composer, "C(A),,,,,,,,,,,,,,,:Test.kt") + sourceInformation(%composer, "C(A),<{}>,,,,,,,,,,,,,,,:Test.kt") if (%changed != 0 || !%composer.skipping) { if (isTraceInProgress()) { traceEventStart(<>, %changed, -1, <>) } val x = 123 D(ComposableSingletons%TestKt.lambda-1, %composer, 0b0110) - C({ + C({ + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + { + } + } + sourceInformationMarkerEnd(%composer) + tmp0_group }, %composer, 0b0110) C(stableFun(123), %composer, 0b0110) C(16.dp + 10.dp, %composer, 0b0110) diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionalInterfaceTransformTests/testNoCaptureFunInterface[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionalInterfaceTransformTests/testNoCaptureFunInterface[useFir = true].txt index 8c0c69e76f293..2e36f5686c12e 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionalInterfaceTransformTests/testNoCaptureFunInterface[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.FunctionalInterfaceTransformTests/testNoCaptureFunInterface[useFir = true].txt @@ -27,14 +27,21 @@ interface Consumer { @Composable fun Test(int: Int, %composer: Composer?, %changed: Int) { %composer = %composer.startRestartGroup(<>) - sourceInformation(%composer, "C(Test):Test.kt") + sourceInformation(%composer, "C(Test)<{>,:Test.kt") if (%changed and 0b0001 != 0 || !%composer.skipping) { if (isTraceInProgress()) { traceEventStart(<>, %changed, -1, <>) } - Example(Consumer { it: Int -> - println(it) - }, %composer, 0b0110) + Example({ + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + Consumer { it: Int -> + println(it) + } + } + sourceInformationMarkerEnd(%composer) + tmp0_group + }, %composer, 0) if (isTraceInProgress()) { traceEventEnd() } diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testFunctionReferenceWithinInferredComposableLambda[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testFunctionReferenceWithinInferredComposableLambda[useFir = true].txt index 0efbcaaf06410..dc7ea48e44735 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testFunctionReferenceWithinInferredComposableLambda[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testFunctionReferenceWithinInferredComposableLambda[useFir = true].txt @@ -18,12 +18,17 @@ fun Problem() { fun Problem() { fun foo() { } val lambda = composableLambdaInstance(<>, false) { %composer: Composer?, %changed: Int -> - sourceInformation(%composer, "C:Test.kt") + sourceInformation(%composer, "C<::foo>:Test.kt") if (%changed and 0b1011 != 0b0010 || !%composer.skipping) { if (isTraceInProgress()) { traceEventStart(<>, %changed, -1, <>) } - ::foo + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + ::foo + } + sourceInformationMarkerEnd(%composer) + tmp0_group if (isTraceInProgress()) { traceEventEnd() } diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testLambdaNoCapture[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testLambdaNoCapture[useFir = true].txt index 435eebf3bc810..728c9032c7724 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testLambdaNoCapture[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testLambdaNoCapture[useFir = true].txt @@ -46,13 +46,20 @@ fun TestLambda(content: Function0, %composer: Composer?, %changed: Int) { @Composable fun Test(%composer: Composer?, %changed: Int) { %composer = %composer.startRestartGroup(<>) - sourceInformation(%composer, "C(Test):Test.kt") + sourceInformation(%composer, "C(Test)<{>,:Test.kt") if (%changed != 0 || !%composer.skipping) { if (isTraceInProgress()) { traceEventStart(<>, %changed, -1, <>) } - TestLambda({ - println("Doesn't capture") + TestLambda({ + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + { + println("Doesn't capture") + } + } + sourceInformationMarkerEnd(%composer) + tmp0_group }, %composer, 0b0110) if (isTraceInProgress()) { traceEventEnd() diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testLocalFunCaptures[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testLocalFunCaptures[useFir = true].txt index 075c1d3871537..d6952bf0ee5a8 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testLocalFunCaptures[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.LambdaMemoizationTransformTests/testLocalFunCaptures[useFir = true].txt @@ -25,7 +25,7 @@ fun Err() { @NonRestartableComposable @Composable fun Err(%composer: Composer?, %changed: Int) { - sourceInformationMarkerStart(%composer, <>, "C(Err):Test.kt") + sourceInformationMarkerStart(%composer, <>, "C(Err)<{>:Test.kt") if (isTraceInProgress()) { traceEventStart(<>, %changed, -1, <>) } @@ -34,9 +34,14 @@ fun Err(%composer: Composer?, %changed: Int) { x } } - { - handler() + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + { + handler() + } } + sourceInformationMarkerEnd(%composer) + tmp0_group if (isTraceInProgress()) { traceEventEnd() } diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.StrongSkippingModeTransformTests/testFunctionInterfaceMemorized[useFir = true, intrinsicRemember = false].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.StrongSkippingModeTransformTests/testFunctionInterfaceMemorized[useFir = true, intrinsicRemember = false].txt index fb1a2474801d6..5ae8c45eb7065 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.StrongSkippingModeTransformTests/testFunctionInterfaceMemorized[useFir = true, intrinsicRemember = false].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.StrongSkippingModeTransformTests/testFunctionInterfaceMemorized[useFir = true, intrinsicRemember = false].txt @@ -49,9 +49,11 @@ fun Test(%composer: Composer?, %changed: Int) { traceEventStart(<>, %changed, -1, <>) } val capture = 0 - TestMemoizedFun(TestFunInterface { it: Int -> - use(it) - }, %composer, 0b0110) + TestMemoizedFun(%composer.cache(false) { + TestFunInterface { it: Int -> + use(it) + } + }, %composer, 0) TestMemoizedFun(%composer.cache(%composer.changed(capture)) { TestFunInterface { it: Int -> use(capture) diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.StrongSkippingModeTransformTests/testFunctionInterfaceMemorized[useFir = true, intrinsicRemember = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.StrongSkippingModeTransformTests/testFunctionInterfaceMemorized[useFir = true, intrinsicRemember = true].txt index 192c84b6e2462..cbc178d56d1e7 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.StrongSkippingModeTransformTests/testFunctionInterfaceMemorized[useFir = true, intrinsicRemember = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.StrongSkippingModeTransformTests/testFunctionInterfaceMemorized[useFir = true, intrinsicRemember = true].txt @@ -49,9 +49,11 @@ fun Test(%composer: Composer?, %changed: Int) { traceEventStart(<>, %changed, -1, <>) } val capture = 0 - TestMemoizedFun(TestFunInterface { it: Int -> - use(it) - }, %composer, 0b0110) + TestMemoizedFun(%composer.cache(false) { + TestFunInterface { it: Int -> + use(it) + } + }, %composer, 0) TestMemoizedFun(%composer.cache(false) { TestFunInterface { it: Int -> use(capture) diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testCallingLayout[useFir = false].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testCallingLayout[useFir = false].txt index 22da6d823e886..2272392104a79 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testCallingLayout[useFir = false].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testCallingLayout[useFir = false].txt @@ -4,9 +4,8 @@ import androidx.compose.runtime.* import androidx.compose.ui.layout.* -import androidx.compose.foundation.text.* import androidx.compose.ui.text.* -import androidx.compose.ui.text.style.* +import androidx.compose.foundation.text.* @Composable fun Test1() { diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testCallingLayout[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testCallingLayout[useFir = true].txt index 22da6d823e886..b7476f5b8f37e 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testCallingLayout[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testCallingLayout[useFir = true].txt @@ -4,9 +4,8 @@ import androidx.compose.runtime.* import androidx.compose.ui.layout.* -import androidx.compose.foundation.text.* import androidx.compose.ui.text.* -import androidx.compose.ui.text.style.* +import androidx.compose.foundation.text.* @Composable fun Test1() { @@ -57,7 +56,7 @@ fun T(value: String) { } @ComposableTarget(applier = "androidx.compose.ui.UiComposable") fun Test1(%composer: Composer?, %changed: Int) { %composer = %composer.startRestartGroup(<>) - sourceInformation(%composer, "C(Test1):Test.kt") + sourceInformation(%composer, "C(Test1)<{>,:Test.kt") if (%changed != 0 || !%composer.skipping) { if (isTraceInProgress()) { traceEventStart(<>, %changed, -1, <>) @@ -66,8 +65,15 @@ fun Test1(%composer: Composer?, %changed: Int) { sourceInformationMarkerStart(%composer, <>, "C:Test.kt") Unit sourceInformationMarkerEnd(%composer) - }, null, MeasurePolicy { : List, : Constraints -> - error("") + }, null, { + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + MeasurePolicy { : List, : Constraints -> + error("") + } + } + sourceInformationMarkerEnd(%composer) + tmp0_group }, %composer, 0b000110000000, 0b0010) if (isTraceInProgress()) { traceEventEnd() @@ -83,7 +89,7 @@ fun Test1(%composer: Composer?, %changed: Int) { @ComposableInferredTarget(scheme = "[androidx.compose.ui.UiComposable[androidx.compose.ui.UiComposable]]") fun Test2(content: Function2, %composer: Composer?, %changed: Int) { %composer = %composer.startRestartGroup(<>) - sourceInformation(%composer, "C(Test2):Test.kt") + sourceInformation(%composer, "C(Test2)<{>,:Test.kt") val %dirty = %changed if (%changed and 0b0110 == 0) { %dirty = %dirty or if (%composer.changedInstance(content)) 0b0100 else 0b0010 @@ -92,8 +98,15 @@ fun Test2(content: Function2, %composer: Composer?, %change if (isTraceInProgress()) { traceEventStart(<>, %dirty, -1, <>) } - Layout(content, null, MeasurePolicy { : List, : Constraints -> - error("") + Layout(content, null, { + sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp") + val tmp0_group = %composer.cache(false) { + MeasurePolicy { : List, : Constraints -> + error("") + } + } + sourceInformationMarkerEnd(%composer) + tmp0_group }, %composer, 0b000110000000 or 0b1110 and %dirty, 0b0010) if (isTraceInProgress()) { traceEventEnd() diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testReceiverScope[useFir = false].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testReceiverScope[useFir = false].txt index ccc06baf73505..5a641734dd232 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testReceiverScope[useFir = false].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testReceiverScope[useFir = false].txt @@ -3,11 +3,8 @@ // ------------------------------------------ import androidx.compose.runtime.* -import androidx.compose.ui.layout.* -import androidx.compose.foundation.text.* -import androidx.compose.ui.text.* -import androidx.compose.ui.text.style.* import androidx.compose.ui.* +import androidx.compose.ui.layout.* @Immutable interface LocalBoxScope { diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testReceiverScope[useFir = true].txt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testReceiverScope[useFir = true].txt index ccc06baf73505..5a641734dd232 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testReceiverScope[useFir = true].txt +++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/resources/golden/androidx.compose.compiler.plugins.kotlin.TargetAnnotationsTransformTests/testReceiverScope[useFir = true].txt @@ -3,11 +3,8 @@ // ------------------------------------------ import androidx.compose.runtime.* -import androidx.compose.ui.layout.* -import androidx.compose.foundation.text.* -import androidx.compose.ui.text.* -import androidx.compose.ui.text.style.* import androidx.compose.ui.* +import androidx.compose.ui.layout.* @Immutable interface LocalBoxScope { diff --git a/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerLambdaMemoization.kt b/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerLambdaMemoization.kt index 8785e837ec8b3..d9423774f109f 100644 --- a/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerLambdaMemoization.kt +++ b/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerLambdaMemoization.kt @@ -949,12 +949,19 @@ class ComposerLambdaMemoization( expression: IrExpression, captures: List ): IrExpression { - // Kotlin/JS doesn't have an optimization for non-capturing lambdas - // https://youtrack.jetbrains.com/issue/KT-49923 - val skipNonCapturingLambdas = !context.platform.isJs() && !context.platform.isWasm() + val memoizeLambdasWithoutCaptures = + // Kotlin/JS doesn't have an optimization for non-capturing lambdas + // https://youtrack.jetbrains.com/issue/KT-49923 + context.platform.isJs() || context.platform.isWasm() || + ( + // K2 uses invokedynamic for lambdas, which doesn't perform lambda optimization + // on Android. + context.platform.isJvm() && + context.languageVersionSettings.languageVersion.usesK2 + ) // If the function doesn't capture, Kotlin's default optimization is sufficient - if (captures.isEmpty() && skipNonCapturingLambdas) { + if (!memoizeLambdasWithoutCaptures && captures.isEmpty()) { metrics.recordLambda( composable = false, memoized = true,