From e7f9727783b4056f74f5ebe52c2bfbf47f545677 Mon Sep 17 00:00:00 2001 From: Anton Bannykh Date: Thu, 30 Aug 2018 18:28:50 +0300 Subject: [PATCH] JS: fix tests related to 1.3 migration --- .../box/ranges/forInDownTo/forIntInDownTo.kt | 1 - .../forEachIndexedInListOfUInts.kt | 2 +- ...ignedTypePrefixIncrementDecrementBoxing.kt | 36 +++++++++---------- libraries/stdlib/js/irRuntime/char.kt | 12 +++++++ 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/compiler/testData/codegen/box/ranges/forInDownTo/forIntInDownTo.kt b/compiler/testData/codegen/box/ranges/forInDownTo/forIntInDownTo.kt index 299f8601187..fd046640e37 100644 --- a/compiler/testData/codegen/box/ranges/forInDownTo/forIntInDownTo.kt +++ b/compiler/testData/codegen/box/ranges/forInDownTo/forIntInDownTo.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // WITH_RUNTIME import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/unsignedTypes/forEachIndexedInListOfUInts.kt b/compiler/testData/codegen/box/unsignedTypes/forEachIndexedInListOfUInts.kt index fc71516c5a7..1c10448a212 100644 --- a/compiler/testData/codegen/box/unsignedTypes/forEachIndexedInListOfUInts.kt +++ b/compiler/testData/codegen/box/unsignedTypes/forEachIndexedInListOfUInts.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JVM_IR, JS, JS_IR +// IGNORE_BACKEND: JVM_IR, JS_IR // WITH_UNSIGNED fun box(): String { diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedTypePrefixIncrementDecrementBoxing.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedTypePrefixIncrementDecrementBoxing.kt index b4279b0d2b5..d5b30db8f91 100644 --- a/compiler/testData/codegen/box/unsignedTypes/unsignedTypePrefixIncrementDecrementBoxing.kt +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedTypePrefixIncrementDecrementBoxing.kt @@ -1,5 +1,5 @@ // WITH_UNSIGNED -// IGNORE_BACKEND: JS_IR, JVM_IR, JS +// IGNORE_BACKEND: JS_IR, JVM_IR fun prefixDecrementUByteLocal(): Any? { var a: UByte = 0u @@ -89,29 +89,29 @@ fun prefixIncrementULongProperty(): Any? { fun check(u: Any?, ts: String, className: String) { u!! if (u.toString() != ts) throw AssertionError(u.toString()) - if (u.javaClass.name != className) throw AssertionError(u.javaClass.name) + if (u::class.simpleName != className) throw AssertionError(u::class.simpleName) } fun box(): String { - check(prefixDecrementUByteLocal(), 0xFFu.toString(), "kotlin.UByte") - check(prefixDecrementUShortLocal(), 0xFFFFu.toString(), "kotlin.UShort") - check(prefixDecrementUIntLocal(), 0xFFFF_FFFFu.toString(), "kotlin.UInt") - check(prefixDecrementULongLocal(), 0xFFFF_FFFF_FFFF_FFFFUL.toString(), "kotlin.ULong") + check(prefixDecrementUByteLocal(), 0xFFu.toString(), "UByte") + check(prefixDecrementUShortLocal(), 0xFFFFu.toString(), "UShort") + check(prefixDecrementUIntLocal(), 0xFFFF_FFFFu.toString(), "UInt") + check(prefixDecrementULongLocal(), 0xFFFF_FFFF_FFFF_FFFFUL.toString(), "ULong") - check(prefixIncrementUByteLocal(), "1", "kotlin.UByte") - check(prefixIncrementUShortLocal(), "1", "kotlin.UShort") - check(prefixIncrementUIntLocal(), "1", "kotlin.UInt") - check(prefixIncrementULongLocal(), "1", "kotlin.ULong") + check(prefixIncrementUByteLocal(), "1", "UByte") + check(prefixIncrementUShortLocal(), "1", "UShort") + check(prefixIncrementUIntLocal(), "1", "UInt") + check(prefixIncrementULongLocal(), "1", "ULong") - check(prefixDecrementUByteProperty(), 0xFFu.toString(), "kotlin.UByte") - check(prefixDecrementUShortProperty(), 0xFFFFu.toString(), "kotlin.UShort") - check(prefixDecrementUIntProperty(), 0xFFFF_FFFFu.toString(), "kotlin.UInt") - check(prefixDecrementULongProperty(), 0xFFFF_FFFF_FFFF_FFFFUL.toString(), "kotlin.ULong") + check(prefixDecrementUByteProperty(), 0xFFu.toString(), "UByte") + check(prefixDecrementUShortProperty(), 0xFFFFu.toString(), "UShort") + check(prefixDecrementUIntProperty(), 0xFFFF_FFFFu.toString(), "UInt") + check(prefixDecrementULongProperty(), 0xFFFF_FFFF_FFFF_FFFFUL.toString(), "ULong") - check(prefixIncrementUByteProperty(), "1", "kotlin.UByte") - check(prefixIncrementUShortProperty(), "1", "kotlin.UShort") - check(prefixIncrementUIntProperty(), "1", "kotlin.UInt") - check(prefixIncrementULongProperty(), "1", "kotlin.ULong") + check(prefixIncrementUByteProperty(), "1", "UByte") + check(prefixIncrementUShortProperty(), "1", "UShort") + check(prefixIncrementUIntProperty(), "1", "UInt") + check(prefixIncrementULongProperty(), "1", "ULong") return "OK" } \ No newline at end of file diff --git a/libraries/stdlib/js/irRuntime/char.kt b/libraries/stdlib/js/irRuntime/char.kt index 0e0f6c428a8..999fbdf8e54 100644 --- a/libraries/stdlib/js/irRuntime/char.kt +++ b/libraries/stdlib/js/irRuntime/char.kt @@ -61,6 +61,18 @@ public class Char(value: Int) : Comparable { } companion object { + /** + * The minimum value of a character code unit. + */ + @SinceKotlin("1.3") + public const val MIN_VALUE: Char = '\u0000' + + /** + * The maximum value of a character code unit. + */ + @SinceKotlin("1.3") + public const val MAX_VALUE: Char = '\uFFFF' + /** * The minimum value of a Unicode high-surrogate code unit. */