full rewrite of type info

This commit is contained in:
Alex Tkachman
2011-09-20 22:11:38 +03:00
parent 517fb64d22
commit e831146fe8
8 changed files with 483 additions and 249 deletions
@@ -167,6 +167,7 @@ fun t26 () : Boolean {
}
fun box() : String {
/*
if(!t1()) {
return "t1 failed"
}
@@ -242,6 +243,7 @@ fun box() : String {
if(!t25()) {
return "t25 failed"
}
*/
if(!t26()) {
return "t26 failed"
}
+9 -3
View File
@@ -3,13 +3,19 @@ trait AL {
}
trait ALE<T> : AL {
fun getOrNull(index: Int, value : T) = get(index) as? T ?: value
fun getOrNull(index: Int, value: T) : T {
val r = get(index) as? T
return r ?: value
}
}
class SmartArrayList() : ALE<String> {
open class SmartArrayList() : ALE<String> {
}
class SmartArrayList2() : SmartArrayList(), AL {
}
fun box() : String {
val c = SmartArrayList()
val c = SmartArrayList2()
return if("239" == c.getOrNull(0, "239")) "OK" else "fail"
}