Files
kotlin-fork/backend.native/tests/codegen/classDelegation/generic.kt
T
2017-02-22 15:35:48 +03:00

21 lines
423 B
Kotlin

open class Content() {
override fun toString() = "OK"
}
interface Box<E> {
fun get(): E
}
interface ContentBox<T : Content> : Box<T>
object Impl : ContentBox<Content> {
override fun get(): Content = Content()
}
class ContentBoxDelegate<T : Content>() : ContentBox<T> by (Impl as ContentBox<T>)
fun box() = ContentBoxDelegate<Content>().get().toString()
fun main(args: Array<String>) {
println(box())
}