Migrate compiler, idea and others to new case conversion api
This commit is contained in:
+2
-2
@@ -262,7 +262,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
|
||||
private fun getFlavorUnitTestFolder(flavourName: String): String {
|
||||
return pathManager.srcFolderInAndroidTmpFolder +
|
||||
"/androidTest${flavourName.capitalize()}/java/" +
|
||||
"/androidTest${flavourName.replaceFirstChar(Char::uppercaseChar)}/java/" +
|
||||
testClassPackage.replace(".", "/") + "/"
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
configure(backend)
|
||||
testInfo = KotlinTestInfo(
|
||||
"org.jetbrains.kotlin.android.tests.AndroidRunner",
|
||||
"test${testDataFile.nameWithoutExtension.capitalize()}",
|
||||
"test${testDataFile.nameWithoutExtension.replaceFirstChar(Char::uppercaseChar)}",
|
||||
emptySet()
|
||||
)
|
||||
}.build(testDataFile.path)
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ class UnitTestFileWriter(
|
||||
}
|
||||
|
||||
fun generate() {
|
||||
FileWriter(File(flavourFolder, flavourName.capitalize() + ".java").also { it.parentFile.mkdirs() }).use { suite ->
|
||||
FileWriter(File(flavourFolder, flavourName.replaceFirstChar(Char::uppercaseChar) + ".java").also { it.parentFile.mkdirs() }).use { suite ->
|
||||
val p = Printer(suite)
|
||||
p.println(
|
||||
"""package ${CodegenTestsOnAndroidGenerator.testClassPackage};
|
||||
@@ -35,7 +35,7 @@ class UnitTestFileWriter(
|
||||
|import ${CodegenTestsOnAndroidGenerator.baseTestClassPackage}.${CodegenTestsOnAndroidGenerator.baseTestClassName};
|
||||
|
|
||||
|/* This class is generated by ${CodegenTestsOnAndroidGenerator.generatorName}. DO NOT MODIFY MANUALLY */
|
||||
|public class ${flavourName.capitalize()} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
||||
|public class ${flavourName.replaceFirstChar(Char::uppercaseChar)} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
||||
|
|
||||
""".trimMargin()
|
||||
)
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ object ChangeBoxingMethodTransformer : MethodTransformer() {
|
||||
val map = hashMapOf<String, String>()
|
||||
for (primitiveType in JvmPrimitiveType.values()) {
|
||||
val name = primitiveType.wrapperFqName.topLevelClassInternalName()
|
||||
map[name] = "box${primitiveType.javaKeywordName.capitalize(Locale.US)}"
|
||||
map[name] = "box${primitiveType.javaKeywordName.replaceFirstChar(Char::uppercaseChar)}"
|
||||
}
|
||||
wrapperToInternalBoxing = map
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ enum class CompilerSystemProperties(val property: String) {
|
||||
}
|
||||
|
||||
val isWindows: Boolean
|
||||
get() = CompilerSystemProperties.OS_NAME.value!!.toLowerCase(Locale.ENGLISH).startsWith("windows")
|
||||
get() = CompilerSystemProperties.OS_NAME.value!!.lowercase().startsWith("windows")
|
||||
|
||||
fun String?.toBooleanLenient(): Boolean? = when (this?.toLowerCase()) {
|
||||
fun String?.toBooleanLenient(): Boolean? = when (this?.lowercase()) {
|
||||
null -> false
|
||||
in listOf("", "yes", "true", "on", "y") -> true
|
||||
in listOf("no", "false", "off", "n") -> false
|
||||
|
||||
@@ -432,7 +432,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
fun DceRuntimeDiagnostic.Companion.resolve(
|
||||
value: String?,
|
||||
messageCollector: MessageCollector
|
||||
): DceRuntimeDiagnostic? = when (value?.toLowerCase()) {
|
||||
): DceRuntimeDiagnostic? = when (value?.lowercase()) {
|
||||
DCE_RUNTIME_DIAGNOSTIC_LOG -> DceRuntimeDiagnostic.LOG
|
||||
DCE_RUNTIME_DIAGNOSTIC_EXCEPTION -> DceRuntimeDiagnostic.EXCEPTION
|
||||
null -> null
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ object CompilerOutputParser {
|
||||
// We're directly inside the root tag: <MESSAGES>
|
||||
return
|
||||
}
|
||||
val qNameLowerCase = qName.toLowerCase(Locale.US)
|
||||
val qNameLowerCase = qName.lowercase()
|
||||
var category: CompilerMessageSeverity? = CATEGORIES[qNameLowerCase]
|
||||
if (category == null) {
|
||||
messageCollector.report(ERROR, "Unknown compiler message tag: $qName")
|
||||
|
||||
@@ -107,7 +107,7 @@ private inline fun tryConnectToDaemon(port: Int, report: (DaemonReportCategory,
|
||||
private const val validFlagFileKeywordChars = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
|
||||
fun makeAutodeletingFlagFile(keyword: String = "compiler-client", baseDir: File? = null): File {
|
||||
val prefix = "kotlin-${keyword.filter { validFlagFileKeywordChars.contains(it.toLowerCase()) }}-"
|
||||
val prefix = "kotlin-${keyword.filter { validFlagFileKeywordChars.contains(it.lowercaseChar()) }}-"
|
||||
val flagFile = if (baseDir?.isDirectory == true)
|
||||
Files.createTempFile(baseDir.toPath(), prefix, "-is-running").toFile()
|
||||
else
|
||||
|
||||
+1
-1
@@ -352,7 +352,7 @@ private val humanizedMemorySizeRegex = "(\\d+)([kmg]?)".toRegex()
|
||||
|
||||
private fun String.memToBytes(): Long? =
|
||||
humanizedMemorySizeRegex
|
||||
.matchEntire(this.trim().toLowerCase())
|
||||
.matchEntire(this.trim().lowercase())
|
||||
?.groups?.let { match ->
|
||||
match[1]?.value?.let {
|
||||
it.toLong() *
|
||||
|
||||
@@ -114,7 +114,7 @@ class LazyClasspathWatcher(classpath: Iterable<String>,
|
||||
}
|
||||
|
||||
|
||||
fun isClasspathFile(file: File): Boolean = file.isFile && listOf("class", "jar").contains(file.extension.toLowerCase())
|
||||
fun isClasspathFile(file: File): Boolean = file.isFile && listOf("class", "jar").contains(file.extension.lowercase())
|
||||
|
||||
fun File.md5Digest(): ByteArray {
|
||||
val md = MessageDigest.getInstance(CLASSPATH_FILE_ID_DIGEST)
|
||||
|
||||
+2
-2
@@ -160,10 +160,10 @@ class Generator(
|
||||
get() = "val $fieldName: $setType"
|
||||
|
||||
private val Alias.fieldName: String
|
||||
get() = removePrefix("Fir").decapitalize() + "s"
|
||||
get() = removePrefix("Fir").replaceFirstChar(Char::lowercaseChar) + "s"
|
||||
|
||||
private val Alias.allFieldName: String
|
||||
get() = "all${fieldName.capitalize()}"
|
||||
get() = "all${fieldName.replaceFirstChar(Char::uppercaseChar)}"
|
||||
|
||||
private val Alias.setType: String
|
||||
get() = "Set<$this>"
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ object ErrorListDiagnosticListRenderer : DiagnosticListRenderer() {
|
||||
get() = classifier as KClass<*>
|
||||
|
||||
private fun DiagnosticData.getFactoryFunction(): String =
|
||||
severity.name.toLowerCase() + parameters.size
|
||||
severity.name.lowercase() + parameters.size
|
||||
}
|
||||
|
||||
private inline fun <T> SmartPrinter.printSeparatedWithComma(list: List<T>, printItem: (T) -> Unit) {
|
||||
|
||||
@@ -520,7 +520,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
||||
|
||||
private fun FlowContent.modality(modality: Modality?) {
|
||||
if (modality == null) return
|
||||
keyword(modality.name.toLowerCase())
|
||||
keyword(modality.name.lowercase())
|
||||
}
|
||||
|
||||
private fun FlowContent.visibility(visibility: Visibility) {
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class Modifier(
|
||||
parameterModifiers += ParameterModifier.CONST
|
||||
return
|
||||
}
|
||||
val upperCasedModifier = modifier.toString().toUpperCase()
|
||||
val upperCasedModifier = modifier.toString().uppercase()
|
||||
when {
|
||||
INLINE_MODIFIER.contains(tokenType) -> {
|
||||
if (isInClass)
|
||||
|
||||
+2
-2
@@ -20,9 +20,9 @@ class TypeParameterModifier(
|
||||
fun addModifier(modifier: LighterASTNode) {
|
||||
val tokenType = modifier.tokenType
|
||||
when {
|
||||
VARIANCE_MODIFIER.contains(tokenType) -> this.varianceModifiers += VarianceModifier.valueOf(modifier.toString().toUpperCase())
|
||||
VARIANCE_MODIFIER.contains(tokenType) -> this.varianceModifiers += VarianceModifier.valueOf(modifier.toString().uppercase())
|
||||
REIFICATION_MODIFIER.contains(tokenType) -> this.reificationModifier =
|
||||
ReificationModifier.valueOf(modifier.toString().toUpperCase())
|
||||
ReificationModifier.valueOf(modifier.toString().uppercase())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class TypeProjectionModifier(
|
||||
fun addModifier(modifier: LighterASTNode) {
|
||||
val tokenType = modifier.tokenType
|
||||
when {
|
||||
VARIANCE_MODIFIER.contains(tokenType) -> this.varianceModifiers += VarianceModifier.valueOf(modifier.toString().toUpperCase())
|
||||
VARIANCE_MODIFIER.contains(tokenType) -> this.varianceModifiers += VarianceModifier.valueOf(modifier.toString().uppercase())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ class TotalKotlinTest : AbstractRawFirBuilderTestCase() {
|
||||
if (file.isDirectory) continue
|
||||
/* TODO: fix this, please !!! */
|
||||
if (file.path.contains("kotlin-native") ||
|
||||
file.path.toLowerCase().contains("testdata") ||
|
||||
file.path.lowercase().contains("testdata") ||
|
||||
file.path.contains("resources")
|
||||
) continue
|
||||
if (file.extension != "kt") continue
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
println("BASE PATH: $testDataPath")
|
||||
for (file in root.walkTopDown()) {
|
||||
if (file.isDirectory) continue
|
||||
val path = file.path.toLowerCase()
|
||||
val path = file.path.lowercase()
|
||||
if ("testdata" in path ||
|
||||
"kotlin-native" in path ||
|
||||
"resources" in path ||
|
||||
@@ -180,7 +180,7 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
val root = File(testDataPath)
|
||||
for (file in root.walkTopDown()) {
|
||||
if (file.isDirectory) continue
|
||||
val path = file.path.toLowerCase()
|
||||
val path = file.path.lowercase()
|
||||
if ("kotlin-native" in path ||
|
||||
"testdata" in path ||
|
||||
"resources" in path ||
|
||||
@@ -211,7 +211,7 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
var counter = 0
|
||||
for (file in root.walkTopDown()) {
|
||||
if (file.isDirectory) continue
|
||||
val path = file.path.toLowerCase()
|
||||
val path = file.path.lowercase()
|
||||
if ("kotlin-native" in path ||
|
||||
"testdata" in path ||
|
||||
"resources" in path ||
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ abstract class AbstractBuilderConfigurator<T : AbstractFirTreeBuilder>(val firTr
|
||||
thisRef: Nothing?,
|
||||
prop: KProperty<*>
|
||||
): ReadOnlyProperty<Nothing?, IntermediateBuilder> {
|
||||
val name = name ?: "Fir${prop.name.capitalize()}"
|
||||
val name = name ?: "Fir${prop.name.replaceFirstChar(Char::uppercaseChar)}"
|
||||
builder = IntermediateBuilder(name).apply {
|
||||
firTreeBuilder.intermediateBuilders += this
|
||||
IntermediateBuilderConfigurationContext(this).block()
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ abstract class AbstractFieldConfigurator<T : AbstractFirTreeBuilder>(private val
|
||||
|
||||
fun generateBooleanFields(vararg names: String) {
|
||||
names.forEach {
|
||||
+booleanField("is${it.capitalize()}")
|
||||
+booleanField("is${it.replaceFirstChar(Char::uppercaseChar)}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ fun field(name: String, typeWithArgs: Pair<Type, List<Importable>>, nullable: Bo
|
||||
}
|
||||
|
||||
fun field(type: Type, nullable: Boolean = false, withReplace: Boolean = false): Field {
|
||||
return SimpleField(type.type.decapitalize(), type.typeWithArguments, type.packageName, null, nullable, withReplace)
|
||||
return SimpleField(type.type.replaceFirstChar(Char::lowercaseChar), type.typeWithArguments, type.packageName, null, nullable, withReplace)
|
||||
}
|
||||
|
||||
fun booleanField(name: String, withReplace: Boolean = false): Field {
|
||||
@@ -57,7 +57,7 @@ fun field(name: String, element: AbstractElement, nullable: Boolean = false, wit
|
||||
}
|
||||
|
||||
fun field(element: Element, nullable: Boolean = false, withReplace: Boolean = false): Field {
|
||||
return FirField(element.name.decapitalize(), element, nullable, withReplace)
|
||||
return FirField(element.name.replaceFirstChar(Char::lowercaseChar), element, nullable, withReplace)
|
||||
}
|
||||
|
||||
// ----------- Field list -----------
|
||||
@@ -67,7 +67,7 @@ fun fieldList(name: String, type: Importable, withReplace: Boolean = false): Fie
|
||||
}
|
||||
|
||||
fun fieldList(element: Element, withReplace: Boolean = false): Field {
|
||||
return FieldList(element.name.decapitalize() + "s", element, withReplace)
|
||||
return FieldList(element.name.replaceFirstChar(Char::lowercaseChar) + "s", element, withReplace)
|
||||
}
|
||||
|
||||
// ----------- Field set -----------
|
||||
|
||||
+3
-3
@@ -228,7 +228,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
|
||||
field.needsSeparateTransform -> {
|
||||
if (!(element.needTransformOtherChildren && field.needTransformInOtherChildren)) {
|
||||
println("transform${field.name.capitalize()}(transformer, data)")
|
||||
println("transform${field.name.replaceFirstChar(Char::uppercaseChar)}(transformer, data)")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
field.transform()
|
||||
}
|
||||
if (field.needTransformInOtherChildren) {
|
||||
println("transform${field.name.capitalize()}(transformer, data)")
|
||||
println("transform${field.name.replaceFirstChar(Char::uppercaseChar)}(transformer, data)")
|
||||
}
|
||||
}
|
||||
println("return this")
|
||||
@@ -335,7 +335,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
}
|
||||
|
||||
for (field in allFields.filter { it.withReplace }) {
|
||||
val capitalizedFieldName = field.name.capitalize()
|
||||
val capitalizedFieldName = field.name.replaceFirstChar(Char::uppercaseChar)
|
||||
val newValue = "new$capitalizedFieldName"
|
||||
generateReplace(field, forceNullable = field.useNullableForReplace) {
|
||||
when {
|
||||
|
||||
+3
-3
@@ -96,7 +96,7 @@ val Field.isVal: Boolean get() = this is FieldList || (this is FieldWithDefault
|
||||
|
||||
|
||||
fun Field.transformFunctionDeclaration(returnType: String): String {
|
||||
return transformFunctionDeclaration(name.capitalize(), returnType)
|
||||
return transformFunctionDeclaration(name.replaceFirstChar(Char::uppercaseChar), returnType)
|
||||
}
|
||||
|
||||
fun transformFunctionDeclaration(transformName: String, returnType: String): String {
|
||||
@@ -104,7 +104,7 @@ fun transformFunctionDeclaration(transformName: String, returnType: String): Str
|
||||
}
|
||||
|
||||
fun Field.replaceFunctionDeclaration(overridenType: Importable? = null, forceNullable: Boolean = false): String {
|
||||
val capName = name.capitalize()
|
||||
val capName = name.replaceFirstChar(Char::uppercaseChar)
|
||||
val type = overridenType?.typeWithArguments ?: typeWithArguments
|
||||
|
||||
val typeWithNullable = if (forceNullable && !type.endsWith("?")) "$type?" else type
|
||||
@@ -136,7 +136,7 @@ fun Implementation.Kind?.braces(): String = when (this) {
|
||||
else -> throw IllegalStateException(this.toString())
|
||||
}
|
||||
|
||||
val Element.safeDecapitalizedName: String get() = if (name == "Class") "klass" else name.decapitalize()
|
||||
val Element.safeDecapitalizedName: String get() = if (name == "Class") "klass" else name.replaceFirstChar(Char::lowercaseChar)
|
||||
|
||||
val Importable.typeWithArguments: String
|
||||
get() = when (this) {
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ import java.util.*
|
||||
|
||||
object PackagePartClassUtils {
|
||||
@JvmStatic fun getPathHashCode(file: VirtualFile): Int =
|
||||
file.path.toLowerCase().hashCode()
|
||||
file.path.lowercase().hashCode()
|
||||
|
||||
private val PART_CLASS_NAME_SUFFIX = "Kt"
|
||||
|
||||
@@ -36,7 +36,7 @@ object PackagePartClassUtils {
|
||||
// NB use Locale.ENGLISH so that build is locale-independent.
|
||||
// See Javadoc on java.lang.String.toUpperCase() for more details.
|
||||
when {
|
||||
Character.isJavaIdentifierStart(str[0]) -> str.substring(0, 1).toLowerCase(Locale.ENGLISH) + str.substring(1)
|
||||
Character.isJavaIdentifierStart(str[0]) -> str.substring(0, 1).lowercase() + str.substring(1)
|
||||
str[0] == '_' -> str.substring(1)
|
||||
else -> str
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ object Renderers {
|
||||
else
|
||||
declarationWithNameAndKind
|
||||
|
||||
withPlatform.capitalize()
|
||||
withPlatform.replaceFirstChar(Char::uppercaseChar)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -51,7 +51,7 @@ abstract class KotlinSuppressCache {
|
||||
}
|
||||
|
||||
fun isSuppressed(psiElement: PsiElement, suppressionKey: String, severity: Severity) =
|
||||
isSuppressed(StringSuppressRequest(psiElement, severity, suppressionKey.toLowerCase()))
|
||||
isSuppressed(StringSuppressRequest(psiElement, severity, suppressionKey.lowercase()))
|
||||
|
||||
private fun isSuppressed(request: SuppressRequest): Boolean {
|
||||
// If diagnostics are reported in a synthetic file generated by KtPsiFactory (dummy.kt),
|
||||
@@ -158,7 +158,7 @@ abstract class KotlinSuppressCache {
|
||||
if (arrayValue is ArrayValue) {
|
||||
for (value in arrayValue.value) {
|
||||
if (value is StringValue) {
|
||||
builder.add(value.value.toLowerCase())
|
||||
builder.add(value.value.lowercase())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ abstract class KotlinSuppressCache {
|
||||
|
||||
companion object {
|
||||
private fun getDiagnosticSuppressKey(diagnostic: Diagnostic): String =
|
||||
diagnostic.factory.name.toLowerCase()
|
||||
diagnostic.factory.name.lowercase()
|
||||
|
||||
private fun isSuppressedByStrings(key: String, strings: Set<String>, severity: Severity): Boolean =
|
||||
severity == Severity.WARNING && "warnings" in strings || key in strings
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ fun makeIncrementally(
|
||||
val allExtensions = kotlinExtensions + "java"
|
||||
val rootsWalk = sourceRoots.asSequence().flatMap { it.walk() }
|
||||
val files = rootsWalk.filter(File::isFile)
|
||||
val sourceFiles = files.filter { it.extension.toLowerCase() in allExtensions }.toList()
|
||||
val sourceFiles = files.filter { it.extension.lowercase() in allExtensions }.toList()
|
||||
val buildHistoryFile = File(cachesDir, "build-history.bin")
|
||||
args.javaSourceRoots = sourceRoots.map { it.absolutePath }.toTypedArray()
|
||||
val buildReporter = BuildReporter(icReporter = reporter, buildMetricsReporter = DoNothingBuildMetricsReporter)
|
||||
@@ -275,7 +275,7 @@ class IncrementalJvmCompilerRunner(
|
||||
private fun processLookupSymbolsForAndroidLayouts(changedFiles: ChangedFiles.Known): Collection<LookupSymbol> {
|
||||
val result = mutableListOf<LookupSymbol>()
|
||||
for (file in changedFiles.modified + changedFiles.removed) {
|
||||
if (file.extension.toLowerCase() != "xml") continue
|
||||
if (file.extension.lowercase() != "xml") continue
|
||||
val layoutName = file.name.substringBeforeLast('.')
|
||||
result.add(LookupSymbol(ANDROID_LAYOUT_CONTENT_LOOKUP_NAME, layoutName))
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
|
||||
else ->
|
||||
Modality.FINAL
|
||||
}
|
||||
p(modality, defaultModality) { name.toLowerCase() }
|
||||
p(modality, defaultModality) { name.lowercase() }
|
||||
p(isExternal, "external")
|
||||
p(isFakeOverride, customModifier("fake"))
|
||||
p(isOverride, "override")
|
||||
@@ -302,7 +302,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
|
||||
p(isData, "data")
|
||||
p(isCompanion, "companion")
|
||||
p(isFunInterface, "fun")
|
||||
p(classKind) { name.toLowerCase().replace('_', ' ') + if (this == ClassKind.ENUM_ENTRY) " class" else "" }
|
||||
p(classKind) { name.lowercase().replace('_', ' ') + if (this == ClassKind.ENUM_ENTRY) " class" else "" }
|
||||
p(isInfix, "infix")
|
||||
p(isOperator, "operator")
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ private fun parseLong(text: String): Long? {
|
||||
}
|
||||
|
||||
private fun parseFloatingLiteral(text: String): Number? {
|
||||
if (text.toLowerCase().endsWith('f')) {
|
||||
if (text.lowercase().endsWith('f')) {
|
||||
return parseFloat(text)
|
||||
}
|
||||
return parseDouble(text)
|
||||
|
||||
@@ -72,7 +72,7 @@ open class KotlinStubBaseImpl<T : KtElementImplStub<*>>(parent: StubElement<*>?,
|
||||
private fun getPropertyName(method: Method): String {
|
||||
val methodName = method.name!!
|
||||
if (methodName.startsWith("get")) {
|
||||
return methodName.substring(3).decapitalize()
|
||||
return methodName.substring(3).replaceFirstChar(Char::lowercaseChar)
|
||||
}
|
||||
return methodName
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun String.toDouble(): Double = (+(this.asDynamic())).unsafeCast<Double>().also
|
||||
TODO()
|
||||
}
|
||||
|
||||
fun String.isNaN(): Boolean = when (this.toLowerCase()) {
|
||||
fun String.isNaN(): Boolean = when (this.lowercase()) {
|
||||
"nan", "+nan", "-nan" -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
+1
-1
@@ -316,7 +316,7 @@ class ModuleStructureExtractorImpl(
|
||||
}
|
||||
|
||||
private fun parseModulePlatformByName(moduleName: String): TargetPlatform? {
|
||||
val nameSuffix = moduleName.substringAfterLast("-", "").toUpperCase()
|
||||
val nameSuffix = moduleName.substringAfterLast("-", "").uppercase()
|
||||
return when {
|
||||
nameSuffix == "COMMON" -> CommonPlatforms.defaultCommonPlatform
|
||||
nameSuffix == "JVM" -> JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely
|
||||
|
||||
@@ -536,7 +536,7 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava<TestModule, Tes
|
||||
private fun parseJvmTarget(directiveMap: Directives) = directiveMap[JVM_TARGET]?.let { JvmTarget.fromString(it) }
|
||||
|
||||
protected fun parseModulePlatformByName(moduleName: String): TargetPlatform? {
|
||||
val nameSuffix = moduleName.substringAfterLast("-", "").toUpperCase()
|
||||
val nameSuffix = moduleName.substringAfterLast("-", "").uppercase()
|
||||
return when {
|
||||
nameSuffix == "COMMON" -> CommonPlatforms.defaultCommonPlatform
|
||||
nameSuffix == "JVM" -> JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
fun case_1(x: Class?, y: Any) {
|
||||
x?.prop_12 = if (y is String) "" else throw Exception()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(x: Class?, y: Any) {
|
||||
x?.prop_9 = y is String || return
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toUpperCase<!>()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>uppercase<!>()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -37,7 +37,7 @@ fun case_2(x: Class?, y: Any) {
|
||||
fun case_3(x: Class?, y: Any) {
|
||||
x?.prop_12 = y as String
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -48,7 +48,7 @@ fun case_3(x: Class?, y: Any) {
|
||||
fun case_4(x: Class?, y: Any) {
|
||||
x?.prop_12 = y as? String ?: return
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -59,14 +59,14 @@ fun case_4(x: Class?, y: Any) {
|
||||
fun case_5(x: Class?, y: String?) {
|
||||
x?.prop_12 = y ?: return
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(x: Class?, y: String?) {
|
||||
x?.prop_9 = y !is String && throw Exception()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>y<!><!UNSAFE_CALL!>.<!>toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>y<!><!UNSAFE_CALL!>.<!>uppercase()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -77,7 +77,7 @@ fun case_6(x: Class?, y: String?) {
|
||||
fun case_7(x: Class?, y: String?) {
|
||||
x?.prop_12 = y!!
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -88,5 +88,5 @@ fun case_7(x: Class?, y: String?) {
|
||||
fun case_8(x: Class?, y: String?) {
|
||||
x?.prop_12 = if (y === null) throw Exception() else ""
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ object TestsJsonMapGenerator {
|
||||
SECONDARY;
|
||||
|
||||
override fun toString(): String {
|
||||
return name.toLowerCase()
|
||||
return name.lowercase()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ object TestsStatisticCollector {
|
||||
val statistic = mutableMapOf<TestArea, SpecTestsStatElement>()
|
||||
|
||||
for (specTestArea in TestArea.values()) {
|
||||
val specTestsPath = "$SPEC_TESTDATA_PATH/${specTestArea.name.toLowerCase().replace("_", "/")}/${testLinkedType.testDataPath}"
|
||||
val specTestsPath = "$SPEC_TESTDATA_PATH/${specTestArea.name.lowercase().replace("_", "/")}/${testLinkedType.testDataPath}"
|
||||
|
||||
statistic[specTestArea] =
|
||||
SpecTestsStatElement(SpecTestsStatElementType.AREA)
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.regex.Pattern
|
||||
object CommonParser {
|
||||
fun String.withUnderscores() = replace(" ", "_")
|
||||
.replace(File.separator, "_")
|
||||
.toUpperCase()
|
||||
.uppercase()
|
||||
|
||||
fun String.splitByComma() = split(Regex(""",\s*"""))
|
||||
fun String.splitByPathSeparator() = split(File.separator)
|
||||
|
||||
@@ -85,8 +85,8 @@ private fun parseImplementationTestInfo(testFilePath: String, linkedTestType: Sp
|
||||
testArea = TestArea.valueOf(testInfoByContentMatcher.group("testArea").withUnderscores()),
|
||||
testType = TestType.valueOf(testInfoByContentMatcher.group("testType")),
|
||||
testNumber = testInfoElements[CommonSpecTestFileInfoElementType.NUMBER]?.content?.toInt() ?: 0,
|
||||
testDescription = fileNameWithoutExtension.toUpperCase()[0] + fileNameWithoutExtension.substring(1)
|
||||
.replace(Regex("""([A-Z])"""), " $1").toLowerCase(),
|
||||
testDescription = fileNameWithoutExtension.uppercase()[0] + fileNameWithoutExtension.substring(1)
|
||||
.replace(Regex("""([A-Z])"""), " $1").lowercase(),
|
||||
testInfoElements = testInfoElements,
|
||||
testCasesSet = SpecTestCasesSet(mutableMapOf(), mutableMapOf(), mutableMapOf()), //todo
|
||||
unexpectedBehavior = testInfoElements.contains(CommonInfoElementType.UNEXPECTED_BEHAVIOUR),
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ object HtmlSpecSentencesMapBuilder {
|
||||
spec.select("$SECTION_SELECTORS, $PARAGRAPH_SELECTORS, .sentence").forEach { element ->
|
||||
when {
|
||||
element.`is`(SECTION_SELECTORS) -> {
|
||||
val sectionTag = SectionTag.valueOf(element.tagName().toLowerCase())
|
||||
val sectionTag = SectionTag.valueOf(element.tagName().lowercase())
|
||||
while (!currentSectionsPath.empty() && currentSectionsPath.peek().first.level >= sectionTag.level) {
|
||||
currentSectionsPath.pop()
|
||||
}
|
||||
|
||||
+2
-2
@@ -242,7 +242,7 @@ object GenerateSteppedRangesCodegenTestData {
|
||||
|
||||
private fun PrintWriter.printTestForFunctionAndType(builder: TestBuilder, function: Function, type: Type, asLiteral: Boolean) {
|
||||
val shouldFail = (builder.expectedValuesOrFailIfNull == null)
|
||||
val listVarName = type.type.toLowerCase() + "List"
|
||||
val listVarName = type.type.lowercase() + "List"
|
||||
if (shouldFail) {
|
||||
println(" assertFailsWith<IllegalArgumentException> {")
|
||||
} else {
|
||||
@@ -253,7 +253,7 @@ object GenerateSteppedRangesCodegenTestData {
|
||||
if (asLiteral) {
|
||||
println("$indent for (i in ${builder.buildFullLiteral(type, function)}) {")
|
||||
} else {
|
||||
val progressionVarName = type.type.toLowerCase() + "Progression"
|
||||
val progressionVarName = type.type.lowercase() + "Progression"
|
||||
println("$indent val $progressionVarName = ${builder.buildRangeOnlyExpression(type, function)}")
|
||||
println("$indent for (i in ${builder.buildOnTopOfRangeOnlyVariable(progressionVarName, type)}) {")
|
||||
}
|
||||
|
||||
+4
-4
@@ -86,7 +86,7 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
|
||||
val platformParameters = JvmPlatformParameters(
|
||||
packagePartProviderFactory = { PackagePartProvider.Empty },
|
||||
moduleByJavaClass = { javaClass ->
|
||||
val moduleName = javaClass.name.asString().toLowerCase().first().toString()
|
||||
val moduleName = javaClass.name.asString().lowercase().first().toString()
|
||||
modules.first { it._name == moduleName }
|
||||
},
|
||||
useBuiltinsProviderForModule = { false }
|
||||
@@ -165,8 +165,8 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
|
||||
module ->
|
||||
val moduleDescriptor = resolverForProject.descriptorForModule(module)
|
||||
|
||||
checkClassInPackage(moduleDescriptor, "test", "Kotlin${module._name.toUpperCase()}")
|
||||
checkClassInPackage(moduleDescriptor, "custom", "${module._name.toUpperCase()}Class")
|
||||
checkClassInPackage(moduleDescriptor, "test", "Kotlin${module._name.uppercase()}")
|
||||
checkClassInPackage(moduleDescriptor, "custom", "${module._name.uppercase()}Class")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
|
||||
assert(!ErrorUtils.isError(referencedDescriptor)) { "Error descriptor: $referencedDescriptor" }
|
||||
|
||||
val descriptorName = referencedDescriptor.name.asString()
|
||||
val expectedModuleName = "<${descriptorName.toLowerCase().first()}>"
|
||||
val expectedModuleName = "<${descriptorName.lowercase().first()}>"
|
||||
val moduleName = referencedDescriptor.module.name.asString()
|
||||
Assert.assertEquals(
|
||||
"Java class $descriptorName in $context should be in module $expectedModuleName, but instead was in $moduleName",
|
||||
|
||||
@@ -206,7 +206,7 @@ enum class LanguageFeature(
|
||||
|
||||
val presentableName: String
|
||||
// E.g. "DestructuringLambdaParameters" -> ["Destructuring", "Lambda", "Parameters"] -> "destructuring lambda parameters"
|
||||
get() = name.split("(?<!^)(?=[A-Z])".toRegex()).joinToString(separator = " ", transform = String::toLowerCase)
|
||||
get() = name.split("(?<!^)(?=[A-Z])".toRegex()).joinToString(separator = " ", transform = String::lowercase)
|
||||
|
||||
val presentableText get() = if (hintUrl == null) presentableName else "$presentableName (See: $hintUrl)"
|
||||
|
||||
|
||||
+1
-1
@@ -827,7 +827,7 @@ class FirVisualizer(private val firFile: FirFile) : BaseRenderer() {
|
||||
val name = arrayOfCall.typeRef.coneType.classId!!.shortClassName.asString()
|
||||
val typeArguments = arrayOfCall.typeRef.coneType.typeArguments
|
||||
val typeParameters = if (typeArguments.isEmpty()) "" else " <T>"
|
||||
data.append("fun$typeParameters ${name.decapitalize()}Of")
|
||||
data.append("fun$typeParameters ${name.replaceFirstChar(Char::lowercaseChar)}Of")
|
||||
typeArguments.firstOrNull()?.let {
|
||||
data.append("<").append(it.tryToRenderConeAsFunctionType()).append(">")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user