Cast arguments to proper types when generating delegates

Also minor refactoring in a couple places to adopt this style
This commit is contained in:
Alexander Udalov
2012-10-26 18:09:13 +04:00
parent 4cfe68da1e
commit 288e3a7b40
6 changed files with 62 additions and 26 deletions
@@ -0,0 +1,12 @@
trait A<T, U> {
fun foo(t: T, u: U): String
}
class Derived(a: A<Long, Int>) : A<Long, Int> by a
fun box(): String {
val o = object : A<Long, Int> {
override fun foo(t: Long, u: Int) = if (t == u.toLong()) "OK" else "Fail $t $u"
}
return Derived(o).foo(42, 42)
}