Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using LazyListScope as parameter to other function should be possible on iOS #3087

Closed
MikolajKakol opened this issue Apr 22, 2023 · 6 comments
Assignees
Labels
bug Something isn't working compiler Compiler plugin related duplicate This issue or pull request already exists reproduced

Comments

@MikolajKakol
Copy link

Describe the bug
Given code should compile

fun foo(
    content: LazyListScope.() -> Unit
) {
}

It fails with error:

error: There are still 3 unbound symbols after generation of IR module <shared>:
Unbound public symbol IrSimpleFunctionPublicSymbolImpl: androidx.compose.foundation.lazy/LazyListScope.item|-2398404341226065315[0]
Unbound public symbol IrSimpleFunctionPublicSymbolImpl: androidx.compose.foundation.lazy/LazyListScope.items|8564101490881923997[0]
Unbound public symbol IrSimpleFunctionPublicSymbolImpl: androidx.compose.foundation.lazy/LazyListScope.stickyHeader|431226128286809998[0]

Affected platforms
Select one of the platforms below:

  • iOS

Versions

  • Kotlin version*: 1.8.20
  • Compose Multiplatform version*: 1.4.0
  • OS version(s)* (required for Desktop and iOS issues): 16.2
  • OS architecture (x86 or arm64): x86
@MikolajKakol MikolajKakol added bug Something isn't working submitted labels Apr 22, 2023
@eymar eymar added compiler Compiler plugin related reproduced and removed submitted labels Apr 24, 2023
@eymar
Copy link
Collaborator

eymar commented Apr 24, 2023

Reproduced. Adding a bit more context:

Same function with @Composable annotation does work:

@Composable
fun foo(
    content: LazyListScope.() -> Unit
) {
}

Or this works too:

fun foo(
    content: @Composable LazyListScope.() -> Unit
) {
}

@MikolajKakol Thank you for submitting the bug. I just want to confirm that your intention was indeed to not have @Composable anntation neither on the foo function nor the content lambda?
Regardless, the issue is valid and it should compile.

@eymar eymar self-assigned this Apr 24, 2023
@MikolajKakol
Copy link
Author

Yes, it is intended. We use it to separate the code that goes into LazyColumn. Errors, I provided here and before are from migrating a large Android project with around 200 screens in compose.

@MikolajKakol
Copy link
Author

An interesting workaround is to add an empty composable like this:

fun foo(
    content: LazyListScope.() -> Unit
    t: @Composable () -> Unit = {},
) {
}

@eymar
Copy link
Collaborator

eymar commented Apr 26, 2023

Thanks for extra input. It's helpful

@eymar
Copy link
Collaborator

eymar commented May 22, 2023

The workaround is to add @HiddenFromObjC annotation:

@OptIn(ExperimentalObjCRefinement::class)
@HiddenFromObjC
fun foo(
    content: LazyListScope.() -> Unit
) {
}

A proper fix is in progress.

@eymar
Copy link
Collaborator

eymar commented May 22, 2023

I close this issue if you don't mind. I'm sure it's a duplicate of #3086 because they have the same workaround.

@eymar eymar closed this as completed May 22, 2023
@eymar eymar added the duplicate This issue or pull request already exists label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler Compiler plugin related duplicate This issue or pull request already exists reproduced
Projects
None yet
Development

No branches or pull requests

3 participants