appKODE / detekt-rules-compose

A collection of Detekt rules for Jetpack Compose
MIT License
136 stars 8 forks source link

False positive on `ReusedModifierInstance` when shadowing modifier #30

Open BraisGabin opened 1 year ago

BraisGabin commented 1 year ago

1.3.0 fixed a lot a false positives of ReusedModifierInstance. But there is one that it wasn't fixed yet. I created a test case to make it easy to reproduce it:

@Composable
fun Extra(a: @Composable (Modifier) -> Unit) {}
@Composable
fun Test(
  modifier: Modifier = Modifier, 
) {
  Column(modifier) {
    Extra { modifier ->
      Text("Hi", modifier)
    }
  }
}

The modifier that I'm using on Text is not the same that the one defined on Test.

dimsuz commented 1 year ago

Thank you, I'll take a look!