In the TextField composable code, I noticed it ann...
# compose
z
In the TextField composable code, I noticed it annotated the lambda for the decoration box with @Composable, however it works without it. Does the compiler do something different when it's there?
z
You mean this? https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt;l=210;drc=ab08e07d4ba9c46eb461d2dd3e51549d6ad44707 It shouldn’t matter. I’m guessing that’s maybe leftover from an early time when the compiler wasn’t smart enough to infer that a lambda passed as a parameter marked composable should also be composable, but it is now.
z
That's probably it, wasn't sure if there was some intention behind annotating it
z
AFAIK, that annotation is mostly useful for type _inference_:
Copy code
val myContent = @Composable { … }