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

19 lines
348 B
Kotlin
Vendored

package foo
trait Base {
abstract fun Int.foo(): String
}
open class BaseImpl(val s: String) : Base {
override fun Int.foo(): String = "Int.foo ${s}:${this}"
}
class Derived() : Base by BaseImpl("test") {
fun bar(x: Int): String = x.foo()
}
fun box(): String {
assertEquals("Int.foo test:5", Derived().bar(5))
return "OK"
}