diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index b6d6b96e210..7fc46b1771d 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -47483,6 +47483,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/regressions/kt3442.kt"); } + @Test + @TestMetadata("kt344Runnable.kt") + public void testKt344Runnable() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt344Runnable.kt"); + } + @Test @TestMetadata("kt3587.kt") public void testKt3587() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index fc4f2788161..c2ff7ce44b4 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -47483,6 +47483,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/regressions/kt3442.kt"); } + @Test + @TestMetadata("kt344Runnable.kt") + public void testKt344Runnable() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt344Runnable.kt"); + } + @Test @TestMetadata("kt3587.kt") public void testKt3587() throws Exception { diff --git a/compiler/testData/codegen/box/classes/kt707.kt b/compiler/testData/codegen/box/classes/kt707.kt index 1b972679eec..4291a3094c4 100644 --- a/compiler/testData/codegen/box/classes/kt707.kt +++ b/compiler/testData/codegen/box/classes/kt707.kt @@ -1,15 +1,8 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: Enable for JS when it supports Java class library. -// IGNORE_BACKEND: JS, NATIVE class List(val head: T, val tail: List? = null) fun List.mapHead(f: (T)-> T): List = List(f(head), null) fun box() : String { val a: Int = List(1).mapHead{it * 2}.head - System.out?.println(a) - return "OK" + return if (a == 2) "OK" else a.toString() } diff --git a/compiler/testData/codegen/box/controlStructures/kt237.kt b/compiler/testData/codegen/box/controlStructures/kt237.kt index 86d81d9225a..d806c712b37 100644 --- a/compiler/testData/codegen/box/controlStructures/kt237.kt +++ b/compiler/testData/codegen/box/controlStructures/kt237.kt @@ -1,18 +1,11 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - fun main(args: Array?) { val y: Unit = Unit //do not compile A() //do not compile C(Unit) //do not compile //do not compile - System.out?.println(fff(Unit)) //do not compile - System.out?.println(id(y)) //do not compile - System.out?.println(fff(id(y)) == id(foreach(arrayOfNulls(0) as Array,{ e : Int -> }))) //do not compile + fff(Unit) //do not compile + id(y) //do not compile + fff(id(y)) == id(foreach(arrayOfNulls(0) as Array,{ e : Int -> })) //do not compile } class A() @@ -41,7 +34,7 @@ fun box() : String { a[0] = 0 a[1] = 1 a[2] = 2 - foreach(a, { el : Int -> System.out?.println(el) }) + foreach(a, { el : Int -> el }) almostFilter(a, { el : Int -> el }) main(null) return "OK" diff --git a/compiler/testData/codegen/box/controlStructures/kt769.kt b/compiler/testData/codegen/box/controlStructures/kt769.kt index 72f9d9105d2..1f79d6700d6 100644 --- a/compiler/testData/codegen/box/controlStructures/kt769.kt +++ b/compiler/testData/codegen/box/controlStructures/kt769.kt @@ -1,10 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - package w_range fun box() : String { @@ -13,6 +6,5 @@ fun box() : String { 1 -> i-- else -> { i = 2 } } - System.out?.println(i) - return "OK" + return if (i == 2) "OK" else i.toString() } diff --git a/compiler/testData/codegen/box/extensionFunctions/kt606.kt b/compiler/testData/codegen/box/extensionFunctions/kt606.kt index fea7c3f3005..ea40cc28fae 100644 --- a/compiler/testData/codegen/box/extensionFunctions/kt606.kt +++ b/compiler/testData/codegen/box/extensionFunctions/kt606.kt @@ -1,10 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - package kt606 //KT-606 wrong resolved call @@ -21,9 +14,11 @@ interface ChannelPipeline { fun print(any: Any) } +var result = "FAIL" + class DefaultChannelPipeline : ChannelPipeline { override fun print(any: Any) { - System.out?.println(any) + result = any as String } } @@ -34,5 +29,5 @@ interface ChannelPipelineFactory { fun box() : String { StandardPipelineFactory({ print("OK") }).getPipeline() - return "OK" + return result } diff --git a/compiler/testData/codegen/box/objects/kt535.kt b/compiler/testData/codegen/box/objects/kt535.kt index 18f16b6484d..29922f9f81d 100644 --- a/compiler/testData/codegen/box/objects/kt535.kt +++ b/compiler/testData/codegen/box/objects/kt535.kt @@ -1,10 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - class Identifier(t : T?, myHasDollar : Boolean) { private val myT : T? @@ -22,7 +15,6 @@ class Identifier(t : T?, myHasDollar : Boolean) { } fun box() : String { - var i3 : Identifier? = Identifier.init("name") - System.out?.println(i3?.getName()) - return "OK" + var i3 : Identifier? = Identifier.init("OK") + return i3?.getName() ?: "FAIL" } diff --git a/compiler/testData/codegen/box/primitiveTypes/kt753.kt b/compiler/testData/codegen/box/primitiveTypes/kt753.kt index 6751346bda7..2094e8db917 100644 --- a/compiler/testData/codegen/box/primitiveTypes/kt753.kt +++ b/compiler/testData/codegen/box/primitiveTypes/kt753.kt @@ -1,10 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - package bitwise_demo fun Long?.shl(bits : Int?) : Long = this!!.shl(bits!!) @@ -13,6 +6,6 @@ fun box() : String { val x : Long? = 10 val y : Int? = 12 - System.out?.println(x.shl(y)) - return "OK" + val result = x.shl(y) + return if (result == 40960L) "OK" else result.toString() } diff --git a/compiler/testData/codegen/box/primitiveTypes/kt756.kt b/compiler/testData/codegen/box/primitiveTypes/kt756.kt index d15cfec1619..f8221771b80 100644 --- a/compiler/testData/codegen/box/primitiveTypes/kt756.kt +++ b/compiler/testData/codegen/box/primitiveTypes/kt756.kt @@ -1,10 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - package demo_range operator fun Int?.unaryPlus() : Int = this!!.unaryPlus() @@ -14,6 +7,9 @@ operator fun Int?.unaryMinus() : Int = this!!.unaryMinus() fun box() : String { val x : Int? = 10 - System.out?.println(x?.inv())// * x?.unaryPlus() * x?.dec() * x?.unaryMinus() as Number) - return "OK" + val result = x?.inv() + if (result == -11)// * x?.unaryPlus() * x?.dec() * x?.unaryMinus() as Number) + return "OK" + else + return result.toString() } diff --git a/compiler/testData/codegen/box/primitiveTypes/kt757.kt b/compiler/testData/codegen/box/primitiveTypes/kt757.kt index 4ff0a1231eb..437602aecaa 100644 --- a/compiler/testData/codegen/box/primitiveTypes/kt757.kt +++ b/compiler/testData/codegen/box/primitiveTypes/kt757.kt @@ -1,16 +1,9 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - package demo_long fun Long?.inv() : Long = this!!.inv() fun box() : String { val x : Long? = 10 - System.out?.println(x.inv()) - return if(x.inv() == -11.toLong()) "OK" else "fail" + val result = x.inv() + return if(result == -11.toLong()) "OK" else result.toString() } diff --git a/compiler/testData/codegen/box/regressions/kt344.kt b/compiler/testData/codegen/box/regressions/kt344.kt index 8b8ea6a0113..b1c5d39766f 100644 --- a/compiler/testData/codegen/box/regressions/kt344.kt +++ b/compiler/testData/codegen/box/regressions/kt344.kt @@ -1,10 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - // WITH_STDLIB fun s0() : Boolean { @@ -41,7 +34,6 @@ fun t1() : Boolean { foo() x += "bbb" - System.out?.println(x) return x == "4511122aaabbb" } @@ -56,7 +48,6 @@ fun t2() : Boolean { } foo() x -= 55 - System.out?.println(x) return x == 200 } @@ -79,7 +70,6 @@ fun t4() : Boolean { Unit } foo() - System.out?.println(x) return x == 440.toFloat() } @@ -92,7 +82,6 @@ fun t5() : Boolean { Unit } foo() - System.out?.println(x) return x == 400.toDouble() } @@ -106,7 +95,6 @@ fun t6() : Boolean { Unit } foo() - System.out?.println(x) return x == 83.toByte() } @@ -117,7 +105,6 @@ fun t7() : Boolean { Unit } foo() - System.out?.println(x) return x == 'b' } @@ -171,19 +158,6 @@ fun t11(x0: Int) : Int { return x } -fun t12(x: Int) : Int { - var y = x - val runnable = object : Runnable { - override fun run () { - y = y + 1 - } - } - while(y < 100) { - runnable.run() - } - return y -} - fun box(): String { if (!s0()) return "s0 fail" if (!s1()) return "s1 fail" @@ -198,7 +172,6 @@ fun box(): String { if (!t9(0)) return "t9 fail" if (!t10()) return "t10 fail" if (t11(1) != 101) return "t11 fail" - if (t12(0) != 100) return "t12 fail" return "OK" } diff --git a/compiler/testData/codegen/box/regressions/kt344Runnable.kt b/compiler/testData/codegen/box/regressions/kt344Runnable.kt new file mode 100644 index 00000000000..2ebd7bc0d2b --- /dev/null +++ b/compiler/testData/codegen/box/regressions/kt344Runnable.kt @@ -0,0 +1,21 @@ +// TARGET_BACKEND: JVM +// TARGET_BACKEND: JVM_IR +// WITH_STDLIB + +fun t12(x: Int) : Int { + var y = x + val runnable = object : Runnable { + override fun run () { + y = y + 1 + } + } + while(y < 100) { + runnable.run() + } + return y +} + +fun box(): String { + val result = t12(0) + return if (result == 100) "OK" else result.toString() +} diff --git a/compiler/testData/codegen/box/strings/kt889.kt b/compiler/testData/codegen/box/strings/kt889.kt index 29357337755..52810370105 100644 --- a/compiler/testData/codegen/box/strings/kt889.kt +++ b/compiler/testData/codegen/box/strings/kt889.kt @@ -1,12 +1,4 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: IGNORED_IN_JS -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - operator fun Int.plus(s: String) : String { - System.out?.println("Int.plus(s: String) called") return s } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 61d84223c15..e67492048d2 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -44813,6 +44813,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/regressions/kt3442.kt"); } + @Test + @TestMetadata("kt344Runnable.kt") + public void testKt344Runnable() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt344Runnable.kt"); + } + @Test @TestMetadata("kt3587.kt") public void testKt3587() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index f43a3d903cb..5c9442472b4 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -47483,6 +47483,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/regressions/kt3442.kt"); } + @Test + @TestMetadata("kt344Runnable.kt") + public void testKt344Runnable() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt344Runnable.kt"); + } + @Test @TestMetadata("kt3587.kt") public void testKt3587() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index 180f1f1c292..c370d529c31 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -47483,6 +47483,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/regressions/kt3442.kt"); } + @Test + @TestMetadata("kt344Runnable.kt") + public void testKt344Runnable() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt344Runnable.kt"); + } + @Test @TestMetadata("kt3587.kt") public void testKt3587() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 259b6502360..e29ed009274 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -36215,6 +36215,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/regressions/kt3442.kt"); } + @TestMetadata("kt344Runnable.kt") + public void testKt344Runnable() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt344Runnable.kt"); + } + @TestMetadata("kt3587.kt") public void testKt3587() throws Exception { runTest("compiler/testData/codegen/box/regressions/kt3587.kt");