https://kotlinlang.org logo
c

CLOVIS

05/22/2022, 3:27 PM
Is there a known bug with Compose for web and inheritance? I have something like
Copy code
interface Parent {
  @Composable
  fun render(...)
}

class Child {
  @Composable
  override fun render(...)
}
Calling the
render
function on a child leads to:
Copy code
Uncaught TypeError: $localVariable.render$composable_49qbjn_k$ is not a function
    at eval (Navigation.kt?fd6e:149:17)
After inspecting the object, its prototype has a
'render_4kj0y7_k$'
function. Did something go wrong when Compose/Kotlin mangled the object? Adding
@JvmName("render")
to the parent class changes the function name in the error message, but it doesn't change which functions the object implements (its prototype still has `'render_4kj0y7_k$'`and not
'render'
)
j

jw

05/22/2022, 6:19 PM
Are you running the compiler against both source files? Are they in the same compilation unit or separate?
c

CLOVIS

05/22/2022, 6:54 PM
They are both in the same Gradle project, however the interface is in
commonMain
and the implementation is in
jsMain
Ah, no, they're both in
commonMain
• Abstract method: https://kotlinlang.slack.com/archives/C01F2HV7868/p1653233265875689 • both implementations are in https://gitlab.com/opensavvy/clovis/-/blob/25-webpack/utils.ui/src/commonMain/kotlin/clovis.ui/navigation/Builders.kt It's far from being a minimal reproduction repo though, so please tell me if you need any more info
g

Grégory Lureau

05/23/2022, 7:13 AM
KotlinJs had a mangling issue on 1.6.20 (fixed on 1.6.21) but looks like you're on 1.5.31 (not sure if this version also had mangling issues, but maybe worth trying an upgrade).
o

Oleksandr Karpovich [JB]

05/23/2022, 9:50 AM
@CLOVIS thanks for reporting. https://github.com/JetBrains/compose-jb/issues/2067 - here I added a more simple repro sample.
👍🏻 1
c

CLOVIS

05/23/2022, 3:17 PM
@Grégory Lureau I should be on 1.6.21. Maybe you looked at the
main
branch (no problems there)? Otherwise, there might be something wrong in the config somewhere
👍 1
@Oleksandr Karpovich [JB] thanks, following the issue.
3 Views