compose-rules icon indicating copy to clipboard operation
compose-rules copied to clipboard

ModifierMissing detected wrongly

Open alashow opened this issue 7 months ago • 0 comments

Hello,

I have a case where ModifierMissing is being detected incorrectly when function doesn't emit a function.

Example:

       // ModifierMissing error because of cellWrapper
        @Composable
        fun testModifier1() = NumberPadStyle(
            size = Size.Scaled,
            cellTextStyle = Theme.typography.h2, // requires @Composable
            cellWrapper = { cell ->
                Text(text = "test", modifier = cell.modifier)
            }
        )

        // no ModifierMissing detected
        @Composable
        fun testModifier2() = NumberPadStyle(
            size = Size.Scaled,
            cellTextStyle = Theme.typography.h2, // requires @Composable
        )

        // no ModifierMissing detected (because not using @Composable)
        fun testModifier3() = NumberPadStyle(
            size = Size.Scaled,
            cellTextStyle = TextStyle(),
            cellWrapper = { cell ->
                Text(text = "test", modifier = cell.modifier)
            }
        )

In my case, cellWrapper is a lambda that is composable that emits content, but testModifier1 function itself doesn't emit any content

alashow avatar Jun 03 '25 16:06 alashow