Thread
#compose
    Zsolt

    Zsolt

    2 years ago
    I'm getting
    java.lang.IllegalStateException: Couldn't find composer parameter
    , any ideas? (stack trace in thread)
    java.lang.IllegalStateException: Couldn't find composer parameter
       at androidx.compose.plugins.kotlin.compiler.lower.ComposableCallTransformer.nearestComposer(ComposableCallTransformer.kt:535)
       at androidx.compose.plugins.kotlin.compiler.lower.ComposableCallTransformer.irComposableExpr(ComposableCallTransformer.kt:374)
       at androidx.compose.plugins.kotlin.compiler.lower.ComposableCallTransformer.visitCall(ComposableCallTransformer.kt:150)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:173)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:89)
       at org.jetbrains.kotlin.ir.expressions.IrExpression$DefaultImpls.transform(IrExpression.kt:28)
       at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrCallWithIndexedArgumentsBase.transformChildren(IrCallWithIndexedArgumentsBase.kt:70)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:288)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:283)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpression(IrElementTransformerVoid.kt:112)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitMemberAccess(IrElementTransformerVoid.kt:166)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionAccess(IrElementTransformerVoid.kt:169)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:172)
       at androidx.compose.plugins.kotlin.compiler.lower.ComposableCallTransformer.visitCall(ComposableCallTransformer.kt:163)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:173)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:89)
       at org.jetbrains.kotlin.ir.expressions.IrExpression$DefaultImpls.transform(IrExpression.kt:28)
       at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl.transformChildren(IrReturnImpl.kt:47)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:288)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:283)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpression(IrElementTransformerVoid.kt:112)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitReturn(IrElementTransformerVoid.kt:250)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitReturn(IrElementTransformerVoid.kt:251)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitReturn(IrElementTransformerVoid.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl.accept(IrReturnImpl.kt:40)
       at org.jetbrains.kotlin.ir.expressions.IrExpression$DefaultImpls.transform(IrExpression.kt:28)
       at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl.transformChildren(IrBlockBodyImpl.kt:49)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:288)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:283)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBody(IrElementTransformerVoid.kt:93)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:99)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:100)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl.accept(IrBlockBodyImpl.kt:40)
       at org.jetbrains.kotlin.ir.expressions.IrBody$DefaultImpls.transform(IrBody.kt:24)
       at org.jetbrains.kotlin.ir.expressions.IrBlockBody$DefaultImpls.transform(IrBody.kt)
       at org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl.transform(IrBlockBodyImpl.kt:26)
       at org.jetbrains.kotlin.ir.declarations.impl.IrFunctionBase.transformChildren(IrFunctionBase.kt:77)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:288)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:283)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:46)
       at androidx.compose.plugins.kotlin.compiler.lower.ComposableCallTransformer.visitDeclaration(ComposableCallTransformer.kt:125)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunction(IrElementTransformerVoid.kt:55)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:58)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:59)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:24)
       at org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl.accept(IrFunctionImpl.kt:89)
       at org.jetbrains.kotlin.ir.declarations.IrDeclaration$DefaultImpls.transform(IrDeclaration.kt:42)
       at org.jetbrains.kotlin.ir.declarations.impl.IrDeclarationBase.transform(IrDeclarationBase.kt:27)
       at org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl.transformChildren(IrFunctionExpressionImpl.kt:34)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:288)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:283)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpression(IrElementTransformerVoid.kt:112)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionExpression(IrElementTransformerVoid.kt:203)
       at androidx.compose.plugins.kotlin.compiler.lower.ComposableCallTransformer.visitFunctionExpression(ComposableCallTransformer.kt:190)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionExpression(IrElementTransformerVoid.kt:205)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionExpression(IrElementTransformerVoid.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl.accept(IrFunctionExpressionImpl.kt:26)
       at org.jetbrains.kotlin.ir.expressions.IrExpression$DefaultImpls.transform(IrExpression.kt:28)
       at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrCallWithIndexedArgumentsBase.transformChildren(IrCallWithIndexedArgumentsBase.kt:70)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:288)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:283)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpression(IrElementTransformerVoid.kt:112)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitMemberAccess(IrElementTransformerVoid.kt:166)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionAccess(IrElementTransformerVoid.kt:169)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:172)
       at androidx.compose.plugins.kotlin.compiler.lower.ComposableCallTransformer.visitCall(ComposableCallTransformer.kt:163)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:173)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:89)
       at org.jetbrains.kotlin.ir.expressions.IrExpression$DefaultImpls.transform(IrExpression.kt:28)
       at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrBranchImpl.transformChildren(IrWhenImpl.kt:89)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:288)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:283)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitElseBranch(IrElementTransformerVoid.kt:223)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitElseBranch(IrElementTransformerVoid.kt:224)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitElseBranch(IrElementTransformerVoid.kt:24)
       at org.jetbrains.kotlin.ir.expressions.IrElseBranch$DefaultImpls.transform(IrWhen.kt:42)
       at org.jetbrains.kotlin.ir.expressions.impl.IrElseBranchImpl.transform(IrWhenImpl.kt:94)
       at org.jetbrains.kotlin.ir.expressions.impl.IrElseBranchImpl.transform(IrWhenImpl.kt:94)
       at org.jetbrains.kotlin.ir.expressions.impl.IrWhenBase.transformChildren(IrWhenImpl.kt:44)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:288)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:283)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpression(IrElementTransformerVoid.kt:112)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitWhen(IrElementTransformerVoid.kt:217)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitWhen(IrElementTransformerVoid.kt:218)
       at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitWhen(IrElementTransformerVoid.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrWhenBase.accept(IrWhenImpl.kt:36)
       at org.jetbrains.kotlin.ir.expressions.IrExpression$DefaultImpls.transform(IrExpression.kt:28)
       at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:24)
       at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:24)
       at ...
    l

    Leland Richardson [G]

    2 years ago
    hmm. this is likely from a situation where you are calling a composable function from outside of a composable function
    if you can narrow it down to the source code that triggers the error, i’d be interested in seeing it so we can have it fail earlier (its supposed to be an IDE-time error)
    Zsolt

    Zsolt

    2 years ago
    I didn't add new code, just updated dev05 -> dev07. I'll try to narrow it down.
    l

    Leland Richardson [G]

    2 years ago
    yeah, there was a very big infrastructural change to the compiler in dev06
    this wouldn’t have failed prior to that
    Zsolt

    Zsolt

    2 years ago
    looks like I found it
    so I had extension method
    private fun StackScope.foo() {}
    with composables inside, but no Composable annotation on it, and calling it like
    Stack { foo() }
    funny thing is as soon as I commented out the call site, IDE gave me warning correctly
    but while it's being referenced, it doesn't complain
    l

    Leland Richardson [G]

    2 years ago
    hmm. can you paste more complete repro? which part are you commenting out?
    Zsolt

    Zsolt

    2 years ago
    sure
    I was migrating Pokedex, this file:
    you can see lines 53-59
    if I comment them out, IDE fails correctly that those extension methods don't have Composable annotation
    but it doesn't fail if they're not commented out
    l

    Leland Richardson [G]

    2 years ago
    oh strange
    if you comment out the callsites in Content, then the declarations (like line 81) would show an error?
    Zsolt

    Zsolt

    2 years ago
    yes, all of them
    l

    Leland Richardson [G]

    2 years ago
    eek
    that’s not good lol
    can you try removing
    private
    from all of them and see if that for some strange reason fixes it?
    Zsolt

    Zsolt

    2 years ago
    sure
    l

    Leland Richardson [G]

    2 years ago
    (sounds stupid but private access is implemented in strange ways in kotlin)
    Zsolt

    Zsolt

    2 years ago
    nope, even without private it gets to compiler exception
    l

    Leland Richardson [G]

    2 years ago
    the exception i would still expect to happen
    but i’m wondering if the IDE is quicker to yell at you
    Zsolt

    Zsolt

    2 years ago
    I meant yes, IDE lets it through without warning
    l

    Leland Richardson [G]

    2 years ago
    boo
    ok
    Zsolt

    Zsolt

    2 years ago
    private doesn't make a difference
    l

    Leland Richardson [G]

    2 years ago
    thanks!
    Zsolt

    Zsolt

    2 years ago
    nw
    thanks for useful pointer to problem
    l

    Leland Richardson [G]

    2 years ago
    i’ll add this to the list of problems with our frontend analysis
    Zsolt

    Zsolt

    2 years ago
    but again, point is IDE somehow still finds it if the call site is commented out, not sure what difference it makes, but might be a helpful detail
    l

    Leland Richardson [G]

    2 years ago
    yep. that does help