From 7d5a304cf61a718d30d63c4cc9c9c0a9e48bd682 Mon Sep 17 00:00:00 2001 From: Anton Bannykh Date: Tue, 18 Sep 2018 15:41:38 +0300 Subject: [PATCH] [JS IR BE] support Char.rangeTo() --- compiler/testData/codegen/box/controlStructures/kt2291.kt | 1 - compiler/testData/codegen/box/controlStructures/kt2416.kt | 1 - compiler/testData/codegen/box/primitiveTypes/rangeTo.kt | 1 - .../codegen/box/ranges/contains/generated/charRangeLiteral.kt | 1 - .../testData/codegen/box/ranges/contains/generated/charUntil.kt | 1 - .../codegen/box/ranges/contains/genericCharInRangeLiteral.kt | 1 - .../codegen/box/ranges/expression/maxValueToMaxValue.kt | 1 - .../codegen/box/ranges/expression/maxValueToMinValue.kt | 1 - .../box/ranges/expression/progressionMaxValueToMaxValue.kt | 1 - .../box/ranges/forInReversed/ForInReversedReversedRange.kt | 1 - .../codegen/box/ranges/forInReversed/forInReversedEmptyRange.kt | 1 - .../box/ranges/forInReversed/forInReversedEmptyRangeLiteral.kt | 1 - .../forInReversedEmptyRangeLiteralWithNonConstBounds.kt | 1 - .../codegen/box/ranges/forInReversed/forInReversedRange.kt | 1 - .../box/ranges/forInReversed/forInReversedRangeLiteral.kt | 1 - .../forInReversedRangeLiteralWithNonConstBounds.kt | 1 - .../ranges/forInReversed/forInReversedReversedReversedRange.kt | 1 - .../codegen/box/ranges/forInReversed/forInReversedUntil.kt | 1 - .../forInReversed/forInReversedUntilWithNonConstBounds.kt | 1 - .../testData/codegen/box/ranges/forInUntil/forInUntilChar.kt | 1 - .../ranges/forWithPossibleOverflow/forInRangeToCharMaxValue.kt | 1 - .../forWithPossibleOverflow/forInRangeToCharMaxValueReversed.kt | 1 - .../testData/codegen/box/ranges/literal/maxValueToMaxValue.kt | 1 - .../testData/codegen/box/ranges/literal/maxValueToMinValue.kt | 1 - .../codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt | 1 - compiler/testData/codegen/box/when/switchOptimizationTypes.kt | 1 - js/js.translator/testData/box/char/charRanges.kt | 1 - .../testData/box/expression/when/whenWithCharRangeClause.kt | 1 - js/js.translator/testData/box/range/rangeEquals.kt | 1 - libraries/stdlib/js/irRuntime/char.kt | 2 +- 30 files changed, 1 insertion(+), 30 deletions(-) diff --git a/compiler/testData/codegen/box/controlStructures/kt2291.kt b/compiler/testData/codegen/box/controlStructures/kt2291.kt index 61416d14050..a1afcfe91b6 100644 --- a/compiler/testData/codegen/box/controlStructures/kt2291.kt +++ b/compiler/testData/codegen/box/controlStructures/kt2291.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { 1 in 1.rangeTo(10) 1..10 diff --git a/compiler/testData/codegen/box/controlStructures/kt2416.kt b/compiler/testData/codegen/box/controlStructures/kt2416.kt index 34501ee4fa5..f1442680ff5 100644 --- a/compiler/testData/codegen/box/controlStructures/kt2416.kt +++ b/compiler/testData/codegen/box/controlStructures/kt2416.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { 9 in 0..9 val intRange = 0..9 diff --git a/compiler/testData/codegen/box/primitiveTypes/rangeTo.kt b/compiler/testData/codegen/box/primitiveTypes/rangeTo.kt index ea05279b49d..7d55b63daf9 100644 --- a/compiler/testData/codegen/box/primitiveTypes/rangeTo.kt +++ b/compiler/testData/codegen/box/primitiveTypes/rangeTo.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { val b: Byte = 42 val c: Char = 'z' diff --git a/compiler/testData/codegen/box/ranges/contains/generated/charRangeLiteral.kt b/compiler/testData/codegen/box/ranges/contains/generated/charRangeLiteral.kt index ae3a47e8184..ba93f6b044d 100644 --- a/compiler/testData/codegen/box/ranges/contains/generated/charRangeLiteral.kt +++ b/compiler/testData/codegen/box/ranges/contains/generated/charRangeLiteral.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // Auto-generated by GenerateInRangeExpressionTestData. Do not edit! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/contains/generated/charUntil.kt b/compiler/testData/codegen/box/ranges/contains/generated/charUntil.kt index 1e69eda610c..380a63eee82 100644 --- a/compiler/testData/codegen/box/ranges/contains/generated/charUntil.kt +++ b/compiler/testData/codegen/box/ranges/contains/generated/charUntil.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // Auto-generated by GenerateInRangeExpressionTestData. Do not edit! // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/contains/genericCharInRangeLiteral.kt b/compiler/testData/codegen/box/ranges/contains/genericCharInRangeLiteral.kt index 8e8b414bdf2..810ed639224 100644 --- a/compiler/testData/codegen/box/ranges/contains/genericCharInRangeLiteral.kt +++ b/compiler/testData/codegen/box/ranges/contains/genericCharInRangeLiteral.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR class Cell(val value: T) fun box(): String = diff --git a/compiler/testData/codegen/box/ranges/expression/maxValueToMaxValue.kt b/compiler/testData/codegen/box/ranges/expression/maxValueToMaxValue.kt index ab2399d4baf..a3bb6020037 100644 --- a/compiler/testData/codegen/box/ranges/expression/maxValueToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/maxValueToMaxValue.kt @@ -1,5 +1,4 @@ // TODO: muted automatically, investigate should it be ran for JS_IR or not -// IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JVM_IR or not // IGNORE_BACKEND: JVM_IR diff --git a/compiler/testData/codegen/box/ranges/expression/maxValueToMinValue.kt b/compiler/testData/codegen/box/ranges/expression/maxValueToMinValue.kt index 7c24d7b28a3..8847c6cc0e5 100644 --- a/compiler/testData/codegen/box/ranges/expression/maxValueToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/maxValueToMinValue.kt @@ -1,5 +1,4 @@ // TODO: muted automatically, investigate should it be ran for JS_IR or not -// IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JVM_IR or not // IGNORE_BACKEND: JVM_IR diff --git a/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt b/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt index cf1fbd8ac51..dfb0160a940 100644 --- a/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt @@ -1,5 +1,4 @@ // TODO: muted automatically, investigate should it be ran for JS_IR or not -// IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JVM_IR or not // IGNORE_BACKEND: JVM_IR diff --git a/compiler/testData/codegen/box/ranges/forInReversed/ForInReversedReversedRange.kt b/compiler/testData/codegen/box/ranges/forInReversed/ForInReversedReversedRange.kt index def69718f78..5e510e8cf4f 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/ForInReversedReversedRange.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/ForInReversedReversedRange.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRange.kt b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRange.kt index f60b11b0062..9b4c6037406 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRange.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRange.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRangeLiteral.kt b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRangeLiteral.kt index 69dabb410ba..683b9365d58 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRangeLiteral.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRangeLiteral.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME fun box(): String { diff --git a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRangeLiteralWithNonConstBounds.kt b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRangeLiteralWithNonConstBounds.kt index a51aadcf105..32d61af04a3 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRangeLiteralWithNonConstBounds.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedEmptyRangeLiteralWithNonConstBounds.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRange.kt b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRange.kt index ca19f07ef84..d30a9d1e57d 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRange.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRange.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRangeLiteral.kt b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRangeLiteral.kt index 3513b53f4d3..8a9e9f43cab 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRangeLiteral.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRangeLiteral.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRangeLiteralWithNonConstBounds.kt b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRangeLiteralWithNonConstBounds.kt index e3c3d179593..0d85baba426 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRangeLiteralWithNonConstBounds.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedRangeLiteralWithNonConstBounds.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedReversedReversedRange.kt b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedReversedReversedRange.kt index 7b89c4071b0..6e1e54d7e98 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedReversedReversedRange.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedReversedReversedRange.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntil.kt b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntil.kt index c7573ce4100..41c5873f042 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntil.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntil.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntilWithNonConstBounds.kt b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntilWithNonConstBounds.kt index 4ac53855ae9..a4643d04666 100644 --- a/compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntilWithNonConstBounds.kt +++ b/compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntilWithNonConstBounds.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar.kt b/compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar.kt index d0e2a3205a3..9ee13af7b5a 100644 --- a/compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar.kt +++ b/compiler/testData/codegen/box/ranges/forInUntil/forInUntilChar.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/ranges/forWithPossibleOverflow/forInRangeToCharMaxValue.kt b/compiler/testData/codegen/box/ranges/forWithPossibleOverflow/forInRangeToCharMaxValue.kt index c9b648ad317..db5ce2d2c49 100644 --- a/compiler/testData/codegen/box/ranges/forWithPossibleOverflow/forInRangeToCharMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/forWithPossibleOverflow/forInRangeToCharMaxValue.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JVM_IR const val M = Char.MAX_VALUE diff --git a/compiler/testData/codegen/box/ranges/forWithPossibleOverflow/forInRangeToCharMaxValueReversed.kt b/compiler/testData/codegen/box/ranges/forWithPossibleOverflow/forInRangeToCharMaxValueReversed.kt index 5fda7b8897e..7b2a006f537 100644 --- a/compiler/testData/codegen/box/ranges/forWithPossibleOverflow/forInRangeToCharMaxValueReversed.kt +++ b/compiler/testData/codegen/box/ranges/forWithPossibleOverflow/forInRangeToCharMaxValueReversed.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JVM_IR // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ranges/literal/maxValueToMaxValue.kt b/compiler/testData/codegen/box/ranges/literal/maxValueToMaxValue.kt index 580013f5d58..3952bef6a75 100644 --- a/compiler/testData/codegen/box/ranges/literal/maxValueToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/maxValueToMaxValue.kt @@ -1,5 +1,4 @@ // TODO: muted automatically, investigate should it be ran for JS_IR or not -// IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JVM_IR or not // IGNORE_BACKEND: JVM_IR diff --git a/compiler/testData/codegen/box/ranges/literal/maxValueToMinValue.kt b/compiler/testData/codegen/box/ranges/literal/maxValueToMinValue.kt index 1c9eb1e3f99..007826dffee 100644 --- a/compiler/testData/codegen/box/ranges/literal/maxValueToMinValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/maxValueToMinValue.kt @@ -1,5 +1,4 @@ // TODO: muted automatically, investigate should it be ran for JS_IR or not -// IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JVM_IR or not // IGNORE_BACKEND: JVM_IR diff --git a/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt b/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt index f0d293e2303..e3a42220969 100644 --- a/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt +++ b/compiler/testData/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt @@ -1,5 +1,4 @@ // TODO: muted automatically, investigate should it be ran for JS_IR or not -// IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JVM_IR or not // IGNORE_BACKEND: JVM_IR diff --git a/compiler/testData/codegen/box/when/switchOptimizationTypes.kt b/compiler/testData/codegen/box/when/switchOptimizationTypes.kt index ebde485a14b..152de056680 100644 --- a/compiler/testData/codegen/box/when/switchOptimizationTypes.kt +++ b/compiler/testData/codegen/box/when/switchOptimizationTypes.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME // CHECK_CASES_COUNT: function=intFoo count=3 // CHECK_IF_COUNT: function=intFoo count=0 diff --git a/js/js.translator/testData/box/char/charRanges.kt b/js/js.translator/testData/box/char/charRanges.kt index 75e70d7010c..5de8eff0088 100644 --- a/js/js.translator/testData/box/char/charRanges.kt +++ b/js/js.translator/testData/box/char/charRanges.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1333 package foo diff --git a/js/js.translator/testData/box/expression/when/whenWithCharRangeClause.kt b/js/js.translator/testData/box/expression/when/whenWithCharRangeClause.kt index 2d45bb53e04..47f788df525 100644 --- a/js/js.translator/testData/box/expression/when/whenWithCharRangeClause.kt +++ b/js/js.translator/testData/box/expression/when/whenWithCharRangeClause.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1332 // see KT-7683 // WhenTranslator must recognize KtWhenConditionInRange diff --git a/js/js.translator/testData/box/range/rangeEquals.kt b/js/js.translator/testData/box/range/rangeEquals.kt index 7575f59635c..d9e44dfd26e 100644 --- a/js/js.translator/testData/box/range/rangeEquals.kt +++ b/js/js.translator/testData/box/range/rangeEquals.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1281 package foo diff --git a/libraries/stdlib/js/irRuntime/char.kt b/libraries/stdlib/js/irRuntime/char.kt index 999fbdf8e54..63cbe7b5e13 100644 --- a/libraries/stdlib/js/irRuntime/char.kt +++ b/libraries/stdlib/js/irRuntime/char.kt @@ -34,7 +34,7 @@ public class Char(value: Int) : Comparable { public operator fun dec(): Char = Char(value - 1) /** Creates a range from this value to the specified [other] value. */ - public operator fun rangeTo(other: Char): CharRange = null!! // TODO + public operator fun rangeTo(other: Char): CharRange = CharRange(this, other) /** Returns the value of this character as a `Byte`. */ public fun toByte(): Byte = value.toByte()