Align the Boolean.hashCode() value across platforms
Boolean.hashCode() should return 1231/1237 for true/false correspondingly. As a part of efforts to stabilize Native stdlib.
This commit is contained in:
committed by
Space Team
parent
668157eb41
commit
193aa0f935
@@ -58,7 +58,7 @@ public class Boolean private constructor(private val value: Boolean) : Comparabl
|
||||
if (this) "true" else "false"
|
||||
|
||||
override fun hashCode(): Int =
|
||||
toInt()
|
||||
if (this) 1231 else 1237
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
||||
@@ -79,7 +79,7 @@ return (obj) => {
|
||||
case "number":
|
||||
return numberHashCode(obj);
|
||||
case "boolean":
|
||||
return obj;
|
||||
return obj ? 1231 : 1237;
|
||||
default:
|
||||
return getStringHashCode(String(obj));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user