Generate bridges for fake overrides when needed

#KT-3985 Fixed
 #KT-4145 Fixed
This commit is contained in:
Alexander Udalov
2014-03-27 19:33:42 +04:00
parent 2c2c918447
commit 04c237cc22
17 changed files with 300 additions and 97 deletions
@@ -0,0 +1,25 @@
open class A<T> {
open fun foo(t: T) = "A"
}
open class B : A<String>()
object Z : B() {
override fun foo(t: String) = "Z"
}
fun box(): String {
val o = object : B() {
override fun foo(t: String) = "o"
}
return when {
Z.foo("") != "Z" -> "Fail #1"
o.foo("") != "o" -> "Fail #2"
(Z : B).foo("") != "Z" -> "Fail #3"
(o : B).foo("") != "o" -> "Fail #4"
(Z : A<String>).foo("") != "Z" -> "Fail #5"
(o : A<String>).foo("") != "o" -> "Fail #6"
else -> "OK"
}
}