False positive for ComposeContentEmitterReturningValues
ansman opened this issue · comments
It seems that, in at least some cases, ComposeContentEmitterReturningValues
is incorrectly reported when ComposeMultipleContentEmitters
is also detected.
Here is an example:
@Composable
fun Example(modifier: Modifier = Modifier) {
Box(modifier = modifier)
Box(Modifier)
}
![image](https://private-user-images.githubusercontent.com/102883/261403805-7860f411-978e-4bb9-8479-ed6001c87080.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI4ODA0MTcsIm5iZiI6MTcyMjg4MDExNywicGF0aCI6Ii8xMDI4ODMvMjYxNDAzODA1LTc4NjBmNDExLTk3OGUtNGJiOS04NDc5LWVkNjAwMWM4NzA4MC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODA1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwNVQxNzQ4MzdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01MWY5MWE5MDU0NzU0NTg1MThhNTRmYWE3MWFhMDg5MzVhZjAzY2NkZTIyOGQ4MzAwODAyNzcyMzg0MDI1NTIxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.LNxLSb2gySKMXI5XJXI-VO76LVubuQR3OWLx_8F4T3c)
Removing the second Box
removes both errors.
Also, adding @SuppressLint("ComposeContentEmitterReturningValues", "ComposeMultipleContentEmitters")
does not suppress the issue.
Versions:
- compose-lints 1.2.0
- AGP 8.2.0-alpha16
- Android Studio Hedgehog | 2023.1.1 Canary 16
- Kotlin 1.8.21
The expected result here would be to only report the "do-not-emit-multiple-pieces-of-content" issue right? Since that one is in fact happening here.
Because I am experiencing the same thing now, and wanted to double check.
Yes, the composable is returning Unit/void so it's not returning a value
I'm unable to reproduce this on main
. Here's what I tested https://github.com/slackhq/compose-lints/tree/z/repro166
Feel free to close then, It happened to 100% of the time for me so if you can't repro it it's likely fixed