Files
kotlin-fork/compiler/testData/codegen/boxInline/complex/with.2.kt
T
Mikhail Glukhikh 4bd48c4796 Regular modifier checker implemented (initial version). A set of tests fixed accordingly.
Most of modifier diagnostic is expressed by REDUNDANT_MODIFIER, INCOMPATIBLE_MODIFIERS, REPEATED_MODIFIER, WRONG_MODIFIER_TARGET, WRONG_MODIFIER_PARENT.
A set of modifier diagnostics is not in use now (but not deleted yet).
2015-08-03 19:41:50 +03:00

33 lines
685 B
Kotlin
Vendored

package test
import kotlin.InlineOption.*
public class Data()
public class Input(val d: Data) : Closeable {
public fun data() : Int = 100
}
public class Output(val d: Data) : Closeable {
public fun doOutput(data: Int): Int = data
}
public interface Closeable {
open public fun close() {}
}
public inline fun <R> use(block: ()-> R) : R {
return block()
}
public fun <R> useNoInline(block: ()-> R) : R {
return block()
}
public fun Input.copyTo(output: Output, size: Int): Long {
return output.doOutput(this.data()).toLong()
}
public inline fun with2<T>(receiver : T, inlineOptions(ONLY_LOCAL_RETURN) body : T.() -> Unit) : Unit = {receiver.body()}()