262f57d938
1) dataClass.kt - test with data class 2) receiver.kt - test with Int extension receiver 3) delegation.kt - test with implementation by delegation
27 lines
545 B
Kotlin
Vendored
27 lines
545 B
Kotlin
Vendored
fun Int.addOne(): Int {
|
|
// fun (Int).plus(Int): Int
|
|
// │ Int
|
|
// │ │
|
|
return this + 1
|
|
}
|
|
|
|
// Int
|
|
// │
|
|
val Int.repeat: Int
|
|
get() = this
|
|
|
|
fun main() {
|
|
// Int Int
|
|
// │ │
|
|
val i = 2
|
|
// val main.i: Int
|
|
// │ fun Int.addOne(): Int
|
|
// │ │
|
|
i.addOne()
|
|
// val main.i: Int
|
|
// │ val Int.repeat: Int
|
|
// │ │ fun (Int).times(Int): Int
|
|
// Int │ │ │ Int
|
|
// │ │ │ │ │
|
|
val p = i.repeat * 2
|
|
} |