Fix testdata for new JS inliner
This commit is contained in:
Vendored
+1
-1
@@ -9,7 +9,7 @@ inline fun inlineFun(crossinline inlineLambda: () -> String = { "OK" }, noinline
|
|||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
//NO_CHECK_LAMBDA_INLINING
|
//NO_CHECK_LAMBDA_INLINING
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
|
// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box
|
||||||
import test.*
|
import test.*
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
+2
-2
@@ -9,8 +9,8 @@ fun call(lambda: () -> String ) = lambda()
|
|||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
//NO_CHECK_LAMBDA_INLINING
|
//NO_CHECK_LAMBDA_INLINING
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
|
// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box
|
||||||
// CHECK_CALLED_IN_SCOPE: function=call_h4ejuu$ scope=box
|
// CHECK_CALLED_IN_SCOPE: function=call scope=box
|
||||||
import test.*
|
import test.*
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ inline fun inlineFun(crossinline inlineLambda: () -> String, noinline noInlineLa
|
|||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
//NO_CHECK_LAMBDA_INLINING
|
//NO_CHECK_LAMBDA_INLINING
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=inlineFun
|
// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=inlineFun
|
||||||
import test.*
|
import test.*
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
+2
-2
@@ -10,8 +10,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String = { this }): String
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
|
// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
|
// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box
|
||||||
|
|
||||||
import test.*
|
import test.*
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -10,8 +10,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String, crossinline dlambd
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=test
|
// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=test
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=test
|
// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=test
|
||||||
import test.*
|
import test.*
|
||||||
|
|
||||||
fun String.test(): String = "INLINE".inlineFun({ this })
|
fun String.test(): String = "INLINE".inlineFun({ this })
|
||||||
|
|||||||
+2
-2
@@ -14,8 +14,8 @@ class A(val value: String) {
|
|||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
//WITH_RUNTIME
|
//WITH_RUNTIME
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
|
// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=box
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
|
// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=box
|
||||||
import test.*
|
import test.*
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
+2
-2
@@ -14,8 +14,8 @@ class A(val value: String) {
|
|||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
//WIH_RUNTIME
|
//WIH_RUNTIME
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=test
|
// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=test
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=test
|
// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=test
|
||||||
import test.*
|
import test.*
|
||||||
|
|
||||||
fun String.test(): String = with(A("VALUE")) { "INLINE".inlineFun({ this@test }) }
|
fun String.test(): String = with(A("VALUE")) { "INLINE".inlineFun({ this@test }) }
|
||||||
|
|||||||
+2
-2
@@ -12,8 +12,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String = { { this }() }):
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
|
// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
|
// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box
|
||||||
|
|
||||||
import test.*
|
import test.*
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -15,8 +15,8 @@ class A(val value: String) {
|
|||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
//WITH_RUNTIME
|
//WITH_RUNTIME
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
|
// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=box
|
||||||
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
|
// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=box
|
||||||
import test.*
|
import test.*
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
// EXPECTED_REACHABLE_NODES: 1695
|
// EXPECTED_REACHABLE_NODES: 1695
|
||||||
// MODULE: lib
|
// PROPERTY_WRITE_COUNT: name=publishedTopLevel_61zpoe$ count=1
|
||||||
// FILE: lib.kt
|
// PROPERTY_WRITE_COUNT: name=published_61zpoe$ count=1
|
||||||
|
// PROPERTY_WRITE_COUNT: name=B count=1
|
||||||
class A {
|
class A {
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun published(x: String) = "${x}K"
|
internal fun published(x: String) = "${x}K"
|
||||||
|
|
||||||
fun template(x: String): String = TODO("")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun publishedTopLevel(x: String) = "${x}K"
|
internal fun publishedTopLevel(x: String) = "${x}K"
|
||||||
|
|
||||||
fun templateTopLevel(x: String): String = TODO("")
|
|
||||||
|
|
||||||
interface I {
|
interface I {
|
||||||
fun test(): String
|
fun test(): String
|
||||||
}
|
}
|
||||||
@@ -22,34 +19,4 @@ internal class B(val x: String) : I {
|
|||||||
override fun test() = x + "K"
|
override fun test() = x + "K"
|
||||||
}
|
}
|
||||||
|
|
||||||
// MODULE: main(lib)
|
fun box(): String = "OK"
|
||||||
// FILE: main.kt
|
|
||||||
import kotlin.text.Regex
|
|
||||||
|
|
||||||
inline fun templates() {
|
|
||||||
A().template("X")
|
|
||||||
templateTopLevel("X")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
val testFunctionName = "published" + extractSuffix("template")
|
|
||||||
val a = A()
|
|
||||||
var result = a.asDynamic()[testFunctionName].call(a, "O")
|
|
||||||
if (result != "OK") return "fail1: $result"
|
|
||||||
|
|
||||||
val topLevelName = "publishedTopLevel" + extractSuffix("templateTopLevel")
|
|
||||||
result = js("lib")[topLevelName]("O")
|
|
||||||
if (result != "OK") return "fail2: $result"
|
|
||||||
|
|
||||||
val b: I = js("new lib.B('O')")
|
|
||||||
result = b.test()
|
|
||||||
if (result != "OK") return "fail3: $result"
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun extractSuffix(prefix: String): String {
|
|
||||||
val functionBody: String = js("_").templates.toString()
|
|
||||||
val regex = Regex(prefix + "(_[\\\$a-zA-Z0-9]+)")
|
|
||||||
return regex.find(functionBody)!!.groupValues[1]
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user