[stdlib-js-ir] Add equals, hashCode, toString to some builtins

Namely:
* Throwable;
* primitive numbers except Long (which implemented in Kotlin).
This commit is contained in:
Zalim Bashorov
2019-11-28 18:51:41 +03:00
parent 97e86fb2ce
commit adfb296e45
2 changed files with 32 additions and 7 deletions
@@ -218,6 +218,10 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
* The resulting `Double` value represents the same numerical value as this `Byte`.
*/
public override fun toDouble(): Double
public override fun equals(other: Any?): Boolean
public override fun hashCode(): Int
public override fun toString(): String
}
/**
@@ -428,6 +432,10 @@ public class Short private constructor() : Number(), Comparable<Short> {
* The resulting `Double` value represents the same numerical value as this `Short`.
*/
public override fun toDouble(): Double
public override fun equals(other: Any?): Boolean
public override fun hashCode(): Int
public override fun toString(): String
}
/**
@@ -657,6 +665,10 @@ public class Int private constructor() : Number(), Comparable<Int> {
* The resulting `Double` value represents the same numerical value as this `Int`.
*/
public override fun toDouble(): Double
public override fun equals(other: Any?): Boolean
public override fun hashCode(): Int
public override fun toString(): String
}
/**
@@ -863,6 +875,10 @@ public class Float private constructor() : Number(), Comparable<Float> {
* The resulting `Double` value represents the same numerical value as this `Float`.
*/
public override fun toDouble(): Double
public override fun equals(other: Any?): Boolean
public override fun hashCode(): Int
public override fun toString(): String
}
/**
@@ -1071,5 +1087,9 @@ public class Double private constructor() : Number(), Comparable<Double> {
public override fun toFloat(): Float
/** Returns this value. */
public override fun toDouble(): Double
public override fun equals(other: Any?): Boolean
public override fun hashCode(): Int
public override fun toString(): String
}
+12 -7
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -13,11 +13,16 @@ package kotlin
*/
@JsName("Error")
public external open class Throwable {
open val message: String?
open val cause: Throwable?
public open val message: String?
public open val cause: Throwable?
constructor(message: String?, cause: Throwable?)
constructor(message: String?)
constructor(cause: Throwable?)
constructor()
public constructor(message: String?, cause: Throwable?)
public constructor(message: String?)
public constructor(cause: Throwable?)
public constructor()
// TODO: add specialized version to runtime
// public override fun equals(other: Any?): Boolean
// public override fun hashCode(): Int
public override fun toString(): String
}