Mark
03/02/2023, 7:00 AMClassCastException
(for the first
of the Pair
):
internal fun Pair<@Composable () -> String, (() -> Unit)?>.toButton(): @Composable () -> Unit = {
var (label, onClick) = this@toButton // same runtime exception if use `this.first` instead
...
}
shikasd
03/04/2023, 2:17 PMMark
04/02/2023, 6:32 AMvar positiveButton: (Pair<@Composable () -> String, T>)? = null
Usually, I assign it like:
positiveButton = @Composable { stringResource(id = labelResId) } to value
But sometimes like:
positiveButton = { label } to value
and that is what is causing the crash.
Instead, I just need to assign like:
positiveButton = @Composable { label } to value
Surely this is a bug? Either the compiler should pick it up, or the runtime should allow it.shikasd
04/02/2023, 4:14 PMMark
04/03/2023, 7:13 AMshikasd
04/03/2023, 7:17 AMMark
04/03/2023, 10:09 AMshikasd
04/03/2023, 6:16 PM{ label }
is a receiver for the to
call. From what I see, it should be properly fixed in K2 inference, but cannot predict if that's the case atm.