mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-02 05:30:53 +00:00
Added another test securing that undefined variables cannot be used even if fwd-refs are allowed.
This commit is contained in:
parent
c8edee4291
commit
4640b31043
@ -635,6 +635,11 @@ public class TestPrograms {
|
||||
assertError("useuninitialized", "Variable used before being defined");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUseUninitialized2() throws IOException, URISyntaxException {
|
||||
assertError("useuninitialized2", "Variable used before being defined");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypeMismatch() throws IOException, URISyntaxException {
|
||||
assertError("typemismatch", "Type mismatch");
|
||||
|
@ -0,0 +1,9 @@
|
||||
// Test that forward-referencing an uninitialized variable inside a method fails.
|
||||
|
||||
void main() {
|
||||
const byte b = a;
|
||||
const byte a = 'c';
|
||||
byte* screen = $400;
|
||||
screen[0] = a;
|
||||
screen[1] = b;
|
||||
}
|
Loading…
Reference in New Issue
Block a user