#KT-2811 Fixed VerifyError on smart-cast 'this'

This commit is contained in:
Natalia.Ukhorskaya
2012-10-23 11:42:44 +04:00
parent a3b86f5f8b
commit a79a31cf01
3 changed files with 32 additions and 3 deletions
@@ -0,0 +1,25 @@
open class Test1 {
fun test1(): String {
if (this is Test2) {
return this.foo()
}
return "fail"
}
}
class Test2(): Test1() {
fun foo(): String {
return "OK"
}
}
fun Test1.test2(): String {
if (this is Test2) return this.foo() else return "fail"
}
fun box(): String {
if ("OK" == Test2().test1() && "OK" == Test2().test2()) {
return "OK"
}
return "fail"
}