it should work fine. i think there used to be a bug related to this type of thing but shouldn’t be any more. please file one if it doesn’t work
🧵 2
d
dimsuz
08/25/2022, 5:21 PM
oh, right, I forgot to add curleys, will edit.
Good to know, thanks!
dimsuz
08/25/2022, 5:22 PM
I meant this:
Copy code
fun MyComposable(
value: Boolean,
slot1: @Composable () -> Unit = if (value) { Content1() } else { Content2() },
slot2: @Composable (() -> Unit)? = if (value) { Content1() } else null,
)
l
Leland Richardson [G]
08/25/2022, 5:23 PM
the type system probably won’t like that since the curlies are ambiguous with the if / else blocks but the gist of what you are trying to do should be allowed, yes
d
dimsuz
08/25/2022, 5:26 PM
oh, right! failed again )) But you understood what I meant, yeah. Will report then if something fails (I'm 90% sure it wont if you fixed this)