This might be another snippet that triggers a compiler error. However, my compose version is not the latest (and I'm unable to upgrade it right now).
Would you tell me if it's not fixed yet, so I can open an issue? (similar version that compiles in thread).
Copy code
@Composable
fun Err() {
suspend fun AwaitPointerEventScope.handler() {
awaitPointerEvent(pass = PointerEventPass.Initial).changes.forEach {
it // <-- triggers the compiler error
}
}
Spacer(modifier = Modifier.pointerInput(Unit) {
awaitPointerEventScope {
handler()
}
})
}
ste
09/26/2021, 2:56 PM
Fine version:
Copy code
@Composable
fun Ok() {
val handler: suspend AwaitPointerEventScope.() -> Unit = {
awaitPointerEvent(pass = PointerEventPass.Initial).changes.forEach {
it
}
}
Spacer(modifier = Modifier.pointerInput(Unit) {
awaitPointerEventScope {
handler()
}
})
}