JS backend: fix is for trait. #KT-3519 fixed

This commit is contained in:
Erokhin Stanislav
2013-09-20 16:22:14 +04:00
parent 649318a6c6
commit 0e6d9e857c
4 changed files with 93 additions and 1 deletions
@@ -0,0 +1,20 @@
package foo
open class A
trait B
class C: A(), B
fun box(): String {
val a = A()
val b = object : B {}
val c = C()
if (a is B) return "a is B"
if (b !is B) return "b !is B"
if (c !is B) return "c !is B"
return "OK"
}
@@ -0,0 +1,36 @@
package foo
trait A
trait B : A
trait C : A
trait D : B, C
trait E : C
open class CB: B
class CB2: CB()
class CD: D
fun testPhrase(o: Any): String {
var s = ""
s += if(o is A) "Y" else "N"
s += if(o is B) "Y" else "N"
s += if(o is C) "Y" else "N"
s += if(o is D) "Y" else "N"
s += if(o is E) "Y" else "N"
return s
}
fun box(): String {
val b = CB()
val b2 = CB2()
val d = CD()
val e = object : E {}
if (testPhrase(b) != "YYNNN") return "bad b, it: ${testPhrase(b)}"
if (testPhrase(b2) != "YYNNN") return "bad b2, it: ${testPhrase(b2)}"
if (testPhrase(d) != "YYYYN") return "bad d, it: ${testPhrase(d)}"
if (testPhrase(e) != "YNYNY") return "bad e, it: ${testPhrase(e)}"
return "OK"
}