Fixed
Status Update
Comments
mo...@google.com <mo...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 95480d6173e8f7da5d40b6769f868fddd8353aff
Author: Andrei Shikov <ashikov@google.com>
Date: Fri Feb 02 18:19:50 2024
Use dispatcher parameter to check if the function is inside local class
Compose marks dispatch receiver as "used" for skipping purposes (even if it is not used) whenever it is a local class that may capture values from the outer scope. Some functions, however, can be inside the local class, but don't use it as a dispatch receiver.
Instead of checking if function's parent is local, we should check if function dispatch receiver is local and always mark it as used in that case.
Fixes: 323123439
Test: Added a transform test
Change-Id: I212ffbd60b5354b9336216e9d1e76952fea891a9
M compose/compiler/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposerParamTransformTests.kt
A compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/composableLocalFunctionInsideLocalClass[useFir = false].txt
A compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/composableLocalFunctionInsideLocalClass[useFir = true].txt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposableFunctionBodyTransformer.kt
https://android-review.googlesource.com/2946725
Branch: androidx-main
commit 95480d6173e8f7da5d40b6769f868fddd8353aff
Author: Andrei Shikov <ashikov@google.com>
Date: Fri Feb 02 18:19:50 2024
Use dispatcher parameter to check if the function is inside local class
Compose marks dispatch receiver as "used" for skipping purposes (even if it is not used) whenever it is a local class that may capture values from the outer scope. Some functions, however, can be inside the local class, but don't use it as a dispatch receiver.
Instead of checking if function's parent is local, we should check if function dispatch receiver is local and always mark it as used in that case.
Fixes: 323123439
Test: Added a transform test
Change-Id: I212ffbd60b5354b9336216e9d1e76952fea891a9
M compose/compiler/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/ComposerParamTransformTests.kt
A compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/composableLocalFunctionInsideLocalClass[useFir = false].txt
A compose/compiler/compiler-hosted/integration-tests/src/test/resources/golden/androidx.compose.compiler.plugins.kotlin.ComposerParamTransformTests/composableLocalFunctionInsideLocalClass[useFir = true].txt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposableFunctionBodyTransformer.kt
pr...@google.com <pr...@google.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.compiler:compiler-hosted:1.5.10
Description
####################################################
Please provide all of the following information, otherwise we may not be able to route your bug report.
####################################################
Crash in compiler. This used to work with compiler 1.5.3
Setup:
composeOptions.kotlinCompilerExtensionVersion = "1.5.8"
implementation(platform("androidx.compose:compose-bom:2024.01.00"))
Code:
```
abstract class C{
@Composable
abstract fun Render()
}
fun test(){
object: C(){
@Composable
override fun Render() {
@Composable
fun Buts() {
Button( {
}){
}
}
Text("Hello")
}
}
}
```
Crash at compile time is attached
In addition to logs, please attach a screenshot or recording that illustrates the problem.
For more information on how to get your bug routed quickly, see
Build: AI-232.10227.8.2321.11280706, 202401052329
AI-232.10227.8.2321.11280706, JRE 17.0.9+0--11185874x64 JetBrains s.r.o., OS Windows 11(amd64) v10.0 , screens 3200.0x1800.0
AS: Iguana | 2023.2.1 Beta 2
Kotlin plugin: 232-1.9.0-release-358-AS10227.8.2321.11280706
Android Gradle Plugin: 8.2.2
Gradle: 8.4
Gradle JDK: JetBrains Runtime version 17.0.7
```