Rhiad Jaffar
10/28/2021, 10:32 AMkotlin-wrapper
modules:
kotlin-react
kotlin-react-dom
kotlin-styled
kotlin-react-router-dom
We had done this originally using x.x.x-pre.206-kotlin-1.5.10
versions (as this was the code created by latest IntelliJ Community Edition when we created the web project).
When trying to update to x.x.x-pre.261-kotlin-1.5.31
versions we got the following error:
> Task :jsApp:compileDevelopmentExecutableKotlinJs FAILED
e: java.lang.AssertionError: Assertion failed
at org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.JsAstUtilsKt.translateCallArguments(jsAstUtils.kt:341)
at org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.JsAstUtilsKt.translateCall(jsAstUtils.kt:109)
at org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.IrElementToJsExpressionTransformer.visitCall(IrElementToJsExpressionTransformer.kt:219)
at org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.IrElementToJsExpressionTransformer.visitCall(IrElementToJsExpressionTransformer.kt:23)
at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:47)
... etc
Turns out we needed to change a coding pattern we had used (which seems valid and the IDE does not complain about). It seems the compiler no longer supports using fun
and then passing the function reference as a prop?
- fun handleLoginPressed() {
+ val handleLoginPressed = {
loginController.handleLoginPressed()
}
@@ -49,7 +49,7 @@
child(Welcome::class){
attrs {
welcomeString = platform.platform
- goToLogin = ::handleLoginPressed
+ goToLogin = handleLoginPressed
}
}
}
Lines starting with -
cause the above error. Lines starting with +
fix it and the code compiles successfully.
So the question we have is:
Was this an intended change to the compiler? Or might this be a regression?
Happy to share more code/info if it helps.
Many thanks!turansky
10/28/2021, 2:08 PMRhiad Jaffar
10/28/2021, 2:11 PMturansky
10/28/2021, 2:20 PM./gradlew clean
./gradlew --stop
2. Close IDEA
3. Remove all folders inside %USER%/.gradle
(gradle.properties
- remains)
4. Restart machine
5. Checkturansky
10/28/2021, 2:22 PMRhiad Jaffar
10/28/2021, 3:05 PM