slackhq / compose-lints

Lint checks to aid with a healthy adoption of Compose

Home Page:https://slackhq.github.io/compose-lints

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

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