mirror of
https://github.com/irmen/prog8.git
synced 2024-11-27 03:50:27 +00:00
fix compiler crashing with invalid array initializer built from single integer
This commit is contained in:
parent
2f05ebb966
commit
fab224f509
@ -102,7 +102,7 @@ internal class ConstantFoldingOptimizer(private val program: Program, private va
|
||||
else -> {}
|
||||
}
|
||||
// create the array itself, filled with the fillvalue.
|
||||
val array = Array(size) {fillvalue}.map { NumericLiteralValue.optimalInteger(it, numericLv.position) as Expression}.toTypedArray()
|
||||
val array = Array(size) {fillvalue}.map { NumericLiteralValue(ArrayElementTypes.getValue(decl.datatype), it, numericLv.position) as Expression}.toTypedArray()
|
||||
val refValue = ArrayLiteralValue(InferredTypes.InferredType.known(decl.datatype), array, position = numericLv.position)
|
||||
decl.value = refValue
|
||||
refValue.parent=decl
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
main {
|
||||
uword[2] array1 = 1 ; TODO fix compiler crash about init value type
|
||||
uword[2] array1 = 1
|
||||
|
||||
|
||||
sub start() {
|
||||
|
Loading…
Reference in New Issue
Block a user