Check lambda inlining in package part files in test framework
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// FILE: 1.kt
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// WITH_RUNTIME
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// FILE: 1.kt
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// WITH_RUNTIME
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
fun <T> T.noInline(p: (T) -> Unit) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
// WITH_RUNTIME
|
||||
package test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
package test
|
||||
|
||||
inline fun call(p: String, s: String.() -> Int): Int {
|
||||
return p.s()
|
||||
inline fun call(a: String, b: String, s: String.(String) -> String): Int {
|
||||
return a.s(b)
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
@@ -11,5 +11,5 @@ inline fun call(p: String, s: String.() -> Int): Int {
|
||||
import test.*
|
||||
|
||||
fun box() : String {
|
||||
return if (call("123", String::length) == 3) "OK" else "fail"
|
||||
return return call("O", "K", String::plus)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// FILE: 1.kt
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// WITH_REFLECT
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun <R> call(s: () -> R) = s()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// FILE: 1.kt
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// WITH_RUNTIME
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun test(s: () -> Unit) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline fun test(s: () -> Unit) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline fun test(s: () -> Unit) {
|
||||
|
||||
+13
-13
@@ -4,10 +4,18 @@ package test
|
||||
|
||||
interface InlineTrait {
|
||||
|
||||
fun finalInline(s: () -> String): String {
|
||||
private inline fun privateInline(s: () -> String): String {
|
||||
return s()
|
||||
}
|
||||
|
||||
fun testPrivateInline(): String {
|
||||
return privateInline { "private" }
|
||||
}
|
||||
|
||||
fun testPrivateInline2(): String {
|
||||
return privateInline { "private2" }
|
||||
}
|
||||
|
||||
companion object {
|
||||
inline final fun finalInline(s: () -> String): String {
|
||||
return s()
|
||||
@@ -15,7 +23,7 @@ interface InlineTrait {
|
||||
}
|
||||
}
|
||||
|
||||
class Z: InlineTrait {
|
||||
class Z : InlineTrait {
|
||||
|
||||
}
|
||||
|
||||
@@ -23,21 +31,13 @@ class Z: InlineTrait {
|
||||
|
||||
import test.*
|
||||
|
||||
fun testFinalInline(): String {
|
||||
return Z().finalInline({"final"})
|
||||
}
|
||||
|
||||
fun testFinalInline2(instance: InlineTrait): String {
|
||||
return instance.finalInline({"final2"})
|
||||
}
|
||||
|
||||
fun testClassObject(): String {
|
||||
return InlineTrait.finalInline({"classobject"})
|
||||
return InlineTrait.finalInline({ "classobject" })
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (testFinalInline() != "final") return "test1: ${testFinalInline()}"
|
||||
if (testFinalInline2(Z()) != "final2") return "test2: ${testFinalInline2(Z())}"
|
||||
if (Z().testPrivateInline() != "private") return "test1: ${Z().testPrivateInline()}"
|
||||
if (Z().testPrivateInline2() != "private2") return "test2: ${Z().testPrivateInline2()}"
|
||||
if (testClassObject() != "classobject") return "test3: ${testClassObject()}"
|
||||
|
||||
return "OK"
|
||||
|
||||
Reference in New Issue
Block a user