mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
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
66bc142f92/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:
@@ -5,6 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.konan.target
|
||||
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Name of a preset used in the 'kotlin-multiplatform' Gradle plugin to represent this target.
|
||||
*/
|
||||
@@ -19,5 +21,5 @@ val KonanTarget.presetName: String
|
||||
|
||||
private fun evaluatePresetName(targetName: String): String {
|
||||
val nameParts = targetName.split('_').mapNotNull { it.takeIf(String::isNotEmpty) }
|
||||
return nameParts.asSequence().drop(1).joinToString("", nameParts.firstOrNull().orEmpty(), transform = String::capitalize)
|
||||
return nameParts.asSequence().drop(1).joinToString("", nameParts.firstOrNull().orEmpty()) { it.capitalize(Locale.US) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user