Status Update
Comments
pa...@gmail.com <pa...@gmail.com> #2
Also doesn't work in AS 2024.3.2 Canary 4 and Compose 1.8.0-beta01
sj...@gmail.com <sj...@gmail.com> #3
Andrei: Is this the same as
ol...@gmail.com <ol...@gmail.com> #4
Triage notes: Needs investigation. Assigning for later.
[Deleted User] <[Deleted User]> #5
Could you share the AppScaffoldTopBar
function that fails here? This seems different from
ac...@gmail.com <ac...@gmail.com> #6
Reconstructed from IR:
@Composable
fun AppScaffoldTopBar(
showBackArrow: Boolean,
showSearch: Boolean,
title: String?,
onBackClick: () -> Unit,
modifier: Modifier = Modifier,
actions: ImmutableList<AppScaffoldNavigationAction>
) {
if (!showSearch) {
TitledTopAppBar(
title = title,
showBackArrow = showBackArrow,
modifier = modifier,
actions = actions,
onBackClick = onBackClick
)
} else {
TopAppBar(
title = {
// Composable lambda for title
AppScaffoldTopBarTitle(showBackArrow)
},
modifier = modifier,
navigationIcon = {
// Composable lambda for navigation icon
AppScaffoldTopBarNavigationIcon(showBackArrow, onBackClick)
},
actions = {
// Composable lambda for actions
AppScaffoldTopBarActions(actions)
}
)
}
}
This seems /extremely/ weird to me, because showSearch
is just a regular parameter that is used in function body only once. We need more context about surrounding code to figure out why it crashed the compiler.
ac...@gmail.com <ac...@gmail.com> #7
sure i can paste more source. let me see what I can give you. do you need internals or externals?
al...@google.com <al...@google.com> #8
Triage notes: We're still lacking the necessary Kotlin compiler hooks to implement this, but it's still something we'd like to fix. Low priority since it wouldn't be a huge performance win -- moving to backlog.
al...@google.com <al...@google.com> #9
Triage notes: Dependent on K2.
ey...@gmail.com <ey...@gmail.com> #10
Is there a issue on Kotlin's YouTrack we can follow for this?
If it helps, my use case is more about usability, e.g. I have this test helper:
inline fun <Intent, ViewState> intentTest(
composeTestRule: ComposeContentTestRule,
state: ViewState,
crossinline view: @Composable (ViewState, (Intent) -> Unit) -> Unit,
block: IntentTest<Intent>.() -> Unit,
) = IntentTest<Intent>(composeTestRule).apply {
composeTestRule.setContent {
view(
state,
) { lastIntent = it }
}
block()
}
which I would prefer to use like this:
intentTest(
composeTestRule = composeTestRule,
state = createState(),
view = ::MyView,
) { ... }
but instead have to use like this:
intentTest<MyIntent, MyViewState>(
composeTestRule = composeTestRule,
state = createState(),
view = { state, onIntent ->
MyView(state, onIntent)
}
) { ... }
Note that the compiler complains that it can't infer the types because there are multiple lambdas, but when I specify them like this it says that they can be inferred.
mg...@gmail.com <mg...@gmail.com> #11
As my original description references, there is a youtrack issue but JetBrains rejected it. JetBrains said it was a 3rd party issue, and that's why I originally reported this here.
as...@google.com <as...@google.com> #12
This should be implemented by the Compose compiler / runtime, but is not the highest priority since workarounds exists.
as...@google.com <as...@google.com>
al...@google.com <al...@google.com> #13
Triage notes: Needs investigation, might have a reasonable fix.
Description
I tried to get a reference to a @Composable function and got an error:
This is an intentional restriction and not a bug, however, it is still an issue for me. I am creating this issue to express that that this impacts me and to hopefully collect votes from other people who it impacts as well.
My original issue on YouTrack was rejected as being a third party issue, and I was directed here.