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:
@@ -5,6 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.js.config
|
||||
|
||||
import java.util.*
|
||||
|
||||
enum class ErrorTolerancePolicy(val allowSyntaxErrors: Boolean, val allowSemanticErrors: Boolean) {
|
||||
NONE(false, false),
|
||||
SEMANTIC(false, true),
|
||||
@@ -16,7 +18,7 @@ enum class ErrorTolerancePolicy(val allowSyntaxErrors: Boolean, val allowSemanti
|
||||
val DEFAULT = NONE
|
||||
|
||||
fun resolvePolicy(key: String): ErrorTolerancePolicy {
|
||||
return when (key.toUpperCase()) {
|
||||
return when (key.toUpperCase(Locale.US)) {
|
||||
"NONE" -> NONE
|
||||
"SEMANTIC" -> SEMANTIC
|
||||
"SYNTAX", "ALL" -> ALL
|
||||
@@ -24,4 +26,4 @@ enum class ErrorTolerancePolicy(val allowSyntaxErrors: Boolean, val allowSemanti
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user