diff --git a/compiler/res/version.txt b/compiler/res/version.txt index bf77d5496..a5c5a84c4 100644 --- a/compiler/res/version.txt +++ b/compiler/res/version.txt @@ -1 +1 @@ -4.2 +4.3-SNAPSHOT diff --git a/compiler/src/prog8/ast/processing/AstChecker.kt b/compiler/src/prog8/ast/processing/AstChecker.kt index 77adc6392..a4c58bb1f 100644 --- a/compiler/src/prog8/ast/processing/AstChecker.kt +++ b/compiler/src/prog8/ast/processing/AstChecker.kt @@ -742,6 +742,11 @@ internal class AstChecker(private val program: Program, checkValueTypeAndRangeArray(array.type.typeOrElse(DataType.STRUCT), null, arrayspec, array) } + if(!array.value.all { it.constValue(program)!=null }) { + // TODO for now, array literals have to consist of all compile time constant values... + errors.err("array literal doesn't consist of only compile time constant values", array.position) + } + super.visit(array) } @@ -1098,7 +1103,7 @@ internal class AstChecker(private val program: Program, } if(value.type.isUnknown) - return err("attempt to check values of array with as yet unknown datatype") + return false when (targetDt) { DataType.STR -> return err("string value expected") diff --git a/docs/source/todo.rst b/docs/source/todo.rst index e3c2c5f2f..6d102c44e 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -5,6 +5,7 @@ TODO - get rid of all other TODO's in the code ;-) - line-circle-gfx examples are now a few hundred bytes larger than before. Why is that, can it be fixed? - compiler errors and warnings in standard format so the IDE shows them as clickable links; ./test.asm:2578:3: blablabla +- make it possible for array literals to not only contain compile time constants - further optimize assignment codegeneration - auto select correct library to import based on target, instead of having c64- and cx16- prefix variants - implement @stack for asmsub parameters