orangy
e: …/SnakeLayout.kt: (30, 42): Type inference failed. Expected type mismatch: inferred type is @Composable() (Int, T) -> Unit but (Int, T) -> Unit was expected
Code is kinda like this:
fun <T> SnakeLayout(…,
content: @Composable (Int, T) -> Unit) {
Layout(…,
content = { items.forEachIndexed(content) } // here
) { … }
}
If I expand the call to items.forEachIndexed { i, t -> content(i,t) }
it works fine. In version 0.4.0-build180 both variants worked.
(posting here, because I believe it is more to do with compiler plugin than desktop lib)Dominaezzz
04/17/2021, 12:49 PMAdam Powell
04/17/2021, 1:49 PM@Composable
functions have extra hidden parameters so passing content
to forEachIndexed
isn't having the expected results. Use the lambda call syntax instead with braces and explicitly passing the parameters to content
and you should be back up and running.Adam Powell
04/17/2021, 1:49 PM