Fixed
Status Update
Comments
yo...@gmail.com <yo...@gmail.com> #2
Ignore this msg
as...@google.com <as...@google.com>
as...@google.com <as...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit e7b4b06e67951ab47157d06ff314a5c8b2e8fdc6
Author: Andrei Shikov <ashikov@google.com>
Date: Mon Jan 08 15:54:51 2024
Count recursive local declarations as captures
Local declarations were already counted as captures for composable lambdas before, but the traversal ordering missed the recursive captures, converting some of them into singletons.
Test: Compiler test
Fixes: 318745941
Change-Id: I9097d1be71fb67b73e5027f723fd187c4272f6b4
M compose/compiler/compiler-hosted/integration-tests/src/androidUnitTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposeBytecodeCodegenTest.kt
M compose/compiler/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/AbstractCodegenTest.kt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerLambdaMemoization.kt
https://android-review.googlesource.com/2900890
Branch: androidx-main
commit e7b4b06e67951ab47157d06ff314a5c8b2e8fdc6
Author: Andrei Shikov <ashikov@google.com>
Date: Mon Jan 08 15:54:51 2024
Count recursive local declarations as captures
Local declarations were already counted as captures for composable lambdas before, but the traversal ordering missed the recursive captures, converting some of them into singletons.
Test: Compiler test
Fixes: 318745941
Change-Id: I9097d1be71fb67b73e5027f723fd187c4272f6b4
M compose/compiler/compiler-hosted/integration-tests/src/androidUnitTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposeBytecodeCodegenTest.kt
M compose/compiler/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/AbstractCodegenTest.kt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerLambdaMemoization.kt
as...@google.com <as...@google.com> #4
Nvm, I think the repro works on my side because of strong skipping.
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit 77128e08f24eba21d3a0e416ac238917a235dd8c
Author: Andrei Shikov <ashikov@google.com>
Date: Mon Jan 15 19:29:09 2024
Force .changed for function types with intrinsic remember
Intrinsic remember currently uses the same .changed implementation as skipping. This changes behavior when key is of function type, recreating remembered value more frequently.
Fixes: 319810819
Test: Compiler & runtime tests
Change-Id: I748272758d15a0716cea646d451880daf1384492
M compose/compiler/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/RememberIntrinsicTransformTests.kt
A compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTestsStrongSkipping/testRememberMethodReference[useFir = false].txt
A compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTestsStrongSkipping/testRememberMethodReference[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/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerLambdaMemoization.kt
M compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/JvmCompositionTests.kt
https://android-review.googlesource.com/2910583
Branch: androidx-main
commit 77128e08f24eba21d3a0e416ac238917a235dd8c
Author: Andrei Shikov <ashikov@google.com>
Date: Mon Jan 15 19:29:09 2024
Force .changed for function types with intrinsic remember
Intrinsic remember currently uses the same .changed implementation as skipping. This changes behavior when key is of function type, recreating remembered value more frequently.
Fixes: 319810819
Test: Compiler & runtime tests
Change-Id: I748272758d15a0716cea646d451880daf1384492
M compose/compiler/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/RememberIntrinsicTransformTests.kt
A compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTestsStrongSkipping/testRememberMethodReference[useFir = false].txt
A compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.RememberIntrinsicTransformTestsStrongSkipping/testRememberMethodReference[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/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerLambdaMemoization.kt
M compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/JvmCompositionTests.kt
na...@google.com <na...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.wear.protolayout:protolayout-material-core:1.1.0-rc01
androidx.wear.tiles:tiles-tooling:1.3.0-rc01
androidx.wear.tiles:tiles-tooling-preview:1.3.0-rc01
Description
Jetpack Compose version: bom
2023.10.01
Jetpack Compose component(s) used:
remember
Kotlin version:
1.9.22
compose compiler:
1.5.8
The way
remember
treats Java method refs as keys differs with Intrinsic remember.The
Slider
in the code below DOES work if intrinsicremember
is disabled. but you can NOT slide theSlider
if intrinsicremember
is enabled (which is the default in 1.5.8)The
Slider
also works with kotlin 1.9.20 and 1.5.5 (before intrinsicremember
was enabled by default) .Also, note that if you use a Kotlin class instead of a Java class here then the Slider works fine with intrinsic
remember
enabled.The problem seems to be that
remember
thinks the methodRef key is changing on every recomposition when intrinsicremember
is enabled .This is a minimal reproducer.
Note: here is the config to disable
intrinsicRemember