diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIntrinsics.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIntrinsics.kt index 1c275d872d1..13e977f6133 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIntrinsics.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIntrinsics.kt @@ -122,6 +122,8 @@ class JsIntrinsics( val jsCompareTo = getInternalFunction("compareTo") val jsEquals = getInternalFunction("equals") + val jsNumberRangeToNumber = getInternalFunction("numberRangeToNumber") + val jsNumberRangeToLong = getInternalFunction("numberRangeToLong") val longConstructor = context.symbolTable.referenceConstructor(context.getClass(FqName("kotlin.Long")).constructors.single()) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/IntrinsicifyCallsLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/IntrinsicifyCallsLowering.kt index 6955eaa3699..929b5958ed7 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/IntrinsicifyCallsLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/IntrinsicifyCallsLowering.kt @@ -115,6 +115,10 @@ class IntrinsicifyCallsLowering(private val context: JsIrBackendContext) : FileL op(it, ConversionNames.TO_SHORT, ::useDispatchReceiver) op(it, ConversionNames.TO_LONG, intrinsics.jsToLong) } + + for (type in primitiveNumbers) { + op(type, Name.identifier("rangeTo"), ::transformRangeTo) + } } symbolToTransformer.run { @@ -287,6 +291,19 @@ class IntrinsicifyCallsLowering(private val context: JsIrBackendContext) : FileL return call.dispatchReceiver!! } + private fun transformRangeTo(call: IrCall): IrExpression { + if (call.valueArgumentsCount != 1) return call + return with(call.symbol.owner.valueParameters[0].type) { + when { + isByte() || isShort() || isInt() -> + irCall(call, intrinsics.jsNumberRangeToNumber, dispatchReceiverAsFirstArgument = true) + isLong() -> + irCall(call, intrinsics.jsNumberRangeToLong, dispatchReceiverAsFirstArgument = true) + else -> call + } + } + } + private fun transformEqeqOperator(call: IrCall): IrExpression { val lhs = call.getValueArgument(0)!! val rhs = call.getValueArgument(1)!! diff --git a/compiler/testData/codegen/box/bridges/strListContains.kt b/compiler/testData/codegen/box/bridges/strListContains.kt index b9e0c230896..cd092b0c2a8 100644 --- a/compiler/testData/codegen/box/bridges/strListContains.kt +++ b/compiler/testData/codegen/box/bridges/strListContains.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: NATIVE class StrList : List { diff --git a/compiler/testData/codegen/box/builtinStubMethods/customReadOnlyIterator.kt b/compiler/testData/codegen/box/builtinStubMethods/customReadOnlyIterator.kt index d29523dcee9..2038e67cbb5 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/customReadOnlyIterator.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/customReadOnlyIterator.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class A : Collection { override val size: Int get() = throw UnsupportedOperationException() diff --git a/compiler/testData/codegen/box/casts/asUnit.kt b/compiler/testData/codegen/box/casts/asUnit.kt index 1bdbea8e398..8c11703906c 100644 --- a/compiler/testData/codegen/box/casts/asUnit.kt +++ b/compiler/testData/codegen/box/casts/asUnit.kt @@ -1,2 +1 @@ -// IGNORE_BACKEND: JS_IR fun box() = if (4 as? Unit != null) "Fail" else "OK" \ No newline at end of file diff --git a/compiler/testData/codegen/box/classes/kt2711.kt b/compiler/testData/codegen/box/classes/kt2711.kt index 55f4c972f66..409537ae567 100644 --- a/compiler/testData/codegen/box/classes/kt2711.kt +++ b/compiler/testData/codegen/box/classes/kt2711.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class IntRange { operator fun contains(a: Int) = (1..2).contains(a) } diff --git a/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/breakInExpr.kt b/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/breakInExpr.kt index fe5e4e0b6ea..203452b0a60 100644 --- a/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/breakInExpr.kt +++ b/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/breakInExpr.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun test(str: String): String { var s = "" for (i in 1..3) { diff --git a/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/continueInExpr.kt b/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/continueInExpr.kt index af0e994c588..667cd474bd0 100644 --- a/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/continueInExpr.kt +++ b/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/continueInExpr.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { var s = "OK" for (i in 1..3) { diff --git a/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/tryFinally2.kt b/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/tryFinally2.kt index 73aef1a778e..147362a181c 100644 --- a/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/tryFinally2.kt +++ b/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/tryFinally2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { var r = "" for (i in 1..1) { diff --git a/compiler/testData/codegen/box/controlStructures/emptyFor.kt b/compiler/testData/codegen/box/controlStructures/emptyFor.kt index 4c899607ee6..99d38c94472 100644 --- a/compiler/testData/codegen/box/controlStructures/emptyFor.kt +++ b/compiler/testData/codegen/box/controlStructures/emptyFor.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR var index = 0 interface IterableIterator : Iterator { diff --git a/compiler/testData/codegen/box/controlStructures/kt1742.kt b/compiler/testData/codegen/box/controlStructures/kt1742.kt index cc1505a6ac6..6e950e30e41 100644 --- a/compiler/testData/codegen/box/controlStructures/kt1742.kt +++ b/compiler/testData/codegen/box/controlStructures/kt1742.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { val x = 2 return when(x) { diff --git a/compiler/testData/codegen/box/controlStructures/kt299.kt b/compiler/testData/codegen/box/controlStructures/kt299.kt index 0a27769b6e5..9cb4628e7da 100644 --- a/compiler/testData/codegen/box/controlStructures/kt299.kt +++ b/compiler/testData/codegen/box/controlStructures/kt299.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class MyRange1() : ClosedRange { override val start: Int get() = 0 diff --git a/compiler/testData/codegen/box/controlStructures/kt772.kt b/compiler/testData/codegen/box/controlStructures/kt772.kt index 3c454052db3..6facb9ef23d 100644 --- a/compiler/testData/codegen/box/controlStructures/kt772.kt +++ b/compiler/testData/codegen/box/controlStructures/kt772.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR package demo2 fun print(o : Any?) {} diff --git a/compiler/testData/codegen/box/controlStructures/kt773.kt b/compiler/testData/codegen/box/controlStructures/kt773.kt index 3c454052db3..6facb9ef23d 100644 --- a/compiler/testData/codegen/box/controlStructures/kt773.kt +++ b/compiler/testData/codegen/box/controlStructures/kt773.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR package demo2 fun print(o : Any?) {} diff --git a/compiler/testData/codegen/box/controlStructures/kt958.kt b/compiler/testData/codegen/box/controlStructures/kt958.kt index d99ef51951a..f32079bfb69 100644 --- a/compiler/testData/codegen/box/controlStructures/kt958.kt +++ b/compiler/testData/codegen/box/controlStructures/kt958.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun test() = 239 fun box() = if(test() in 239..240) "OK" else "fail" diff --git a/compiler/testData/codegen/box/finally/kt3874.kt b/compiler/testData/codegen/box/finally/kt3874.kt index 7fb3b091a59..fa0a4259d12 100644 --- a/compiler/testData/codegen/box/finally/kt3874.kt +++ b/compiler/testData/codegen/box/finally/kt3874.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun test1(): String { var r = "" for (i in 1..2) { diff --git a/compiler/testData/codegen/box/finally/loopAndFinally.kt b/compiler/testData/codegen/box/finally/loopAndFinally.kt index 02d7b6054a2..88425e55ac0 100644 --- a/compiler/testData/codegen/box/finally/loopAndFinally.kt +++ b/compiler/testData/codegen/box/finally/loopAndFinally.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR //KT-3869 Loops and finally: outer finally block not run class MyString { diff --git a/compiler/testData/codegen/box/finally/tryLoopTry.kt b/compiler/testData/codegen/box/finally/tryLoopTry.kt index 15aeaba887e..0a969975070 100644 --- a/compiler/testData/codegen/box/finally/tryLoopTry.kt +++ b/compiler/testData/codegen/box/finally/tryLoopTry.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR //test for appropriate class MyString { diff --git a/compiler/testData/codegen/box/functions/kt1038.kt b/compiler/testData/codegen/box/functions/kt1038.kt index b0a8a8f31d4..8b2f756f565 100644 --- a/compiler/testData/codegen/box/functions/kt1038.kt +++ b/compiler/testData/codegen/box/functions/kt1038.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR //KT-1038 Cannot compile lazy iterators class YieldingIterator(val yieldingFunction : ()->T?) : Iterator diff --git a/compiler/testData/codegen/box/functions/localFunction.kt b/compiler/testData/codegen/box/functions/localFunction.kt index b1fac3958df..4507e1fdcf5 100644 --- a/compiler/testData/codegen/box/functions/localFunction.kt +++ b/compiler/testData/codegen/box/functions/localFunction.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR fun IntRange.forEach(body : (Int) -> Unit) { for(i in this) { body(i) diff --git a/compiler/testData/codegen/box/intrinsics/tostring.kt b/compiler/testData/codegen/box/intrinsics/tostring.kt index afe3a1e8497..27f9f1a11a0 100644 --- a/compiler/testData/codegen/box/intrinsics/tostring.kt +++ b/compiler/testData/codegen/box/intrinsics/tostring.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS diff --git a/compiler/testData/codegen/box/labels/controlLabelClashesWithFuncitonName.kt b/compiler/testData/codegen/box/labels/controlLabelClashesWithFuncitonName.kt index d08eb1c6e1b..ae2f251cc2c 100644 --- a/compiler/testData/codegen/box/labels/controlLabelClashesWithFuncitonName.kt +++ b/compiler/testData/codegen/box/labels/controlLabelClashesWithFuncitonName.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun test1(): Boolean { test1@ for(i in 1..2) { continue@test1 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt index 1668d6c10f9..68454565301 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt index 0dea2e2ed49..7260d0528f6 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt index 8793b317dc1..b5cade5f662 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class M { operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt index d0127b64804..22ed58c8d10 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class M { operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt index 1668d6c10f9..68454565301 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt index 0dea2e2ed49..7260d0528f6 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt index 8793b317dc1..b5cade5f662 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class M { operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt index d0127b64804..22ed58c8d10 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class M { operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt b/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt index e575643f94f..5f60ba33287 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt b/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt index a4a18ab6f42..9a72ce29b4d 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt b/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt index 3467fc76df8..e1a6673c11a 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class M { operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt index 5e42b8c9633..1a20e756f0f 100644 --- a/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ b/compiler/testData/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class M { operator fun Int.component1() = this + 1 operator fun Int.component2() = this + 2 diff --git a/compiler/testData/codegen/box/objects/flist.kt b/compiler/testData/codegen/box/objects/flist.kt index d157428f882..38d9f83908a 100644 --- a/compiler/testData/codegen/box/objects/flist.kt +++ b/compiler/testData/codegen/box/objects/flist.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR public abstract class FList() { public abstract val head: T public abstract val tail: FList diff --git a/compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt b/compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt index da8049dc0b5..814c710eb36 100644 --- a/compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt +++ b/compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // KT-5869 operator fun Iterator.iterator(): Iterator = this diff --git a/compiler/testData/codegen/box/ranges/contains/inPrimitiveRange.kt b/compiler/testData/codegen/box/ranges/contains/inPrimitiveRange.kt index 33ba6c5606c..2113dca0c54 100644 --- a/compiler/testData/codegen/box/ranges/contains/inPrimitiveRange.kt +++ b/compiler/testData/codegen/box/ranges/contains/inPrimitiveRange.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME val range = 1 .. 3 diff --git a/compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt b/compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt index 05f2b90dea1..9e2c9269f96 100644 --- a/compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt +++ b/compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR operator fun IntRange.contains(s: String): Boolean = true fun box(): String { diff --git a/compiler/testData/codegen/box/ranges/nullableLoopParameter/progressionExpression.kt b/compiler/testData/codegen/box/ranges/nullableLoopParameter/progressionExpression.kt index 44f187f9256..2caf1a33808 100644 --- a/compiler/testData/codegen/box/ranges/nullableLoopParameter/progressionExpression.kt +++ b/compiler/testData/codegen/box/ranges/nullableLoopParameter/progressionExpression.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { var result = 0 val intRange: IntProgression = 1..3 diff --git a/compiler/testData/codegen/box/ranges/nullableLoopParameter/rangeExpression.kt b/compiler/testData/codegen/box/ranges/nullableLoopParameter/rangeExpression.kt index 2ee96f1cb13..7cc906c09d2 100644 --- a/compiler/testData/codegen/box/ranges/nullableLoopParameter/rangeExpression.kt +++ b/compiler/testData/codegen/box/ranges/nullableLoopParameter/rangeExpression.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { var result = 0 val intRange = 1..3 diff --git a/compiler/testData/codegen/box/ranges/nullableLoopParameter/rangeLiteral.kt b/compiler/testData/codegen/box/ranges/nullableLoopParameter/rangeLiteral.kt index f89e704b78a..52713ad8bf7 100644 --- a/compiler/testData/codegen/box/ranges/nullableLoopParameter/rangeLiteral.kt +++ b/compiler/testData/codegen/box/ranges/nullableLoopParameter/rangeLiteral.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { var result = 0 for (i: Int? in 1..3) { diff --git a/compiler/testData/codegen/box/specialBuiltins/emptyMap.kt b/compiler/testData/codegen/box/specialBuiltins/emptyMap.kt index c6912bd3fa8..c0770bd6b2a 100644 --- a/compiler/testData/codegen/box/specialBuiltins/emptyMap.kt +++ b/compiler/testData/codegen/box/specialBuiltins/emptyMap.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR private object EmptyMap : Map { override val size: Int get() = 0 override fun isEmpty(): Boolean = true diff --git a/compiler/testData/codegen/box/specialBuiltins/emptyStringMap.kt b/compiler/testData/codegen/box/specialBuiltins/emptyStringMap.kt index d5b1841166f..fd4953af8ec 100644 --- a/compiler/testData/codegen/box/specialBuiltins/emptyStringMap.kt +++ b/compiler/testData/codegen/box/specialBuiltins/emptyStringMap.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR private object EmptyStringMap : Map { override val size: Int get() = 0 override fun isEmpty(): Boolean = true diff --git a/compiler/testData/codegen/box/specialBuiltins/irrelevantRemoveAtOverride.kt b/compiler/testData/codegen/box/specialBuiltins/irrelevantRemoveAtOverride.kt index 74b435671f2..747fb11092b 100644 --- a/compiler/testData/codegen/box/specialBuiltins/irrelevantRemoveAtOverride.kt +++ b/compiler/testData/codegen/box/specialBuiltins/irrelevantRemoveAtOverride.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: NATIVE interface Container { diff --git a/compiler/testData/codegen/box/specialBuiltins/maps.kt b/compiler/testData/codegen/box/specialBuiltins/maps.kt index 11f356ce047..e16c06cba11 100644 --- a/compiler/testData/codegen/box/specialBuiltins/maps.kt +++ b/compiler/testData/codegen/box/specialBuiltins/maps.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: NATIVE class A : Map { diff --git a/compiler/testData/codegen/box/specialBuiltins/noSpecialBridgeInSuperClass.kt b/compiler/testData/codegen/box/specialBuiltins/noSpecialBridgeInSuperClass.kt index d6f5e02cf99..8857356fa06 100644 --- a/compiler/testData/codegen/box/specialBuiltins/noSpecialBridgeInSuperClass.kt +++ b/compiler/testData/codegen/box/specialBuiltins/noSpecialBridgeInSuperClass.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: NATIVE var result = "" diff --git a/compiler/testData/codegen/box/specialBuiltins/redundantStubForSize.kt b/compiler/testData/codegen/box/specialBuiltins/redundantStubForSize.kt index c198fd8a311..df0376cc9cb 100644 --- a/compiler/testData/codegen/box/specialBuiltins/redundantStubForSize.kt +++ b/compiler/testData/codegen/box/specialBuiltins/redundantStubForSize.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR open class A1 { open val size: Int = 56 } diff --git a/compiler/testData/codegen/box/specialBuiltins/removeAtTwoSpecialBridges.kt b/compiler/testData/codegen/box/specialBuiltins/removeAtTwoSpecialBridges.kt index 9b4bd74b9c6..7a312ef58fb 100644 --- a/compiler/testData/codegen/box/specialBuiltins/removeAtTwoSpecialBridges.kt +++ b/compiler/testData/codegen/box/specialBuiltins/removeAtTwoSpecialBridges.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: NATIVE open class A0 : MutableList { diff --git a/compiler/testData/codegen/box/when/whenSubjectVariable/rangeCheckOnSubjectVariable.kt b/compiler/testData/codegen/box/when/whenSubjectVariable/rangeCheckOnSubjectVariable.kt index fc37fb3115b..c093688f7d6 100644 --- a/compiler/testData/codegen/box/when/whenSubjectVariable/rangeCheckOnSubjectVariable.kt +++ b/compiler/testData/codegen/box/when/whenSubjectVariable/rangeCheckOnSubjectVariable.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +VariableDeclarationInWhenSubject -// IGNORE_BACKEND: JS_IR val x = 1 diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/break.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/break.kt index 06b2ce3b40c..3ba44f84b8a 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/break.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/break.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/continue.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/continue.kt index 3b46a62d886..54a08207e5f 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/continue.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/continue.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/forInFinally.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/forInFinally.kt index 86d0271c080..ab9666b28bf 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/forInFinally.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/forInFinally.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // FILE: 1.kt package test diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt index 6cd958e9b4b..d969a79899e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt @@ -22,6 +22,16 @@ private val runtimeSources = listOfKtFilesFrom( "libraries/stdlib/js/src/kotlin/core.kt", "core/builtins/native/kotlin/Number.kt", "core/builtins/native/kotlin/Comparable.kt", + "core/builtins/src/kotlin/internal/InternalAnnotations.kt", + "core/builtins/src/kotlin/internal/progressionUtil.kt", + "core/builtins/src/kotlin/Iterators.kt", + "core/builtins/src/kotlin/ProgressionIterators.kt", + "core/builtins/src/kotlin/Progressions.kt", + "core/builtins/src/kotlin/Range.kt", + "core/builtins/src/kotlin/Ranges.kt", + "core/builtins/src/kotlin/Unit.kt", + "core/builtins/native/kotlin/Collections.kt", + "core/builtins/native/kotlin/Iterator.kt", "libraries/stdlib/js/irRuntime", BasicBoxTest.COMMON_FILES_DIR_PATH ) diff --git a/js/js.translator/testData/box/closure/closureReferencingMember.kt b/js/js.translator/testData/box/closure/closureReferencingMember.kt index 50375f776e1..c8ca8de88a6 100644 --- a/js/js.translator/testData/box/closure/closureReferencingMember.kt +++ b/js/js.translator/testData/box/closure/closureReferencingMember.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1117 package foo diff --git a/js/js.translator/testData/box/expression/evaluationOrder/castWithBreakContinueReturn.kt b/js/js.translator/testData/box/expression/evaluationOrder/castWithBreakContinueReturn.kt index 04b7aed919c..09de08f7852 100644 --- a/js/js.translator/testData/box/expression/evaluationOrder/castWithBreakContinueReturn.kt +++ b/js/js.translator/testData/box/expression/evaluationOrder/castWithBreakContinueReturn.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1125 package foo diff --git a/js/js.translator/testData/box/expression/evaluationOrder/loopWithBreakContinueReturnInCondition.kt b/js/js.translator/testData/box/expression/evaluationOrder/loopWithBreakContinueReturnInCondition.kt index 5fe1d6b091c..db92d77fd12 100644 --- a/js/js.translator/testData/box/expression/evaluationOrder/loopWithBreakContinueReturnInCondition.kt +++ b/js/js.translator/testData/box/expression/evaluationOrder/loopWithBreakContinueReturnInCondition.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1236 package foo @@ -86,4 +85,4 @@ fun box(): String { assertEquals(":return:", global) return "OK" -} \ No newline at end of file +} diff --git a/js/js.translator/testData/box/expression/for/forWithComplexOneStatement.kt b/js/js.translator/testData/box/expression/for/forWithComplexOneStatement.kt index 1d9933d7abd..507eaccc63a 100644 --- a/js/js.translator/testData/box/expression/for/forWithComplexOneStatement.kt +++ b/js/js.translator/testData/box/expression/for/forWithComplexOneStatement.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1112 package foo diff --git a/js/js.translator/testData/box/expression/for/labeledForWithContinue.kt b/js/js.translator/testData/box/expression/for/labeledForWithContinue.kt index 42e0e5be4f4..6300dad0ecc 100644 --- a/js/js.translator/testData/box/expression/for/labeledForWithContinue.kt +++ b/js/js.translator/testData/box/expression/for/labeledForWithContinue.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1114 // http://youtrack.jetbrains.com/issue/KT-5257 // JS: for with continue with label fails on runtime diff --git a/js/js.translator/testData/box/expression/for/labeledForWithWhile.kt b/js/js.translator/testData/box/expression/for/labeledForWithWhile.kt index 8d84f79df3d..d2030193520 100644 --- a/js/js.translator/testData/box/expression/for/labeledForWithWhile.kt +++ b/js/js.translator/testData/box/expression/for/labeledForWithWhile.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1112 package foo diff --git a/js/js.translator/testData/box/expression/misc/inheritFromJetIterator.kt b/js/js.translator/testData/box/expression/misc/inheritFromJetIterator.kt index b8d83eb8b94..eebdb8d7125 100644 --- a/js/js.translator/testData/box/expression/misc/inheritFromJetIterator.kt +++ b/js/js.translator/testData/box/expression/misc/inheritFromJetIterator.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1113 package foo diff --git a/js/js.translator/testData/box/expression/misc/packageLevelVarInPackage.kt b/js/js.translator/testData/box/expression/misc/packageLevelVarInPackage.kt index 0ed3cac6881..7404d370b70 100644 --- a/js/js.translator/testData/box/expression/misc/packageLevelVarInPackage.kt +++ b/js/js.translator/testData/box/expression/misc/packageLevelVarInPackage.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1110 package foo diff --git a/js/js.translator/testData/box/expression/misc/packageLevelVarInRoot.kt b/js/js.translator/testData/box/expression/misc/packageLevelVarInRoot.kt index 5536b7df3be..a5e9680863d 100644 --- a/js/js.translator/testData/box/expression/misc/packageLevelVarInRoot.kt +++ b/js/js.translator/testData/box/expression/misc/packageLevelVarInRoot.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1110 var c = 2 diff --git a/js/js.translator/testData/box/expression/when/whenStatementWithRangeClause.kt b/js/js.translator/testData/box/expression/when/whenStatementWithRangeClause.kt index 6af024b228f..fffb5e11f91 100644 --- a/js/js.translator/testData/box/expression/when/whenStatementWithRangeClause.kt +++ b/js/js.translator/testData/box/expression/when/whenStatementWithRangeClause.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1109 // see KT-7683 // WhenTranslator must recognize KtWhenConditionInRange for when statement diff --git a/js/js.translator/testData/box/expression/when/whenWithCustomRangeClause.kt b/js/js.translator/testData/box/expression/when/whenWithCustomRangeClause.kt index 22196db5ce9..09490993254 100644 --- a/js/js.translator/testData/box/expression/when/whenWithCustomRangeClause.kt +++ b/js/js.translator/testData/box/expression/when/whenWithCustomRangeClause.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1122 // see KT-7683 // WhenTranslator must recognize KtWhenConditionInRange for custom classes that implement ClosedRange diff --git a/js/js.translator/testData/box/expression/when/whenWithRangeClause.kt b/js/js.translator/testData/box/expression/when/whenWithRangeClause.kt index 992a31dcaa6..43a33abb40f 100644 --- a/js/js.translator/testData/box/expression/when/whenWithRangeClause.kt +++ b/js/js.translator/testData/box/expression/when/whenWithRangeClause.kt @@ -1,5 +1,4 @@ -// IGNORE_BACKEND: JS_IR -// EXPECTED_REACHABLE_NODES: 1230 +// EXPECTED_REACHABLE_NODES: 1112 // see KT-7683 // WhenTranslator must recognize KtWhenConditionInRange and produce faster code when matched expression is Int package foo @@ -31,4 +30,4 @@ fun get(value: Int): Int { invocationCount++ return value } -var invocationCount = 0 \ No newline at end of file +var invocationCount = 0 diff --git a/js/js.translator/testData/box/inheritance/fromFakeClasses.kt b/js/js.translator/testData/box/inheritance/fromFakeClasses.kt index 0201cd2b36b..0bc2f5b1d4a 100644 --- a/js/js.translator/testData/box/inheritance/fromFakeClasses.kt +++ b/js/js.translator/testData/box/inheritance/fromFakeClasses.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1131 package foo diff --git a/js/js.translator/testData/box/inline/inlineCallNoInline.kt b/js/js.translator/testData/box/inline/inlineCallNoInline.kt index bfacfc45af0..64172bd3645 100644 --- a/js/js.translator/testData/box/inline/inlineCallNoInline.kt +++ b/js/js.translator/testData/box/inline/inlineCallNoInline.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1115 package foo diff --git a/js/js.translator/testData/box/inline/localInlineExtensionFunction.kt b/js/js.translator/testData/box/inline/localInlineExtensionFunction.kt index f911da9bcaf..74b458dfdf4 100644 --- a/js/js.translator/testData/box/inline/localInlineExtensionFunction.kt +++ b/js/js.translator/testData/box/inline/localInlineExtensionFunction.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1152 package foo diff --git a/js/js.translator/testData/box/inline/localInlineFunction.kt b/js/js.translator/testData/box/inline/localInlineFunction.kt index 808276175f0..349b22e3ed7 100644 --- a/js/js.translator/testData/box/inline/localInlineFunction.kt +++ b/js/js.translator/testData/box/inline/localInlineFunction.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1114 package foo diff --git a/js/js.translator/testData/box/inline/thisImplicitlyCaptured.kt b/js/js.translator/testData/box/inline/thisImplicitlyCaptured.kt index 5ea223cffea..cb23a7b63a6 100644 --- a/js/js.translator/testData/box/inline/thisImplicitlyCaptured.kt +++ b/js/js.translator/testData/box/inline/thisImplicitlyCaptured.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1125 package foo diff --git a/js/js.translator/testData/box/inlineEvaluationOrder/for.kt b/js/js.translator/testData/box/inlineEvaluationOrder/for.kt index 8aeeb886b73..dbe3d7e3071 100644 --- a/js/js.translator/testData/box/inlineEvaluationOrder/for.kt +++ b/js/js.translator/testData/box/inlineEvaluationOrder/for.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1116 package foo diff --git a/js/js.translator/testData/box/jsCode/labelNestedClashWithKotlin.kt b/js/js.translator/testData/box/jsCode/labelNestedClashWithKotlin.kt index 7e035a633fd..b72a87b844c 100644 --- a/js/js.translator/testData/box/jsCode/labelNestedClashWithKotlin.kt +++ b/js/js.translator/testData/box/jsCode/labelNestedClashWithKotlin.kt @@ -1,5 +1,4 @@ -// IGNORE_BACKEND: JS_IR -// EXPECTED_REACHABLE_NODES: 1229 +// EXPECTED_REACHABLE_NODES: 1112 package foo fun box(): String { @@ -32,4 +31,4 @@ fun box(): String { assertEquals(sum - skipOuter - skipInner, sumInner, "sumInner") return "OK" -} \ No newline at end of file +} diff --git a/js/js.translator/testData/box/labels/labelWithVariableClashing.kt b/js/js.translator/testData/box/labels/labelWithVariableClashing.kt index fed39b04c54..58e89945f33 100644 --- a/js/js.translator/testData/box/labels/labelWithVariableClashing.kt +++ b/js/js.translator/testData/box/labels/labelWithVariableClashing.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1114 package foo diff --git a/js/js.translator/testData/box/labels/nestedLabels.kt b/js/js.translator/testData/box/labels/nestedLabels.kt index b4a9663a025..3c9b774521f 100644 --- a/js/js.translator/testData/box/labels/nestedLabels.kt +++ b/js/js.translator/testData/box/labels/nestedLabels.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1115 package foo diff --git a/js/js.translator/testData/box/labels/nestedLabelsInlinedClashing.kt b/js/js.translator/testData/box/labels/nestedLabelsInlinedClashing.kt index c257b946928..4db1a72b239 100644 --- a/js/js.translator/testData/box/labels/nestedLabelsInlinedClashing.kt +++ b/js/js.translator/testData/box/labels/nestedLabelsInlinedClashing.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1146 package foo diff --git a/js/js.translator/testData/box/labels/nestedLabelsInlinedClashingAtFunctionsWithClosure.kt b/js/js.translator/testData/box/labels/nestedLabelsInlinedClashingAtFunctionsWithClosure.kt index 0c397346877..a82c6b050e8 100644 --- a/js/js.translator/testData/box/labels/nestedLabelsInlinedClashingAtFunctionsWithClosure.kt +++ b/js/js.translator/testData/box/labels/nestedLabelsInlinedClashingAtFunctionsWithClosure.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1146 package foo diff --git a/js/js.translator/testData/box/labels/peculiarNames.kt b/js/js.translator/testData/box/labels/peculiarNames.kt index cc5bff87b3f..be15a49e475 100644 --- a/js/js.translator/testData/box/labels/peculiarNames.kt +++ b/js/js.translator/testData/box/labels/peculiarNames.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1108 fun box(): String { var log = "" diff --git a/js/js.translator/testData/box/labels/siblingLabels.kt b/js/js.translator/testData/box/labels/siblingLabels.kt index 7ea76acbea3..3041e93bf79 100644 --- a/js/js.translator/testData/box/labels/siblingLabels.kt +++ b/js/js.translator/testData/box/labels/siblingLabels.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1115 package foo diff --git a/js/js.translator/testData/box/labels/siblingLabelsInlined.kt b/js/js.translator/testData/box/labels/siblingLabelsInlined.kt index 78d8af1be62..bd51e60a635 100644 --- a/js/js.translator/testData/box/labels/siblingLabelsInlined.kt +++ b/js/js.translator/testData/box/labels/siblingLabelsInlined.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1113 package foo diff --git a/js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt b/js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt index 794ea053e08..4a3ea25f15f 100644 --- a/js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt +++ b/js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1113 package foo diff --git a/js/js.translator/testData/box/labels/simpleLabel.kt b/js/js.translator/testData/box/labels/simpleLabel.kt index d386b9b7630..0e2585f40df 100644 --- a/js/js.translator/testData/box/labels/simpleLabel.kt +++ b/js/js.translator/testData/box/labels/simpleLabel.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1114 package foo diff --git a/js/js.translator/testData/box/labels/simpleLabelInlined.kt b/js/js.translator/testData/box/labels/simpleLabelInlined.kt index 192afb71c55..f3fc938a6e3 100644 --- a/js/js.translator/testData/box/labels/simpleLabelInlined.kt +++ b/js/js.translator/testData/box/labels/simpleLabelInlined.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1108 package foo diff --git a/js/js.translator/testData/box/multideclaration/multiValInIntFor.kt b/js/js.translator/testData/box/multideclaration/multiValInIntFor.kt index 41a85f24389..96049bc1923 100644 --- a/js/js.translator/testData/box/multideclaration/multiValInIntFor.kt +++ b/js/js.translator/testData/box/multideclaration/multiValInIntFor.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1110 package foo diff --git a/js/js.translator/testData/box/multideclaration/multiValInIntRangeFor.kt b/js/js.translator/testData/box/multideclaration/multiValInIntRangeFor.kt index 5d6c392cb95..6065a6af451 100644 --- a/js/js.translator/testData/box/multideclaration/multiValInIntRangeFor.kt +++ b/js/js.translator/testData/box/multideclaration/multiValInIntRangeFor.kt @@ -1,5 +1,4 @@ -// IGNORE_BACKEND: JS_IR -// EXPECTED_REACHABLE_NODES: 1228 +// EXPECTED_REACHABLE_NODES: 1110 package foo operator fun Int.component1(): Int { @@ -21,4 +20,4 @@ fun box(): String { if (s != "b") return "s != 'b', it: $s" return "OK" -} \ No newline at end of file +} diff --git a/js/js.translator/testData/box/nestedTypes/inheritanceFromNestedBuiltIn.kt b/js/js.translator/testData/box/nestedTypes/inheritanceFromNestedBuiltIn.kt index f8403d413f5..0a6de09b690 100644 --- a/js/js.translator/testData/box/nestedTypes/inheritanceFromNestedBuiltIn.kt +++ b/js/js.translator/testData/box/nestedTypes/inheritanceFromNestedBuiltIn.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1113 package foo diff --git a/js/js.translator/testData/box/range/creatingProgressions.kt b/js/js.translator/testData/box/range/creatingProgressions.kt index 8772f81b9fd..b12a8727ced 100644 --- a/js/js.translator/testData/box/range/creatingProgressions.kt +++ b/js/js.translator/testData/box/range/creatingProgressions.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1143 package foo diff --git a/js/js.translator/testData/box/range/explicitRange.kt b/js/js.translator/testData/box/range/explicitRange.kt index cdd1a30decf..1c6705e56fe 100644 --- a/js/js.translator/testData/box/range/explicitRange.kt +++ b/js/js.translator/testData/box/range/explicitRange.kt @@ -1,5 +1,4 @@ -// IGNORE_BACKEND: JS_IR -// EXPECTED_REACHABLE_NODES: 1226 +// EXPECTED_REACHABLE_NODES: 1108 package foo fun box(): String { diff --git a/js/js.translator/testData/box/range/intInRange.kt b/js/js.translator/testData/box/range/intInRange.kt index 69e2846a5e5..da175072ef8 100644 --- a/js/js.translator/testData/box/range/intInRange.kt +++ b/js/js.translator/testData/box/range/intInRange.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1108 package foo diff --git a/js/js.translator/testData/box/range/iteratingOverRanges.kt b/js/js.translator/testData/box/range/iteratingOverRanges.kt index 81197f61612..56cb03b8907 100644 --- a/js/js.translator/testData/box/range/iteratingOverRanges.kt +++ b/js/js.translator/testData/box/range/iteratingOverRanges.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1108 package foo diff --git a/js/js.translator/testData/box/range/rangeSugarSyntax.kt b/js/js.translator/testData/box/range/rangeSugarSyntax.kt index e9251813112..7d2e562a191 100644 --- a/js/js.translator/testData/box/range/rangeSugarSyntax.kt +++ b/js/js.translator/testData/box/range/rangeSugarSyntax.kt @@ -1,6 +1,4 @@ -// IGNORE_BACKEND: JS_IR -// EXPECTED_REACHABLE_NODES: 1226 -package foo +// EXPECTED_REACHABLE_NODES: 1108 fun box(): String { diff --git a/js/js.translator/testData/box/range/rangeToDoesNotIterate.kt b/js/js.translator/testData/box/range/rangeToDoesNotIterate.kt index 9479bedd22b..2de051276c3 100644 --- a/js/js.translator/testData/box/range/rangeToDoesNotIterate.kt +++ b/js/js.translator/testData/box/range/rangeToDoesNotIterate.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1108 package foo diff --git a/libraries/stdlib/js/irRuntime/exceptions.kt b/libraries/stdlib/js/irRuntime/exceptions.kt index e08ae6ac4d7..40523d7fae0 100644 --- a/libraries/stdlib/js/irRuntime/exceptions.kt +++ b/libraries/stdlib/js/irRuntime/exceptions.kt @@ -55,10 +55,15 @@ open class UnsupportedOperationException(message: String?, cause: Throwable?) : constructor(cause: Throwable?) : this(null, cause) } +open class NoSuchElementException(message: String?, cause: Throwable?) : RuntimeException(message, cause) { + constructor() : this(null, null) + constructor(message: String?) : this(message, null) +} + // TODO: fix function names to satisfy style convention (depends on built-in names) fun THROW_CCE() { throw ClassCastException() } fun THROW_NPE() { throw NullPointerException() -} \ No newline at end of file +} diff --git a/libraries/stdlib/js/irRuntime/rangeTo.kt b/libraries/stdlib/js/irRuntime/rangeTo.kt new file mode 100644 index 00000000000..28aa61afa03 --- /dev/null +++ b/libraries/stdlib/js/irRuntime/rangeTo.kt @@ -0,0 +1,15 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package kotlin.js + +// Creates IntRange for {Byte, Short, Int}.rangeTo(x: {Byte, Short, Int}) +fun numberRangeToNumber(start: dynamic, endInclusive: dynamic) = + IntRange(start, endInclusive) + +// Create LongRange for {Byte, Short, Int}.rangeTo(x: Long) +// Long.rangeTo(x: *) should be implemented in Long class +fun numberRangeToLong(start: dynamic, endInclusive: dynamic) = + LongRange(numberToLong(start), endInclusive)