Files
kotlin-fork/js/js.translator/testData/delegation/cases/delegationByFunExpr.kt
T
Michael Nedzelsky 12db8f1551 JS backend: support for explicit delegation
#KT-4479 Fixed
2014-08-09 10:24:02 +04:00

21 lines
390 B
Kotlin

package foo
trait Base {
abstract fun foo(x: String): String
}
class BaseImpl(val s: String) : Base {
override fun foo(x: String): String = "Base: ${s}:${x}"
}
fun newBase(s: String): Base = BaseImpl(s)
class Derived() : Base by newBase("test")
fun box(): String {
assertEquals("Base: test:!!", Derived().foo("!!"), "delegation by function expression")
return "OK"
}