[stdlib-js-ir] Char shouldn't be a data class

This commit is contained in:
Zalim Bashorov
2020-01-21 15:51:48 +03:00
parent 7c874ccf0c
commit 97e86fb2ce
+10 -1
View File
@@ -12,7 +12,7 @@ package kotlin
// TODO: KT-35100
//@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
//public inline class Char internal constructor (val value: Int) : Comparable<Char> {
public data class Char internal constructor(val value: Int) : Comparable<Char> {
public class Char internal constructor(val value: Int) : Comparable<Char> {
/**
* Compares this value with the specified value for order.
@@ -52,6 +52,15 @@ public data class Char internal constructor(val value: Int) : Comparable<Char> {
/** Returns the value of this character as a `Double`. */
public fun toDouble(): Double = value.toDouble()
override fun equals(other: Any?): Boolean {
if (other === this) return true
if (other !is Char) return false
return this.value == other.value
}
override fun hashCode(): Int = value
// TODO implicit usages of toString and valueOf must be covered in DCE
@Suppress("JS_NAME_PROHIBITED_FOR_OVERRIDE")
@JsName("toString")