95 lines
2.1 KiB
Plaintext
Vendored
95 lines
2.1 KiB
Plaintext
Vendored
import java.*
|
|
import java.util.*
|
|
|
|
fun f_plus(): Int {
|
|
var x: Int = 1
|
|
x = x `kotlin::Int.plus(Int)`+ 1
|
|
return x
|
|
}
|
|
|
|
~X~class X<~T~T> {
|
|
fun foo(a : `T`T) : `X`X<`T`T>{}
|
|
~plus~fun plus(t : `T`T) : Int {}
|
|
~minus~fun minus(t : String) : Int {}
|
|
~times~fun times(t : String) : Int {}
|
|
~div~fun div(t : String) : Int {}
|
|
~mod~fun mod(t : String) : Int {}
|
|
~rangeTo~fun rangeTo(t : String) : Int {}
|
|
~==~fun equals(a : Any?) : Boolean {}
|
|
~contains~fun contains(a : Any?) : Boolean {}
|
|
}
|
|
|
|
~t~fun <~t.T~T> t(~t.t~t : `t.T`T) : `t.T`T {
|
|
`t`t<Int>(1)`:kotlin::Int`
|
|
`t`t<`t.T`T>(`t.t`t)`:t.T`
|
|
`X`X<`t.T`T>()
|
|
1 `kotlin::Int.plus(Int)`+ 1
|
|
1 `kotlin::Int.plus(Int)`+= 1
|
|
X<String>() `plus`+ "1"
|
|
X<String>() `plus`plus "sadfas"
|
|
X<String>().`plus`plus("")
|
|
val x = X<String>()
|
|
x `minus`- ""
|
|
x `times`* ""
|
|
x `div`/ ""
|
|
x `mod`% ""
|
|
x `rangeTo`.. ""
|
|
x `==`== ""
|
|
x `==`!= 1
|
|
1 `contains`in x
|
|
1 `contains`!in x
|
|
}
|
|
|
|
open ~Foo~class Foo {
|
|
~set1~fun set(i : Int, val1 : String) {}
|
|
~get1~fun get(i : Int) : Int {}
|
|
~get2~fun get(i : Int, j : Int) : String {}
|
|
~get3~fun get(i : Object) : Any {return i }
|
|
~+=~fun plusAssign(a : Any?) : Unit {}
|
|
}
|
|
|
|
~Bar~class Bar : Foo {
|
|
~not~fun not() : String {}
|
|
~inc~fun inc() : Bar
|
|
~dec~fun dec() : Bar
|
|
~-~fun minus() : Bar
|
|
~+~fun plus() : Bar
|
|
}
|
|
|
|
fun <T> tt(t : T) : T {
|
|
val x : ArrayList<Int> = 0
|
|
x`java::java.util.ArrayList.get()`[1]
|
|
val foo = `Bar`Bar()
|
|
foo`get2`[null, 1]
|
|
foo`get2`[1, 1]
|
|
foo`get1`[1]
|
|
foo`set1`[1] = ""
|
|
foo`set1`[1, 2] = ""
|
|
x`java::java.util.ArrayList.set()`[1] = null
|
|
(x`java::java.util.ArrayList.set()`[1]) = null
|
|
x`java::java.util.ArrayList.set()`[null] = null
|
|
(x`java::java.util.ArrayList.set()`[null, 2]) = null
|
|
val y = Bar()
|
|
y`inc`++
|
|
`inc`++y
|
|
`dec`--y
|
|
y`dec`--
|
|
y `+=`+= 1
|
|
1 `kotlin::Int.compareTo(Double)`> 2.0
|
|
1 `kotlin::Int.compareTo(Double)`< 2.0
|
|
1 `kotlin::Int.compareTo(Double)`>= 2.0
|
|
1 `kotlin::Int.compareTo(Double)`<= 2.0
|
|
}
|
|
|
|
|
|
class UnitIncDec() {
|
|
~uinc~fun inc() : Unit
|
|
~udec~fun dec() : Unit
|
|
}
|
|
|
|
fun testUnitIncDec() {
|
|
var x = UnitIncDec()
|
|
x`uinc`++
|
|
x`udec`--
|
|
}
|