Use 'mapToCallableMethod' for delegateTo signature calculation

#KT-9707 Fixed
This commit is contained in:
Denis Zharkov
2016-01-20 15:58:54 +03:00
parent 3a7ed33de1
commit ba506170e9
5 changed files with 60 additions and 1 deletions
@@ -0,0 +1,17 @@
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()
@@ -0,0 +1,18 @@
import java.util.*
open class Content() {
override fun toString() = "OK"
}
interface ContentBox<T : Content> : List<T>
object Impl : ContentBox<Content> , AbstractList<Content>() {
override fun get(index: Int) = Content()
override val size: Int
get() = throw UnsupportedOperationException()
}
class ContentBoxDelegate<T : Content>() : ContentBox<T> by (Impl as ContentBox<T>)
fun box() = ContentBoxDelegate<Content>()[0].toString()