Fix warnings in generator modules
This commit is contained in:
@@ -25,7 +25,7 @@ class GenerateArrays(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
|
||||
override fun generateBody() {
|
||||
for (kind in PrimitiveType.values()) {
|
||||
val typeLower = kind.name.toLowerCase()
|
||||
val typeLower = kind.name.lowercase()
|
||||
val s = kind.capitalized
|
||||
val defaultValue = when (kind) {
|
||||
PrimitiveType.CHAR -> "null char (`\\u0000')"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.generators.builtins
|
||||
|
||||
import org.jetbrains.kotlin.generators.builtins.ProgressionKind.*
|
||||
import org.jetbrains.kotlin.generators.builtins.ProgressionKind.CHAR
|
||||
import java.io.PrintWriter
|
||||
|
||||
enum class PrimitiveType(val byteSize: Int) {
|
||||
@@ -18,7 +18,7 @@ enum class PrimitiveType(val byteSize: Int) {
|
||||
DOUBLE(8),
|
||||
BOOLEAN(1);
|
||||
|
||||
val capitalized: String get() = name.toLowerCase().capitalize()
|
||||
val capitalized: String get() = name.lowercase().replaceFirstChar(Char::uppercase)
|
||||
val bitSize = byteSize * 8
|
||||
|
||||
val isFloatingPoint: Boolean get() = this in floatingPoint
|
||||
@@ -38,7 +38,7 @@ enum class UnsignedType {
|
||||
UINT,
|
||||
ULONG;
|
||||
|
||||
val capitalized: String get() = name.substring(0, 2) + name.substring(2).toLowerCase()
|
||||
val capitalized: String get() = name.substring(0, 2) + name.substring(2).lowercase()
|
||||
val asSigned: PrimitiveType = PrimitiveType.valueOf(name.substring(1))
|
||||
|
||||
val byteSize = (1 shl ordinal)
|
||||
@@ -51,7 +51,7 @@ enum class ProgressionKind {
|
||||
INT,
|
||||
LONG;
|
||||
|
||||
val capitalized: String get() = name.toLowerCase().capitalize()
|
||||
val capitalized: String get() = name.lowercase().replaceFirstChar(Char::uppercase)
|
||||
}
|
||||
|
||||
fun progressionIncrementType(kind: ProgressionKind) = when (kind) {
|
||||
@@ -77,4 +77,4 @@ fun PrintWriter.printDoc(documentation: String, indent: String) {
|
||||
docLines.forEach { this.println("$indent * $it") }
|
||||
this.println("$indent */")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
private fun generateDoc(kind: PrimitiveType) {
|
||||
out.println("/**")
|
||||
out.println(" * Represents a ${typeDescriptions[kind]}.")
|
||||
out.println(" * On the JVM, non-nullable values of this type are represented as values of the primitive type `${kind.name.toLowerCase()}`.")
|
||||
out.println(" * On the JVM, non-nullable values of this type are represented as values of the primitive type `${kind.name.lowercase()}`.")
|
||||
out.println(" */")
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,15 @@
|
||||
|
||||
package org.jetbrains.kotlin.generators.builtins.unsigned
|
||||
|
||||
|
||||
import org.jetbrains.kotlin.generators.builtins.*
|
||||
import org.jetbrains.kotlin.generators.builtins.PrimitiveType
|
||||
import org.jetbrains.kotlin.generators.builtins.UnsignedType
|
||||
import org.jetbrains.kotlin.generators.builtins.convert
|
||||
import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsSourceGenerator
|
||||
import org.jetbrains.kotlin.generators.builtins.numbers.GeneratePrimitives
|
||||
import org.jetbrains.kotlin.generators.builtins.printDoc
|
||||
import java.io.File
|
||||
import java.io.PrintWriter
|
||||
|
||||
|
||||
fun generateUnsignedTypes(
|
||||
targetDir: File,
|
||||
generate: (File, (PrintWriter) -> BuiltInsSourceGenerator) -> Unit
|
||||
@@ -134,7 +135,7 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
|
||||
if (otherType == type) out.print("override ")
|
||||
out.print("inline operator fun compareTo(other: ${otherType.capitalized}): Int = ")
|
||||
if (otherType == type && maxByDomainCapacity(type, UnsignedType.UINT) == type) {
|
||||
out.println("${className.toLowerCase()}Compare(this.data, other.data)")
|
||||
out.println("${className.lowercase()}Compare(this.data, other.data)")
|
||||
} else {
|
||||
if (maxOf(type, otherType) < UnsignedType.UINT) {
|
||||
out.println("this.toInt().compareTo(other.toInt())")
|
||||
@@ -165,8 +166,8 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
|
||||
if (type == otherType && type == returnType) {
|
||||
when (name) {
|
||||
"plus", "minus", "times" -> out.println("$className(this.data.$name(other.data))")
|
||||
"div" -> out.println("${type.capitalized.toLowerCase()}Divide(this, other)")
|
||||
"rem" -> out.println("${type.capitalized.toLowerCase()}Remainder(this, other)")
|
||||
"div" -> out.println("${type.capitalized.lowercase()}Divide(this, other)")
|
||||
"rem" -> out.println("${type.capitalized.lowercase()}Remainder(this, other)")
|
||||
else -> error(name)
|
||||
}
|
||||
} else {
|
||||
@@ -348,7 +349,7 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
|
||||
out.print(" public inline fun to$otherName(): $otherName = ")
|
||||
when (type) {
|
||||
UnsignedType.UINT, UnsignedType.ULONG ->
|
||||
out.println(if (otherType == PrimitiveType.FLOAT) "this.toDouble().toFloat()" else className.toLowerCase() + "ToDouble(data)")
|
||||
out.println(if (otherType == PrimitiveType.FLOAT) "this.toDouble().toFloat()" else className.lowercase() + "ToDouble(data)")
|
||||
else ->
|
||||
out.println("this.toInt().to$otherName()")
|
||||
}
|
||||
@@ -466,7 +467,7 @@ class UnsignedIteratorsGenerator(out: PrintWriter) : BuiltInsSourceGenerator(out
|
||||
class UnsignedArrayGenerator(val type: UnsignedType, out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
val elementType = type.capitalized
|
||||
val arrayType = elementType + "Array"
|
||||
val arrayTypeOf = elementType.toLowerCase() + "ArrayOf"
|
||||
val arrayTypeOf = elementType.lowercase() + "ArrayOf"
|
||||
val storageElementType = type.asSigned.capitalized
|
||||
val storageArrayType = storageElementType + "Array"
|
||||
override fun generateBody() {
|
||||
|
||||
@@ -44,8 +44,6 @@ import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginDiagnostic
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
generateTestGroupSuite(args) {
|
||||
val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$"
|
||||
|
||||
testGroup("compiler/incremental-compilation-impl/test", "jps-plugin/testData") {
|
||||
fun incrementalJvmTestData(targetBackend: TargetBackend): TestGroup.TestClass.() -> Unit = {
|
||||
model("incremental/pureKotlin", extension = null, recursive = false, targetBackend = targetBackend)
|
||||
|
||||
Reference in New Issue
Block a user