Replace inlineOption(ONLY_LOCAL_RETURN) with crossinline in testData

This commit is contained in:
Denis Zharkov
2015-09-15 10:11:19 +03:00
parent bae3320d52
commit 9adde77c47
43 changed files with 60 additions and 60 deletions
@@ -10,7 +10,7 @@ abstract class A<R> {
abstract fun getParam() : R
}
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
inline fun <R> doWork(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A<R> {
val s = object : A<R>() {
override fun getO(): R {
@@ -27,7 +27,7 @@ inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptio
return s;
}
inline fun <R> doWorkInConstructor(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
inline fun <R> doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A<R> {
val s = object : A<R>() {
val p = param;
@@ -8,7 +8,7 @@ abstract class A<R>(val param : R) {
abstract fun getK() : R
}
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
inline fun <R> doWork(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A<R> {
val s = object : A<R>(param) {
override fun getO(): R {
@@ -21,7 +21,7 @@ inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptio
return s;
}
inline fun <R> doWorkInConstructor(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) param: () -> R) : A<R> {
inline fun <R> doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: ()-> R, crossinline param: () -> R) : A<R> {
val s = object : A<R>(param()) {
val o1 = jobO()
@@ -1,6 +1,6 @@
package test
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
inline fun bar(crossinline y: () -> String) = {
call(y)
}
@@ -1,6 +1,6 @@
package test
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
inline fun bar(crossinline y: () -> String) = {
{ { call(y) }() }()
}
@@ -7,6 +7,6 @@ fun box(): String {
return if (bar1 == "123" && bar2 == "1234") "OK" else "fail: $bar1 $bar2"
}
inline fun bar2(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
inline fun bar2(crossinline y: () -> String) = {
{ { call(y) }() }()
}
@@ -1,7 +1,7 @@
package test
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
inline fun bar(crossinline y: () -> String) = {
{ { call(y) }() }()
}
public inline fun <T> call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) f: () -> T): T = {{ f() }()}()
public inline fun <T> call(crossinline f: () -> T): T = {{ f() }()}()
@@ -4,13 +4,13 @@ internal interface A<T> {
fun run(): T;
}
internal inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = object : A<String> {
internal inline fun bar(crossinline y: () -> String) = object : A<String> {
override fun run() : String {
return call(y)
}
}
public inline fun <T> call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) f: () -> T): T = object : A<T> {
public inline fun <T> call(crossinline f: () -> T): T = object : A<T> {
override fun run() : T {
return f()
}
@@ -42,7 +42,7 @@ inline fun testAllInline(f: () -> String) : String {
return result.toString()!!
}
inline fun testHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
inline fun testHtmlNoInline(crossinline f: () -> String) : String {
val args = array("1", "2", "3")
val result =
htmlNoInline() {
@@ -82,7 +82,7 @@ inline fun testHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) :
return result.toString()!!
}
inline fun testBodyNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
inline fun testBodyNoInline(crossinline f: () -> String) : String {
val args = array("1", "2", "3")
val result =
html {
@@ -122,7 +122,7 @@ inline fun testBodyNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) :
return result.toString()!!
}
inline fun testBodyHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
inline fun testBodyHtmlNoInline(crossinline f: () -> String) : String {
val args = array("1", "2", "3")
val result =
htmlNoInline {
@@ -2,7 +2,7 @@ package test
import kotlin.InlineOption.*
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
inline fun <R> doWork(crossinline job: ()-> R) : R {
return notInline({job()})
}
@@ -2,7 +2,7 @@ package test
import kotlin.InlineOption.*
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
inline fun <R> doWork(crossinline job: ()-> R) : R {
val k = 10;
return notInline({k; job()})
}
+1 -1
View File
@@ -29,4 +29,4 @@ public fun Input.copyTo(output: Output, size: Int): Long {
}
public inline fun with2<T>(receiver : T, inlineOptions(ONLY_LOCAL_RETURN) body : T.() -> Unit) : Unit = {receiver.body()}()
public inline fun with2<T>(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}()
@@ -2,7 +2,7 @@ package zzz
import kotlin.InlineOption.*
inline fun calc(inlineOptions(ONLY_LOCAL_RETURN) lambda: () -> Int): Int {
inline fun calc(crossinline lambda: () -> Int): Int {
return doCalc { lambda() }
}
@@ -24,7 +24,7 @@ fun test11(param: String): String {
return result
}
inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
inline fun test2(crossinline param: () -> String): String {
var result = "fail1"
noInlineFun("stub") { a ->
concat(param()) {
@@ -35,7 +35,7 @@ inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
return result
}
inline fun test22(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
inline fun test22(crossinline param: () -> String): String {
var result = "fail1"
{{result = param()}()}()
@@ -2,6 +2,6 @@ package test
import kotlin.InlineOption.*
inline fun <R> call(inlineOptions(ONLY_LOCAL_RETURN) f: () -> R) : R {
inline fun <R> call(crossinline f: () -> R) : R {
return {f()} ()
}
@@ -8,7 +8,7 @@ fun testSameCaptured() : String {
return if (result == 12) "OK" else "fail ${result}"
}
inline fun testSameCaptured(inlineOptions(ONLY_LOCAL_RETURN) lambdaWithResultCaptured: () -> Unit) : String {
inline fun testSameCaptured(crossinline lambdaWithResultCaptured: () -> Unit) : String {
var result = 1;
result = doWork({result+=11; lambdaWithResultCaptured(); result})
return if (result == 12) "OK" else "fail ${result}"
@@ -2,12 +2,12 @@ package test
import kotlin.InlineOption.*
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
inline fun <R> doWork(crossinline job: ()-> R) : R {
val k = 10;
return notInline({k; job()})
}
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) job2: () -> R) : R {
inline fun <R> doWork(crossinline job: ()-> R, crossinline job2: () -> R) : R {
val k = 10;
return notInline({k; job(); job2()})
}
@@ -2,7 +2,7 @@
import test.*
import kotlin.InlineOption.*
inline fun test1(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
inline fun test1(crossinline param: () -> String): String {
var result = "fail"
inlineFun("1") { c ->
{
@@ -20,7 +20,7 @@ inline fun test1(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
}
inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
inline fun test2(crossinline param: () -> String): String {
var result = "fail"
inlineFun("2") { a ->
{
@@ -33,7 +33,7 @@ inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
return result
}
inline fun test3(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
inline fun test3(crossinline param: () -> String): String {
var result = "fail"
inlineFun("2") { d ->
inlineFun("1") { c ->
@@ -1,7 +1,7 @@
package test
inline fun <reified R> foo() = bar<R>() {"OK"}
inline fun <reified E> bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
inline fun <reified E> bar(crossinline y: () -> String) = {
null is E
run(y)
}
@@ -1,6 +1,6 @@
package test
inline fun <reified R, T> bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) tasksFactory: () -> T) = {
inline fun <reified R, T> bar(crossinline tasksFactory: () -> T) = {
null is R
run(tasksFactory)
}
@@ -2,7 +2,7 @@ package test
import kotlin.InlineOption.*
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
inline fun <R> doWork(crossinline job: ()-> R) : R {
return notInline({job()})
}
@@ -1,6 +1,6 @@
package builders
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
inline fun call(crossinline init: () -> Unit) {
return {
init()
}()
@@ -1,6 +1,6 @@
package builders
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
inline fun call(crossinline init: () -> Unit) {
return init()
}
//NO_CHECK_LAMBDA_INLINING
@@ -1,6 +1,6 @@
package builders
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
inline fun call(crossinline init: () -> Unit) {
return init()
}
@@ -1,6 +1,6 @@
package builders
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
inline fun call(crossinline init: () -> Unit) {
return object {
fun run () {
init()
@@ -1,6 +1,6 @@
package builders
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
inline fun call(crossinline init: () -> Unit) {
return init()
}
@@ -1,6 +1,6 @@
package builders
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
inline fun call(crossinline init: () -> Unit) {
return init()
}
@@ -1,6 +1,6 @@
package builders
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
inline fun call(crossinline init: () -> Unit) {
return init()
}
@@ -1,10 +1,10 @@
package builders
//TODO there is a bug in asm it's skips linenumber on same line on reading bytecode
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
inline fun call(crossinline init: () -> Unit) {
"1"; return init()
}
inline fun test(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) p: () -> String): String {
inline fun test(crossinline p: () -> String): String {
var res = "Fail"
call {
+1 -1
View File
@@ -4,7 +4,7 @@ import kotlin.InlineOption.*
class Foo {
inline fun inlineFoo(inlineOptions(ONLY_LOCAL_RETURN) s: () -> Unit) {
inline fun inlineFoo(crossinline s: () -> Unit) {
{
s()
}()
+1 -1
View File
@@ -4,7 +4,7 @@ import kotlin.InlineOption.*
class Foo {
inline fun inlineFoo(inlineOptions(ONLY_LOCAL_RETURN) s: () -> Unit) {
inline fun inlineFoo(crossinline s: () -> Unit) {
val localObject = object {
fun run() {
s()