Migrate boxInline tests to new multi-file framework
This commit is contained in:
committed by
Alexander Udalov
parent
fa1f7d988e
commit
cc84aabdcf
@@ -1,11 +0,0 @@
|
||||
package test
|
||||
|
||||
|
||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||
return notInline({job()})
|
||||
}
|
||||
|
||||
fun <R> notInline(job: ()-> R) : R {
|
||||
return job()
|
||||
}
|
||||
|
||||
+16
-1
@@ -1,3 +1,18 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
|
||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||
return notInline({job()})
|
||||
}
|
||||
|
||||
fun <R> notInline(job: ()-> R) : R {
|
||||
return job()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
@@ -9,4 +24,4 @@ fun box(): String {
|
||||
if (result2 != 12) return "test2: ${result2}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package test
|
||||
|
||||
|
||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||
val k = 10;
|
||||
return notInline({k; job()})
|
||||
}
|
||||
|
||||
fun <R> notInline(job: ()-> R) : R {
|
||||
return job()
|
||||
}
|
||||
|
||||
+17
-1
@@ -1,3 +1,19 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
|
||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||
val k = 10;
|
||||
return notInline({k; job()})
|
||||
}
|
||||
|
||||
fun <R> notInline(job: ()-> R) : R {
|
||||
return job()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
@@ -9,4 +25,4 @@ fun box(): String {
|
||||
if (result2 != 12) return "test2: ${result2}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
class My(val value: Int)
|
||||
|
||||
inline fun <T, R> T.perform(job: (T)-> R) : R {
|
||||
return job(this)
|
||||
}
|
||||
|
||||
+11
-1
@@ -1,3 +1,13 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
class My(val value: Int)
|
||||
|
||||
inline fun <T, R> T.perform(job: (T)-> R) : R {
|
||||
return job(this)
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
fun test1() : Int {
|
||||
val inlineX = My(111)
|
||||
|
||||
@@ -25,4 +35,4 @@ fun box(): String {
|
||||
if (test2() != 11) return "test2: ${test2()}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package test
|
||||
|
||||
inline fun <T, R> mfun(arg: T, f: (T) -> R) : R {
|
||||
return f(arg)
|
||||
}
|
||||
|
||||
inline fun <T> doSmth(a: T): String {
|
||||
return a.toString()
|
||||
}
|
||||
+15
-1
@@ -1,3 +1,17 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline fun <T, R> mfun(arg: T, f: (T) -> R) : R {
|
||||
return f(arg)
|
||||
}
|
||||
|
||||
inline fun <T> doSmth(a: T): String {
|
||||
return a.toString()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun test1(s: Long): String {
|
||||
@@ -14,4 +28,4 @@ fun box(): String {
|
||||
if (result != "OK1111") return "fail1: ${result}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
class InlineAll {
|
||||
|
||||
inline fun inline(s: (Int, Double, Double, String, Long) -> String,
|
||||
a1: Int, a2: Double, a3: Double, a4: String, a5: Long): String {
|
||||
return s(a1, a2, a3, a4, a5)
|
||||
}
|
||||
}
|
||||
+13
-1
@@ -1,3 +1,15 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
class InlineAll {
|
||||
|
||||
inline fun inline(s: (Int, Double, Double, String, Long) -> String,
|
||||
a1: Int, a2: Double, a3: Double, a4: String, a5: Long): String {
|
||||
return s(a1, a2, a3, a4, a5)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
fun testAll(): String {
|
||||
val inlineX = InlineAll()
|
||||
|
||||
@@ -67,4 +79,4 @@ fun box(): String {
|
||||
if (testAllWithCapturedVar() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVar: ${testAllWithCapturedVar()}"
|
||||
if (testAllWithCapturedValAndVar() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVal: ${testAllWithCapturedValAndVar()}"
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
inline fun inline(s: (Int, Double, Double, String, Long) -> String,
|
||||
a1: Int, a2: Double, a3: Double, a4: String, a5: Long): String {
|
||||
return s(a1, a2, a3, a4, a5)
|
||||
}
|
||||
+10
-1
@@ -1,3 +1,12 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
inline fun inline(s: (Int, Double, Double, String, Long) -> String,
|
||||
a1: Int, a2: Double, a3: Double, a4: String, a5: Long): String {
|
||||
return s(a1, a2, a3, a4, a5)
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
fun testAll(): String {
|
||||
return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long ->
|
||||
"" + a1 + a2 + a3 + a4 + a5},
|
||||
@@ -59,4 +68,4 @@ fun box(): String {
|
||||
if (testAllWithCapturedVar() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVar: ${testAllWithCapturedVar()}"
|
||||
if (testAllWithCapturedValAndVar() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVal: ${testAllWithCapturedValAndVar()}"
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user