Test update for new ONLY_LOCAL_RETURN diagnostic
This commit is contained in:
+4
-2
@@ -1,5 +1,7 @@
|
||||
package test
|
||||
|
||||
import kotlin.InlineOption.*
|
||||
|
||||
abstract class A<R> {
|
||||
abstract fun getO() : R
|
||||
|
||||
@@ -8,7 +10,7 @@ abstract class A<R> {
|
||||
abstract fun getParam() : R
|
||||
}
|
||||
|
||||
inline fun <R> doWork(jobO: ()-> R, jobK: ()-> R, param: R) : A<R> {
|
||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
|
||||
val s = object : A<R>() {
|
||||
|
||||
override fun getO(): R {
|
||||
@@ -25,7 +27,7 @@ inline fun <R> doWork(jobO: ()-> R, jobK: ()-> R, param: R) : A<R> {
|
||||
return s;
|
||||
}
|
||||
|
||||
inline fun <R> doWorkInConstructor(jobO: ()-> R, jobK: ()-> R, param: R) : A<R> {
|
||||
inline fun <R> doWorkInConstructor(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
|
||||
val s = object : A<R>() {
|
||||
|
||||
val p = param;
|
||||
|
||||
+4
-2
@@ -1,12 +1,14 @@
|
||||
package test
|
||||
|
||||
import kotlin.InlineOption.*
|
||||
|
||||
abstract class A<R>(val param : R) {
|
||||
abstract fun getO() : R
|
||||
|
||||
abstract fun getK() : R
|
||||
}
|
||||
|
||||
inline fun <R> doWork(jobO: ()-> R, jobK: ()-> R, param: R) : A<R> {
|
||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
|
||||
val s = object : A<R>(param) {
|
||||
|
||||
override fun getO(): R {
|
||||
@@ -19,7 +21,7 @@ inline fun <R> doWork(jobO: ()-> R, jobK: ()-> R, param: R) : A<R> {
|
||||
return s;
|
||||
}
|
||||
|
||||
inline fun <R> doWorkInConstructor(jobO: ()-> R, jobK: ()-> R, param: () -> R) : A<R> {
|
||||
inline fun <R> doWorkInConstructor(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) param: () -> R) : A<R> {
|
||||
val s = object : A<R>(param()) {
|
||||
val o1 = jobO()
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import builders.*
|
||||
import kotlin.InlineOption.*
|
||||
|
||||
inline fun testAllInline(f: () -> String) : String {
|
||||
val args = array("1", "2", "3")
|
||||
@@ -40,7 +41,7 @@ inline fun testAllInline(f: () -> String) : String {
|
||||
return result.toString()!!
|
||||
}
|
||||
|
||||
inline fun testHtmlNoInline(f: () -> String) : String {
|
||||
inline fun testHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
|
||||
val args = array("1", "2", "3")
|
||||
val result =
|
||||
htmlNoInline() {
|
||||
@@ -80,7 +81,7 @@ inline fun testHtmlNoInline(f: () -> String) : String {
|
||||
return result.toString()!!
|
||||
}
|
||||
|
||||
inline fun testBodyNoInline(f: () -> String) : String {
|
||||
inline fun testBodyNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
|
||||
val args = array("1", "2", "3")
|
||||
val result =
|
||||
html {
|
||||
@@ -120,7 +121,7 @@ inline fun testBodyNoInline(f: () -> String) : String {
|
||||
return result.toString()!!
|
||||
}
|
||||
|
||||
inline fun testBodyHtmlNoInline(f: () -> String) : String {
|
||||
inline fun testBodyHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
|
||||
val args = array("1", "2", "3")
|
||||
val result =
|
||||
htmlNoInline {
|
||||
|
||||
@@ -69,7 +69,7 @@ class Title() : TagWithText("title")
|
||||
abstract class BodyTag(name: String) : TagWithText(name) {
|
||||
inline fun b(init: B.() -> Unit) = initTag(B(), init)
|
||||
inline fun p(init: P.() -> Unit) = initTag(P(), init)
|
||||
inline fun pNoInline(init: P.() -> Unit) = initTag(P(), init)
|
||||
fun pNoInline(init: P.() -> Unit) = initTag(P(), init)
|
||||
inline fun h1(init: H1.() -> Unit) = initTag(H1(), init)
|
||||
inline fun ul(init: UL.() -> Unit) = initTag(UL(), init)
|
||||
inline fun a(href: String, init: A.() -> Unit) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package test
|
||||
|
||||
inline fun <R> doWork(job: ()-> R) : R {
|
||||
import kotlin.InlineOption.*
|
||||
|
||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
||||
return notInline({job()})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
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()})
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package test
|
||||
|
||||
import kotlin.InlineOption.*
|
||||
|
||||
public class Data()
|
||||
|
||||
public class Input(val d: Data) : Closeable {
|
||||
@@ -27,4 +29,4 @@ public fun Input.copyTo(output: Output, size: Int): Long {
|
||||
}
|
||||
|
||||
|
||||
public inline fun with2<T>(receiver : T, body : T.() -> Unit) : Unit = {receiver.body()}()
|
||||
public inline fun with2<T>(receiver : T, inlineOptions(ONLY_LOCAL_RETURN) body : T.() -> Unit) : Unit = {receiver.body()}()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package zzz
|
||||
|
||||
inline fun calc(lambda: () -> Int): Int {
|
||||
import kotlin.InlineOption.*
|
||||
|
||||
inline fun calc(inlineOptions(ONLY_LOCAL_RETURN) lambda: () -> Int): Int {
|
||||
return doCalc { lambda() }
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -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()})
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,6 +1,8 @@
|
||||
import test.*
|
||||
|
||||
inline fun test1(param: () -> String): String {
|
||||
import kotlin.InlineOption.*
|
||||
|
||||
inline fun test1(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
||||
var result = "fail"
|
||||
inlineFun("1") { c ->
|
||||
{
|
||||
@@ -18,7 +20,7 @@ inline fun test1(param: () -> String): String {
|
||||
}
|
||||
|
||||
|
||||
inline fun test2(param: () -> String): String {
|
||||
inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
||||
var result = "fail"
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
@@ -31,7 +33,7 @@ inline fun test2(param: () -> String): String {
|
||||
return result
|
||||
}
|
||||
|
||||
inline fun test3(param: () -> String): String {
|
||||
inline fun test3(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
||||
var result = "fail"
|
||||
inlineFun("2") { d ->
|
||||
inlineFun("1") { c ->
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package test
|
||||
|
||||
inline fun <R> doWork(job: ()-> R) : R {
|
||||
import kotlin.InlineOption.*
|
||||
|
||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
||||
return notInline({job()})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user