Delegated implementations for properties and extension properties.
This commit is contained in:
committed by
Dmitry Petrov
parent
d27f22ae0e
commit
e42116bb6a
@@ -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)
|
||||
Reference in New Issue
Block a user