A crucial rule is that @ReadOnlyComposable functions can only call other @Composable functions that are also marked as @ReadOnlyComposable. Attempting to invoke a regular UI-emitting composable from within a @ReadOnlyComposable function will lead to a compile-time error. This restriction is vital for maintaining the integrity of the "no UI emission" contract.
In this paragraph you say that this @ReadOnlyComposable only call which have this annotation also but in my case below :
@Composable
fun Test(modifier: Modifier = Modifier) {
Text(text = testMessage())
}
@Composable
@ReadOnlyComposable
fun testMessage(modifier: Modifier = Modifier) : String {
return "Hi"
}
In here Test is composable but not have ReadOnlyComposable why this is able to call my ReadOnlyComposable ?