Cast arguments to proper types when generating delegates
Also minor refactoring in a couple places to adopt this style
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
trait A<T> {
|
||||
fun foo(t: T): String
|
||||
}
|
||||
|
||||
class Derived(a: A<Int>) : A<Int> by a
|
||||
|
||||
fun box(): String {
|
||||
val o = object : A<Int> {
|
||||
override fun foo(t: Int) = if (t == 42) "OK" else "Fail $t"
|
||||
}
|
||||
return Derived(o).foo(42)
|
||||
}
|
||||
Reference in New Issue
Block a user