Pattern matching on jvm and js does not same


#1

Hi everyone!
On “Try online” page I found some strange thing, that seems like a bug

data class Vector2(val x: Int, val y: Int)
data class BS(val s:String)

fun main(args: Array<String>) {
    val v = Vector2(3, 4)
    when (v) {
        Vector2(3,4) -> println("Object")
        is Vector2 -> println("Type")
    }
}

on JVM target it prints “Object”.
then I changed target to JS. now it prints “Type”


#2

It’s bug in JS backend, please file an issue to tracker.