101 lines
1.5 KiB
Plaintext
Vendored
101 lines
1.5 KiB
Plaintext
Vendored
import pack.bar
|
|
import pack.oldFun2 // should not be removed for non-deprecated overload used
|
|
import kotlin.reflect.KProperty
|
|
|
|
class A private constructor()
|
|
|
|
fun foo() {
|
|
loop@
|
|
for (i in 1..100) {
|
|
val v = bar(i + 2)
|
|
/* comment */
|
|
continue@loop
|
|
}
|
|
|
|
bar(bar(10 + 2) + 1)
|
|
|
|
oldFun2()
|
|
}
|
|
|
|
fun unnecessarySafeCall(x: String) {
|
|
x.length
|
|
}
|
|
|
|
fun unnecessaryExclExcl(x: String) {
|
|
x.length
|
|
}
|
|
|
|
fun unnecessaryCast(x: String) = x
|
|
|
|
fun unnecessaryElvis(x: String) = x
|
|
|
|
@JavaAnn(1, arg1 = "abc") class MyClass
|
|
|
|
const val i = 1
|
|
|
|
annotation class Fancy(val param: Int)
|
|
|
|
@Fancy(i) class D
|
|
|
|
class CustomDelegate {
|
|
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = ""
|
|
operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {}
|
|
}
|
|
|
|
class B {
|
|
var a: String by CustomDelegate()
|
|
|
|
operator fun plus(a: A): A = A()
|
|
}
|
|
|
|
fun foo() {
|
|
B() + B()
|
|
B() + B()
|
|
B() + B()
|
|
}
|
|
|
|
class C {
|
|
fun foo() {}
|
|
|
|
fun bar() = C::foo
|
|
|
|
infix fun willBeInfix(i: Int) {}
|
|
}
|
|
|
|
fun <T> typed() {
|
|
}
|
|
|
|
fun <T> withTypeParameters() where T : Cloneable, T : Comparable<T> {
|
|
}
|
|
|
|
val x = C() willBeInfix 1
|
|
|
|
fun infixTest() {
|
|
arrayListOf(1, 2, 3).map { it }
|
|
}
|
|
|
|
fun async(f: () -> Unit) {}
|
|
infix fun Any.async(f: () -> Unit) {}
|
|
object async {
|
|
operator fun times(f: () -> Unit) = f()
|
|
}
|
|
|
|
fun test(foo: Any) {
|
|
async() { }
|
|
async() /**/ { }
|
|
foo async ({ })
|
|
|
|
async() { }
|
|
|
|
async({ })
|
|
foo async ({ })
|
|
|
|
foo async (fun () {})
|
|
foo async (fun () {})
|
|
|
|
async (fun () {})
|
|
|
|
async * {}
|
|
}
|
|
|