mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
15 lines
269 B
Kotlin
Vendored
15 lines
269 B
Kotlin
Vendored
class Test {
|
|
private fun <T : Any> T.self() = object{
|
|
fun calc() : T {
|
|
return this@self
|
|
}
|
|
}
|
|
|
|
fun box() : Int {
|
|
return 1.self().calc() + 1
|
|
}
|
|
}
|
|
|
|
fun box() : String {
|
|
return if (Test().box() == 2) "OK" else "fail"
|
|
} |