Hello,
I have noticed that type checks (is- and when-expressions) in the Javascript backend doesn’t seem to work for traits.
The following code works in the jvm but not in javascript:
trait Fruit {} open class Apple : Fruit {} class RedApple : Apple() {} fun main(args : Array<String>) { val apple = RedApple() if (apple is RedApple) println("apple is RedApple") if (apple is Apple) println("apple is Apple") if (apple is Fruit) println("apple is Fruit") }
In java "apple" is a Fruit, an Apple and a RedApple. But in Javascript it is only an Apple and a RedApple.My question is: do you plan to fully support traits in the javascript-backend in the future?
/Tobias W