fix tests in org.jetbrains.kotlin.js.test.semantics
This commit is contained in:
@@ -4,10 +4,10 @@ package foo
|
||||
// CHECK_NOT_CALLED: f2
|
||||
// CHECK_BREAKS_COUNT: function=test count=3
|
||||
|
||||
var even = arrayListOf<Int>()
|
||||
var odd = arrayListOf<Int>()
|
||||
internal var even = arrayListOf<Int>()
|
||||
internal var odd = arrayListOf<Int>()
|
||||
|
||||
inline fun f2(x: Int): Unit {
|
||||
internal inline fun f2(x: Int): Unit {
|
||||
if (x % 2 == 0) {
|
||||
even.add(x)
|
||||
return
|
||||
@@ -17,7 +17,7 @@ inline fun f2(x: Int): Unit {
|
||||
return
|
||||
}
|
||||
|
||||
inline fun f1(x: Boolean, y: Int, z: Int): Unit {
|
||||
internal inline fun f1(x: Boolean, y: Int, z: Int): Unit {
|
||||
if (x) {
|
||||
return f2(y)
|
||||
}
|
||||
@@ -25,7 +25,7 @@ inline fun f1(x: Boolean, y: Int, z: Int): Unit {
|
||||
return f2(z)
|
||||
}
|
||||
|
||||
fun test(x: Boolean, y: Int, z: Int): Unit = f1(x, y, z)
|
||||
internal fun test(x: Boolean, y: Int, z: Int): Unit = f1(x, y, z)
|
||||
|
||||
fun box(): String {
|
||||
test(true, 2, 1)
|
||||
|
||||
@@ -7,24 +7,24 @@ package foo
|
||||
|
||||
var log = ""
|
||||
|
||||
inline fun run1(fn: ()->Int): Int {
|
||||
internal inline fun run1(fn: ()->Int): Int {
|
||||
log += "1;"
|
||||
return 1 + fn()
|
||||
}
|
||||
|
||||
inline fun run2(fn: ()->Int): Int {
|
||||
internal inline fun run2(fn: ()->Int): Int {
|
||||
log += "2;"
|
||||
return 2 + run1(fn)
|
||||
}
|
||||
|
||||
inline fun run3(fn: ()->Int): Int {
|
||||
internal inline fun run3(fn: ()->Int): Int {
|
||||
log += "3;"
|
||||
return 3 + run2(fn)
|
||||
}
|
||||
|
||||
fun test1(x: Int): Int = run3 { x }
|
||||
internal fun test1(x: Int): Int = run3 { x }
|
||||
|
||||
fun test2(x: Int): Int {
|
||||
internal fun test2(x: Int): Int {
|
||||
val result = 1 + run3 { x }
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package foo
|
||||
// CHECK_CONTAINS_NO_CALLS: test
|
||||
// CHECK_VARS_COUNT: function=test count=0
|
||||
|
||||
inline fun sign(x: Int): Int {
|
||||
internal inline fun sign(x: Int): Int {
|
||||
if (x < 0) return -1
|
||||
|
||||
if (x == 0) return 0
|
||||
@@ -11,7 +11,7 @@ inline fun sign(x: Int): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
fun test(x: Int, y: Int): Int {
|
||||
internal fun test(x: Int, y: Int): Int {
|
||||
if (x != 0) {
|
||||
return sign(x)
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,9 +6,9 @@ package foo
|
||||
// A copy of stdlib run function.
|
||||
// Copied to not to depend on run implementation.
|
||||
// It's important, that the body is just `return fn()`.
|
||||
inline fun evaluate<T>(fn: ()->T): T = fn()
|
||||
internal inline fun evaluate<T>(fn: ()->T): T = fn()
|
||||
|
||||
fun test(x: Int): Int =
|
||||
internal fun test(x: Int): Int =
|
||||
evaluate {
|
||||
evaluate { 2 } * evaluate { x }
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package foo
|
||||
// CHECK_CONTAINS_NO_CALLS: test
|
||||
// CHECK_VARS_COUNT: function=test count=0
|
||||
|
||||
class A(val x: Int) {
|
||||
internal class A(val x: Int) {
|
||||
inline fun f(): Int = x
|
||||
|
||||
inline fun ff(): Int = f()
|
||||
}
|
||||
|
||||
fun test(a: A): Int = a.ff()
|
||||
internal fun test(a: A): Int = a.ff()
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(1, test(A(1)))
|
||||
|
||||
@@ -3,13 +3,13 @@ package foo
|
||||
// CHECK_CONTAINS_NO_CALLS: test
|
||||
// CHECK_VARS_COUNT: function=test count=1
|
||||
|
||||
inline fun sum(x: Int, y: Int): Int {
|
||||
internal inline fun sum(x: Int, y: Int): Int {
|
||||
if (x == 0 || y == 0) return 0
|
||||
|
||||
return x + y
|
||||
}
|
||||
|
||||
fun test(x: Int, y: Int): Int {
|
||||
internal fun test(x: Int, y: Int): Int {
|
||||
val sum: Int
|
||||
sum = sum(x, y)
|
||||
return sum
|
||||
|
||||
@@ -3,13 +3,13 @@ package foo
|
||||
// CHECK_CONTAINS_NO_CALLS: test
|
||||
// CHECK_VARS_COUNT: function=test count=1
|
||||
|
||||
inline fun sum(x: Int, y: Int): Int {
|
||||
internal inline fun sum(x: Int, y: Int): Int {
|
||||
if (x == 0 || y == 0) return 0
|
||||
|
||||
return x + y
|
||||
}
|
||||
|
||||
fun test(x: Int, y: Int): Int {
|
||||
internal fun test(x: Int, y: Int): Int {
|
||||
val sum = sum(x, y)
|
||||
return sum
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user