fix compiler crash when initializing an array var with another array var

This commit is contained in:
Irmen de Jong
2022-01-23 14:23:34 +01:00
parent 4bf4771f08
commit 5766208207
5 changed files with 94 additions and 49 deletions

View File

@@ -29,4 +29,28 @@ class TestVariables: FunSpec({
"""
compileText(C64Target, true, text, writeAssembly = true).assertSuccess()
}
test("array initialization with array literal") {
val text = """
main {
sub start() {
ubyte[] @shared arrayvar = [1,2,3,4]
}
}
"""
compileText(C64Target, true, text, writeAssembly = true).assertSuccess()
}
test("array initialization with array var assignment") {
val text = """
main {
sub start() {
ubyte[3] @shared arrayvar = main.values
}
ubyte[] values = [1,2,3]
}
"""
compileText(C64Target, false, text, writeAssembly = true).assertSuccess()
}
})