upgrade to Kotlin 1.9.0

This commit is contained in:
Irmen de Jong 2023-07-06 23:03:47 +02:00
parent 1f7180d9a8
commit 6d1fdf1ba6
8 changed files with 11 additions and 14 deletions

2
.idea/kotlinc.xml generated
View File

@ -4,6 +4,6 @@
<option name="jvmTarget" value="11" />
</component>
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.8.21-release-380" />
<option name="version" value="1.9.0-release-358" />
</component>
</project>

View File

@ -85,7 +85,7 @@ val BuiltinFunctions: Map<String, FSignature> = mapOf(
"abs__float" to FSignature(true, listOf(FParam("value", arrayOf(DataType.FLOAT))), DataType.FLOAT),
"len" to FSignature(true, listOf(FParam("values", IterableDatatypes)), DataType.UWORD),
// normal functions follow:
"sizeof" to FSignature(true, listOf(FParam("object", DataType.values())), DataType.UBYTE),
"sizeof" to FSignature(true, listOf(FParam("object", DataType.entries.toTypedArray())), DataType.UBYTE),
"sgn" to FSignature(true, listOf(FParam("value", NumericDatatypesNoBool)), DataType.BYTE),
"sqrt" to FSignature(true, listOf(FParam("value", NumericDatatypesNoBool)), null),
"sqrt__ubyte" to FSignature(true, listOf(FParam("value", arrayOf(DataType.UBYTE))), DataType.UBYTE),

View File

@ -178,10 +178,8 @@ internal class AsmAssignSource(val kind: SourceStorageKind,
AsmAssignSource(SourceStorageKind.EXPRESSION, program, asmgen, value.type, expression = value)
}
is PtFunctionCall -> {
val symbol = asmgen.symbolTable.lookup(value.name)
if(symbol==null)
TODO("${value.name}")
val sub = symbol!!.astNode as IPtSubroutine
val symbol = asmgen.symbolTable.lookup(value.name) ?: throw AssemblyError("lookup error ${value.name}")
val sub = symbol.astNode as IPtSubroutine
val returnType = sub.returnsWhatWhere().firstOrNull { rr -> rr.first.registerOrPair != null || rr.first.statusflag!=null }?.second
?: throw AssemblyError("can't translate zero return values in assignment")

View File

@ -743,13 +743,13 @@ internal class AstChecker(private val program: Program,
"%output" -> {
if(directive.parent !is Module)
err("this directive may only occur at module level")
if(directive.args.size!=1 || directive.args[0].name !in OutputType.values().map {it.name.lowercase()})
if(directive.args.size!=1 || directive.args[0].name !in OutputType.entries.map {it.name.lowercase()})
err("invalid output directive type")
}
"%launcher" -> {
if(directive.parent !is Module)
err("this directive may only occur at module level")
if(directive.args.size!=1 || directive.args[0].name !in CbmPrgLauncherType.values().map{it.name.lowercase()})
if(directive.args.size!=1 || directive.args[0].name !in CbmPrgLauncherType.entries.map{it.name.lowercase()})
err("invalid launcher directive type")
}
"%zeropage" -> {

View File

@ -468,7 +468,7 @@ private fun Prog8ANTLRParser.CharliteralContext.toAst(): CharLiteral {
val enc = this.encoding?.text
val encoding =
if(enc!=null)
Encoding.values().singleOrNull { it.prefix == enc }
Encoding.entries.singleOrNull { it.prefix == enc }
?: throw SyntaxError("invalid encoding", toPosition())
else
Encoding.DEFAULT
@ -485,7 +485,7 @@ private fun Prog8ANTLRParser.StringliteralContext.toAst(): StringLiteral {
val enc = encoding?.text
val encoding =
if(enc!=null)
Encoding.values().singleOrNull { it.prefix == enc }
Encoding.entries.singleOrNull { it.prefix == enc }
?: throw SyntaxError("invalid encoding", toPosition())
else
Encoding.DEFAULT

View File

@ -1,7 +1,6 @@
TODO
====
- upgrade to Kotlin 1.9.0 enum.values() -> enum.entries
- IR: don't use ext.b to clear the msb of an unsigned word, add a specialized instruction for this zmsb.w?
- Fix expericodegen errors (on rockrunners etc)

View File

@ -4,5 +4,5 @@ org.gradle.parallel=true
org.gradle.daemon=true
kotlin.code.style=official
javaVersion=11
kotlinVersion=1.8.21
kotlinVersion=1.9.0
version=9.1-SNAPSHOT

View File

@ -123,8 +123,8 @@ class TestInstructions: FunSpec({
}
test("all instructionformats") {
instructionFormats.size shouldBe Opcode.values().size
Opcode.values().forEach {
instructionFormats.size shouldBe Opcode.entries.size
Opcode.entries.forEach {
val fmt = instructionFormats.getValue(it)
fmt.values.forEach { format ->
require(format.reg2==OperandDirection.UNUSED || format.reg2==OperandDirection.READ) {"reg2 can only be used as input"}