generate checkcast instruction for 'as' calls; use accessors for accessing fields of other instances of the same class

This commit is contained in:
Dmitry Jemerov
2011-06-17 13:36:51 +02:00
parent 6d1823ac2a
commit 54d2f25d75
5 changed files with 39 additions and 9 deletions
+15
View File
@@ -0,0 +1,15 @@
class C(val x: Int) {
fun equals(rhs: Any?): Boolean {
if (rhs is C) {
val rhsC = rhs as C
return rhsC.x == x
}
return false
}
}
fun box(): String {
val c1 = C(10)
val c2 = C(10)
return if (c1 == c2) "OK" else "fail"
}