mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 00:21:29 +00:00
36 lines
519 B
Plaintext
36 lines
519 B
Plaintext
~T.foo~fun <~T~T, ~E~E> `T`T.foo(x : `E`E, y : `A`A) : `T`T {
|
|
y.`+`plus(1)
|
|
y `+`plus 1
|
|
y `+1`+ 1.0
|
|
|
|
this?.`-`minus<T>(this)
|
|
|
|
this
|
|
}
|
|
|
|
~A~class A
|
|
|
|
~+1~fun `A`A.plus(a : Any) {
|
|
|
|
1.`foo`foo()
|
|
true.`T.foo`foo()
|
|
3.`!null`foo(4)
|
|
|
|
1
|
|
}
|
|
|
|
~+~fun `A`A.plus(a : Int) {
|
|
1
|
|
}
|
|
|
|
~-~fun <T> T.minus(t : T) : Int = 1
|
|
|
|
fun test() {
|
|
val y = 1.`abs`abs
|
|
}
|
|
~abs~val Int.abs : Int
|
|
get() = if (this`:kotlin::Int` > 0) this else -this`:kotlin::Int`;
|
|
|
|
val <~TT~T> `TT`T.foo : `TT`T
|
|
|
|
~foo~fun Int.foo() = this`:kotlin::Int` |