Hello all, We have a very simple repo for Js/iOS/...
# javascript
r
Hello all, We have a very simple repo for Js/iOS/Android in KMM. For JS we of course use Kotlin/JS and we pull in the following
kotlin-wrapper
modules:
Copy code
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:
Copy code
> 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?
Copy code
-    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!
t
Looks like compiler error Also it can be cache problem (gradle cache or compiler cache) Clean check required
r
Thanks @turansky - yes we did clean and also “Sync project with gradle files” several times. Didn’t seem to make a difference. I should have mentioned that!
t
Super clean check: 1.
Copy code
./gradlew clean
./gradlew --stop
2. Close IDEA 3. Remove all folders inside
%USER%/.gradle
(
gradle.properties
- remains) 4. Restart machine 5. Check
Also you can create separate test example
👍🏼 1
r
Thanks @turansky will give that a go and create a simple example if the issue persists.