Delegated implementations for properties and extension properties.

This commit is contained in:
Dmitry Petrov
2016-09-02 09:47:32 +03:00
committed by Dmitry Petrov
parent d27f22ae0e
commit e42116bb6a
7 changed files with 169 additions and 20 deletions
@@ -10,9 +10,22 @@ object BaseImpl : IBase {
override fun String.qux() {}
}
interface IOther
fun otherImpl(): IOther = object : IOther {}
interface IOther {
val x: String
var y: Int
val Byte.z1: Int
var Byte.z2: Int
}
fun otherImpl(x0: String, y0: Int): IOther = object : IOther {
override val x: String = x0
override var y: Int = y0
override val Byte.z1: Int get() = 1
override var Byte.z2: Int
get() = 2
set(value) {}
}
class Test1 : IBase by BaseImpl
class Test2 : IBase by BaseImpl, IOther by otherImpl()
class Test2 : IBase by BaseImpl, IOther by otherImpl("", 42)