Test update for new ONLY_LOCAL_RETURN diagnostic

This commit is contained in:
Michael Bogdanov
2014-06-16 13:55:52 +04:00
parent da01a11137
commit ce71c5abde
21 changed files with 97 additions and 27 deletions
@@ -1,5 +1,7 @@
import test.*
import kotlin.InlineOption.*
fun test1(param: String): String {
var result = "fail1"
noInlineFun(param) { a ->
@@ -22,7 +24,7 @@ fun test11(param: String): String {
return result
}
inline fun test2(param: () -> String): String {
inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
var result = "fail1"
noInlineFun("stub") { a ->
concat(param()) {
@@ -33,7 +35,7 @@ inline fun test2(param: () -> String): String {
return result
}
inline fun test22(param: () -> String): String {
inline fun test22(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
var result = "fail1"
{{result = param()}()}()
@@ -1,5 +1,7 @@
package test
inline fun <R> call(f: () -> R) : R {
import kotlin.InlineOption.*
inline fun <R> call(inlineOptions(ONLY_LOCAL_RETURN) f: () -> R) : R {
return {f()} ()
}
@@ -1,11 +1,13 @@
package test
inline fun <R> doWork(job: ()-> R) : R {
import kotlin.InlineOption.*
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
val k = 10;
return notInline({k; job()})
}
inline fun <R> doWork(job: ()-> R, job2: () -> R) : R {
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) job2: () -> R) : R {
val k = 10;
return notInline({k; job(); job2()})
}