Deprecate Char-to-Number conversions in stdlib (JVM and JS)

- Int.toChar was left non-deprecated because the replacement is not intrinsic yet.
- Number.toChar was left non-deprecated because otherwise the deprecation propagates to the override, Int.toChar.

KT-23451
This commit is contained in:
Ilya Gorbunov
2021-04-06 15:36:44 +03:00
parent b976cd812a
commit b64b96eee6
59 changed files with 273 additions and 169 deletions
+1 -1
View File
@@ -205,7 +205,7 @@ class CharTest {
@Test
fun charCategory() {
for ((char, categoryCode) in charToCategory()) {
assertEquals(categoryCode, char.category.code, "char code: ${char.toInt().toString(radix = 16)}")
assertEquals(categoryCode, char.category.code, "char code: ${char.code.toString(radix = 16)}")
}
}
@@ -47,7 +47,7 @@ class StringEncodingTest {
// https://youtrack.jetbrains.com/issue/KT-31614
private fun string(vararg codeUnits: Int): String {
return buildString { codeUnits.forEach { append(it.toChar()) } }
return buildString { codeUnits.forEach { append(Char(it)) } }
}
@Test