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

An expect/actual function with default arguments and a Composable argument fails to run or compile #2806

Closed
ShreckYe opened this issue Feb 27, 2023 · 3 comments
Assignees
Labels
bug Something isn't working compiler Compiler plugin related reproduced

Comments

@ShreckYe
Copy link
Contributor

Describe the bug
Calling an expect/actual function with adefault arguments and a Composable argument throws a NoSuchMethodError during desktop (JVM) run and fails to build with an AssertionError on JS.

Affected platforms
Select one of the platforms below:

  • Desktop
  • Web (K/JS) - HTML based API
  • Possbly others too but I didn't test all of them

Versions

  • Kotlin version*: 1.8.0
  • Compose Multiplatform version*: 1.3.0
  • OS version(s)* (required for Desktop and iOS issues): Ubuntu 22.04.2 LTS
  • OS architecture (x86 or arm64): x86-64
  • JDK (for desktop issues): OpenJDK Runtime Environment (build 17.0.5+8-Ubuntu-2ubuntu122.04)

To Reproduce
Steps and/or the code snippet to reproduce the behavior:

  1. Check out the code at https://github.com/huanshankeji/compose-multiplatform-material/releases/tag/list-item-for-expect-actual-default-argument-issue and see the function itemForIssue
  2. Run the gradle tasks :demo:run and :demo:jsBrowserRun
  3. See error

Expected behavior
The code should build and run without exceptions.

@ShreckYe ShreckYe added bug Something isn't working submitted labels Feb 27, 2023
@igordmn
Copy link
Collaborator

igordmn commented Feb 28, 2023

Thanks!

We had the similar issue in the past. But it seems the bug is not complitly fixed.

This is still reproducible:

// commonMain
expect fun itemInternal(
    key: Any? = null,
    content: @Composable () -> Unit
)

// desktopMain
actual fun itemInternal(
    key: Any?,
    content: @Composable () -> Unit
) {

}

fun main() = singleWindowApplication {
    itemInternal {

    }
}

If we add @Composable to itemInternal, the issue dissapears.

@eymar
Copy link
Member

eymar commented Apr 12, 2023

Fixed in 1.4.0 if used with kotlin 1.8.20

@eymar eymar closed this as completed Apr 12, 2023
ShreckYe added a commit to huanshankeji/compose-multiplatform-html-unified that referenced this issue Apr 16, 2024
This reverts commit d39f6ec.

Remove the workaround code for issue as JetBrains/compose-multiplatform#2806 is already resolved
@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working compiler Compiler plugin related reproduced
Projects
None yet
Development

No branches or pull requests

4 participants