add more tests for bridge methods (fake override)

This commit is contained in:
Michael Nedzelsky
2014-10-04 11:44:21 +04:00
parent 2db1d128a0
commit 0c3a7a9d99
6 changed files with 129 additions and 6 deletions
@@ -6,17 +6,24 @@ trait B<T, U> {
fun foo(t: T, u: U) = "B"
}
class Z : A<String>, B<String, Int> {
override fun foo(t: String, u: Int) = "Z"
class Z1 : A<String>, B<String, Int> {
override fun foo(t: String, u: Int) = "Z1"
}
class Z2 : B<String, Int>, A<String> {
override fun foo(t: String, u: Int) = "Z2"
}
fun box(): String {
val z = Z()
val z1 = Z1()
val z2 = Z2()
return when {
z.foo("", 0) != "Z" -> "Fail #1"
(z : A<String>).foo("", 0) != "Z" -> "Fail #2"
(z : B<String, Int>).foo("", 0) != "Z" -> "Fail #3"
z1.foo("", 0) != "Z1" -> "Fail #1"
(z1 : A<String>).foo("", 0) != "Z1" -> "Fail #2"
(z1 : B<String, Int>).foo("", 0) != "Z1" -> "Fail #3"
z2.foo("", 0) != "Z2" -> "Fail #4"
(z2 : A<String>).foo("", 0) != "Z2" -> "Fail #5"
(z2 : B<String, Int>).foo("", 0) != "Z2" -> "Fail #6"
else -> "OK"
}
}