feat: error message for unknown global variables

This commit is contained in:
Brett Broadhurst 2026-03-18 19:21:56 -06:00
parent c940374f27
commit 47351cd6f9
Failed to generate hash of commit
6 changed files with 184 additions and 89 deletions

View file

@ -1,6 +1,18 @@
const std = @import("std");
const Compilation = @import("compile.zig").Compilation;
test "compiler: unknown global variable" {
try testEqual(
\\{a}
,
\\<STDIN>:1:2: error: unknown global variable
\\1 | {a}
\\ | ^
\\
,
);
}
test "compiler: global variable shadowing" {
try testEqual(
\\VAR a = 0