JS: disable TemporaryAssignmentElimination, fix KT-15512

This commit is contained in:
Alexey Andreev
2017-01-10 17:47:59 +03:00
parent 7d170c0fcd
commit 10a3fbf53f
9 changed files with 9 additions and 16 deletions
@@ -1,6 +1,3 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
fun testOr(b: Boolean): Boolean {
return b || return !b;
}
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.js.backend.ast.JsFunction
class FunctionPostProcessor(root: JsFunction) {
val optimizations = listOf(
{ TemporaryAssignmentElimination(root.body).apply() },
//{ TemporaryAssignmentElimination(root.body).apply() },
{ RedundantLabelRemoval(root.body).apply() },
{ WhileConditionFolding(root.body).apply() },
{ DoWhileGuardElimination(root.body).apply() },
@@ -16,8 +16,10 @@
package org.jetbrains.kotlin.js.test.optimizer
import org.junit.Ignore
import org.junit.Test
@Ignore
class TemporaryAssignmentEliminationTest : BasicOptimizerTest("temporary-assignment") {
@Test fun assignment() = box()
@@ -4971,13 +4971,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
@TestMetadata("kt9022Return.kt")
public void testKt9022Return() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/kt9022Return.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
doTest(fileName);
}
@TestMetadata("kt9022Throw.kt")
@@ -1,6 +1,6 @@
package foo
// CHECK_VARS_COUNT: function=test count=2
// CHECK_VARS_COUNT: function=test count=3
inline fun if1(f: (Int) -> Int, a: Int, b: Int, c: Int): Int {
val result = f(a)
@@ -1,7 +1,7 @@
package foo
// CHECK_CONTAINS_NO_CALLS: test except=SumHolder_getInstance
// CHECK_VARS_COUNT: function=test count=1
// CHECK_VARS_COUNT: function=test count=2
object SumHolder {
var sum = 0
@@ -1,7 +1,7 @@
package foo
// CHECK_CONTAINS_NO_CALLS: test
// CHECK_VARS_COUNT: function=test count=0
// CHECK_VARS_COUNT: function=test count=2
internal inline fun sign(x: Int): Int {
if (x < 0) return -1
@@ -1,7 +1,7 @@
package foo
// CHECK_CONTAINS_NO_CALLS: test
// CHECK_VARS_COUNT: function=test count=1
// CHECK_VARS_COUNT: function=test count=2
internal inline fun sum(x: Int, y: Int): Int {
if (x == 0 || y == 0) return 0
@@ -1,7 +1,7 @@
package foo
// CHECK_CONTAINS_NO_CALLS: test
// CHECK_VARS_COUNT: function=test count=1
// CHECK_VARS_COUNT: function=test count=2
internal inline fun sum(x: Int, y: Int): Int {
if (x == 0 || y == 0) return 0