JS: add some tests to ensure that AST metadata is correctly serialized and deserialized and visible to JS optimizer

This commit is contained in:
Alexey Andreev
2017-02-28 17:57:27 +03:00
parent 80c1ac8b1b
commit 0058d2fdf6
4 changed files with 72 additions and 0 deletions
@@ -0,0 +1,25 @@
/// FILE: a.kt
fun a() = "["
fun b() = "]"
inline fun sideEffect(f: () -> String, g: () -> Unit): String {
g()
return f()
}
inline fun foo(f: () -> String, g: () -> Unit): String {
return a() + sideEffect(f, g) + b()
}
// FILE: b.kt
// RECOMPILE
fun box(): String {
val result = foo({ "*" }, { })
if (result != "[*]") return "fail: $result"
return "OK"
}