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:
Abduqodiri Qurbonzoda
2023-06-12 17:40:09 +03:00
committed by Space Team
parent 668157eb41
commit 193aa0f935
9 changed files with 23 additions and 14 deletions
@@ -146,6 +146,7 @@ class JsIntrinsics(private val irBuiltIns: IrBuiltIns, val context: JsIrBackendC
val jsCode = getInternalFunction("js") // js("<code>")
val jsHashCode = getInternalFunction("hashCode")
val jsGetBooleanHashCode = getInternalFunction("getBooleanHashCode")
val jsGetNumberHashCode = getInternalFunction("getNumberHashCode")
val jsGetObjectHashCode = getInternalFunction("getObjectHashCode")
val jsGetStringHashCode = getInternalFunction("getStringHashCode")
@@ -57,7 +57,7 @@ class NumberOperatorCallsTransformer(context: JsIrBackendContext) : CallsTransfo
add(it, OperatorNames.NOT, intrinsics.jsNot)
add(it, HASH_CODE_NAME) { call -> toInt32(call.dispatchReceiver!!) }
add(it, HASH_CODE_NAME, intrinsics.jsGetBooleanHashCode)
}
for (type in primitiveNumbers) {