Capitalize/decapitalize only ASCII characters across project
Use {de,}capitalizeAsciiOnly and to{Lower,Upper}CaseAsciiOnly where
possible, and stdlib's functions with Locale.US everywhere else.
Otherwise, if the default system locale is Turkish, the capital latin
letter "I" is transformed in toLowerCase to "ı" (see
https://github.com/JetBrains/kotlin/blob/66bc142f92085047a1ca64f9a291f0496e33dd98/libraries/stdlib/jvm/test/text/StringJVMTest.kt#L119),
which for example breaks the codegen for `intArrayOf` in
KT-25400/KT-43405.
Similarly, lower case latin letter "i" is transformed to "İ".
#KT-13631 Fixed
#KT-25400 Fixed
#KT-43405 Fixed
This commit is contained in:
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.kotlinp
|
||||
|
||||
import kotlinx.metadata.*
|
||||
import kotlinx.metadata.jvm.*
|
||||
import java.util.*
|
||||
|
||||
private object SpecialCharacters {
|
||||
const val TYPE_ALIAS_MARKER = '^'
|
||||
@@ -309,7 +310,7 @@ private fun printType(flags: Flags, output: (String) -> Unit): KmTypeVisitor =
|
||||
printType(flags) { argumentTypeString ->
|
||||
arguments += buildString {
|
||||
if (variance != KmVariance.INVARIANT) {
|
||||
append(variance.name.toLowerCase()).append(" ")
|
||||
append(variance.name.toLowerCase(Locale.US)).append(" ")
|
||||
}
|
||||
append(argumentTypeString)
|
||||
}
|
||||
@@ -399,7 +400,7 @@ private fun printTypeParameter(
|
||||
append("@").append(renderAnnotation(annotation)).append(" ")
|
||||
}
|
||||
if (variance != KmVariance.INVARIANT) {
|
||||
append(variance.name.toLowerCase()).append(" ")
|
||||
append(variance.name.toLowerCase(Locale.US)).append(" ")
|
||||
}
|
||||
append("T#$id")
|
||||
if (settings.isVerbose) {
|
||||
|
||||
Reference in New Issue
Block a user