dataframe icon indicating copy to clipboard operation
dataframe copied to clipboard

Compiler plugin generated local types from `@Composable` lambdas don't work

Open Jolanrensen opened this issue 3 weeks ago • 2 comments

Image

The error reads 'val DataRow<Person_59I>.age2: Int' cannot be called in this context with an implicit receiver. Use an explicit receiver if necessary. Unfortunately, the only way to fix it seems to be moving it outside the lambda body.

To reproduce:

@DataSchema
data class Person(val age: Int, val name: String)

@Composable
fun DataFrameScreen(df: DataFrame<Person>) {
    val a = df
        .add("age2") { age }
        .filter { age2 >= 20 }
    a.age
    a.age2

    Column {
        val b = df
            .add("age2") { age }
            .filter { age2 >= 20 }
        b.age
        b.age2
        a.age
        a.age2
    }
}

Jolanrensen avatar Dec 03 '25 15:12 Jolanrensen

Workaround: put all dataframe code at the top of Composable function outside lambdas. Actually only code that generated local types such as add, convert. filter is ok inside lambda. But i'd say just move everything.

koperagen avatar Dec 15 '25 17:12 koperagen

Maybe we can put a note about this in the compiler plugin docs on the website :) and then link to it from our documentation about using dataframe on android

Jolanrensen avatar Dec 16 '25 10:12 Jolanrensen