improve error message

This commit is contained in:
Irmen de Jong
2025-11-07 01:22:41 +01:00
parent 1f31cb18e4
commit 6611e4e092
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -598,7 +598,7 @@ main {
compileText(C64Target(), false, src, outputDir, writeAssembly = false, errors = errors) shouldBe null
errors.errors.size shouldBe 3
errors.errors[0] shouldContain ":9:"
errors.errors[0] shouldContain "no cast"
errors.errors[0] shouldContain "no implicit cast"
errors.errors[1] shouldContain ":10:"
errors.errors[1] shouldContain "out of range"
errors.errors[2] shouldContain ":10:"
@@ -946,7 +946,8 @@ class NumericLiteral(val type: BaseDataType, // only numerical types allowed
throw FatalAstException("type cast of weird type $type")
}
}
return ValueAfterCast(false, "no cast available from $type to $targettype number=$number", null)
val implicit = if(implicit) "implicit " else ""
return ValueAfterCast(false, "no ${implicit}cast available from $type to $targettype for value $number", null)
}
fun convertTypeKeepValue(targetDt: BaseDataType): ValueAfterCast {