Fixed
Status Update
Comments
as...@google.com <as...@google.com> #2
Minimal repro:
remember(key()) { "" }
Text("")
This is caused by inlined remember
allocating slots after the key
call, which is not currently supported by runtime.
To workaround, you can hoist parameter out of remember or disable intrinsic remember optimization.
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 90c191c06981868219a5487814798196b32d1b55
Author: Andrei Shikov <ashikov@google.com>
Date: Wed Dec 13 06:35:42 2023
Hoist remember parameters out of intrinsic remember
Pulls expressions that might contain calls (or side effects) outside of the remember group. The parameter can technically have a composable expression, which was interleaving `changed` calls and composable groups.
Test: updated compiler and runtime tests
Fixes: 315855015
Change-Id: If379f305f7c3db1fc297dc517b63b72fa662be4e
M compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTests/testComposableCallInArgument[useFir = false].txt
M compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTests/testComposableCallInArgument[useFir = true].txt
M compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTests/testCompositionLocalCallAsInput[useFir = false].txt
M compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTests/testCompositionLocalCallAsInput[useFir = true].txt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/AbstractComposeLowering.kt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposableFunctionBodyTransformer.kt
M compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionTests.kt
https://android-review.googlesource.com/2873554
Branch: androidx-main
commit 90c191c06981868219a5487814798196b32d1b55
Author: Andrei Shikov <ashikov@google.com>
Date: Wed Dec 13 06:35:42 2023
Hoist remember parameters out of intrinsic remember
Pulls expressions that might contain calls (or side effects) outside of the remember group. The parameter can technically have a composable expression, which was interleaving `changed` calls and composable groups.
Test: updated compiler and runtime tests
Fixes: 315855015
Change-Id: If379f305f7c3db1fc297dc517b63b72fa662be4e
M compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTests/testComposableCallInArgument[useFir = false].txt
M compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTests/testComposableCallInArgument[useFir = true].txt
M compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTests/testCompositionLocalCallAsInput[useFir = false].txt
M compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTests/testCompositionLocalCallAsInput[useFir = true].txt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/AbstractComposeLowering.kt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposableFunctionBodyTransformer.kt
M compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionTests.kt
Description
Jetpack Compose version:
Jetpack Compose component used: compiler and runtime
Android Studio Build: Hedgehog | 2023.1.1 Build #AI-231.9392.1.2311.11076708, built on November 9, 2023
Kotlin version: 1.9.21
I encountered this crash upgrading Kotlin from 1.9.20 to 1.9.21. When I switched our project to Kotlin 1.9.21, one of our compositions started to crash.
In this view I’ve isolated the problem:
This sample uses Paparazzi to snapshot a composition in a test case. I don’t believe Paparazzi is necessary to reproduce this.
I believe the problem is that I’m using the result of a
@Composable
function as the argument toremember()
.Stack trace: