mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
38 lines
630 B
Kotlin
Vendored
38 lines
630 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
|
|
interface IFoo {
|
|
fun Long.foo() = bar()
|
|
fun bar(): String
|
|
}
|
|
|
|
inline class Z(val x: Int) : IFoo {
|
|
override fun bar(): String = "OK"
|
|
}
|
|
|
|
inline class L(val x: Long) : IFoo {
|
|
override fun bar(): String = "OK"
|
|
}
|
|
|
|
inline class S(val x: String) : IFoo {
|
|
override fun bar(): String = "OK"
|
|
}
|
|
|
|
fun Z.testZ() {
|
|
if (1L.foo() != "OK") throw AssertionError()
|
|
}
|
|
|
|
fun L.testL() {
|
|
if (1L.foo() != "OK") throw AssertionError()
|
|
}
|
|
|
|
fun S.testS() {
|
|
if (1L.foo() != "OK") throw AssertionError()
|
|
}
|
|
|
|
fun box(): String {
|
|
Z(42).testZ()
|
|
L(4L).testL()
|
|
S("").testS()
|
|
|
|
return "OK"
|
|
} |