[WIP] Remove hidden Primitive.equals(Primitive)
diff --git a/generators/builtins/primitives/CharGenerator.kt b/generators/builtins/primitives/CharGenerator.kt index 612b73b..0390cef 100644 --- a/generators/builtins/primitives/CharGenerator.kt +++ b/generators/builtins/primitives/CharGenerator.kt
@@ -729,29 +729,7 @@ modifySignature { isExternal = true } } - private fun ClassBuilder.generateCustomEquals() { - method { - annotations += "Deprecated(\"Provided for binary compatibility\", level = DeprecationLevel.HIDDEN)" - annotations += intrinsicConstEvaluationAnnotation - expectActual = ExpectActualModifier.Unspecified - signature { - methodName = "equals" - parameter { - name = "other" - type = PrimitiveType.CHAR.capitalized - } - returnType = PrimitiveType.BOOLEAN.capitalized - } - - "this == other".setAsExpressionBody() - } - } - override fun MethodBuilder.modifyGeneratedHashCode() { "return this.code".setAsBlockBody() } - - override fun ClassBuilder.generateAdditionalMethods() { - generateCustomEquals() - } }
diff --git a/generators/builtins/primitives/NativePrimitivesGenerator.kt b/generators/builtins/primitives/NativePrimitivesGenerator.kt index d2e2e64..44086e5 100644 --- a/generators/builtins/primitives/NativePrimitivesGenerator.kt +++ b/generators/builtins/primitives/NativePrimitivesGenerator.kt
@@ -172,34 +172,12 @@ } override fun ClassBuilder.generateAdditionalMethods(thisKind: PrimitiveType) { - generateCustomEquals(thisKind) generateHashCode(thisKind) if (thisKind in PrimitiveType.floatingPoint) { generateBits(thisKind) } } - private fun ClassBuilder.generateCustomEquals(thisKind: PrimitiveType) { - method { - annotations += "Deprecated(\"Provided for binary compatibility\", level = DeprecationLevel.HIDDEN)" - annotations += intrinsicConstEvaluationAnnotation - expectActual = ExpectActualModifier.Unspecified - signature { - methodName = "equals" - parameter { - name = "other" - type = thisKind.capitalized - } - returnType = PrimitiveType.BOOLEAN.capitalized - } - - when (thisKind) { - in PrimitiveType.floatingPoint -> "toBits() == other.toBits()".setAsExpressionBody() - else -> "kotlin.native.internal.areEqualByValue(this, other)".setAsExpressionBody() - } - } - } - private fun ClassBuilder.generateBits(thisKind: PrimitiveType) { method { expectActual = ExpectActualModifier.Unspecified @@ -236,4 +214,4 @@ modifySignature { isExternal = true } } } -} \ No newline at end of file +}
diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Char.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Char.kt index 69b509a..a8ef820 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Char.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Char.kt
@@ -133,11 +133,6 @@ return this.code } - @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) - @kotlin.internal.IntrinsicConstEvaluation - public fun equals(other: Char): Boolean = - this == other - @kotlin.native.internal.CanBePrecreated public actual companion object { /**
diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt index 401bf23..fab4704 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt
@@ -438,11 +438,6 @@ public actual override fun equals(other: Any?): Boolean = other is Byte && kotlin.native.internal.areEqualByValue(this, other) - @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) - @kotlin.internal.IntrinsicConstEvaluation - public fun equals(other: Byte): Boolean = - kotlin.native.internal.areEqualByValue(this, other) - public actual override fun hashCode(): Int = this.toInt() } @@ -870,11 +865,6 @@ public actual override fun equals(other: Any?): Boolean = other is Short && kotlin.native.internal.areEqualByValue(this, other) - @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) - @kotlin.internal.IntrinsicConstEvaluation - public fun equals(other: Short): Boolean = - kotlin.native.internal.areEqualByValue(this, other) - public actual override fun hashCode(): Int = this.toInt() } @@ -1355,11 +1345,6 @@ public actual override fun equals(other: Any?): Boolean = other is Int && kotlin.native.internal.areEqualByValue(this, other) - @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) - @kotlin.internal.IntrinsicConstEvaluation - public fun equals(other: Int): Boolean = - kotlin.native.internal.areEqualByValue(this, other) - public actual override fun hashCode(): Int = this } @@ -1843,11 +1828,6 @@ public actual override fun equals(other: Any?): Boolean = other is Long && kotlin.native.internal.areEqualByValue(this, other) - @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) - @kotlin.internal.IntrinsicConstEvaluation - public fun equals(other: Long): Boolean = - kotlin.native.internal.areEqualByValue(this, other) - public actual override fun hashCode(): Int = ((this ushr 32) xor this).toInt() } @@ -2250,11 +2230,6 @@ public actual override fun equals(other: Any?): Boolean = other is Float && toBits() == other.toBits() - @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) - @kotlin.internal.IntrinsicConstEvaluation - public fun equals(other: Float): Boolean = - toBits() == other.toBits() - public actual override fun hashCode(): Int = toBits() @@ -2663,11 +2638,6 @@ public actual override fun equals(other: Any?): Boolean = other is Double && toBits() == other.toBits() - @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) - @kotlin.internal.IntrinsicConstEvaluation - public fun equals(other: Double): Boolean = - toBits() == other.toBits() - public actual override fun hashCode(): Int = toBits().hashCode()