Hey there kotliners, I managed to find another bug...
# javascript
a
Hey there kotliners, I managed to find another bug as well Problem When a function takes more than one argument, any attempt to use a previous argument to set the value of its successive argument, the JSIR compiler fails with a weird error Reproducer Reproducer can be found at https://github.com/andylamax/kotlin-battleground/blob/master/JSIR-DefaultArgumentU[…]rc/test/kotlin/battleground/problem/DefaultArgumentUsageTest.kt Elaboration Consider the following block of code
Copy code
class UserService {
    fun createUser(
        name: String, tag: String = name
    ) = "User(name=$name,tag=$tag)"
}
This breaks the compiler and no output can be generated Expected Behavior This should work the same as it does in Kotlin/JVM and Kotlin/Native, or without 
@JsExport
Workaround • Avoid using 
@JsExport
This problem appears to happen only when you mark interfaces and classes with 
@JsExport
, so if you can, avoid using 
@JsExport
• Use nullables instead
Copy code
class UserService {
    fun createUser(
        name: String, tag: String? = null
    ) = "User(name=$name,tag=${tag ?: name})"
}
Apprently, this has already been reported here. So give an up vote please