mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-08 17:54:40 +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");
|
assertError("useuninitialized", "Variable used before being defined");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUseUninitialized2() throws IOException, URISyntaxException {
|
||||||
|
assertError("useuninitialized2", "Variable used before being defined");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTypeMismatch() throws IOException, URISyntaxException {
|
public void testTypeMismatch() throws IOException, URISyntaxException {
|
||||||
assertError("typemismatch", "Type mismatch");
|
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