feat: error reporting for global reference usage

This commit is contained in:
Brett Broadhurst 2026-03-19 01:54:33 -06:00
parent 47351cd6f9
commit be297047d1
Failed to generate hash of commit
8 changed files with 401 additions and 371 deletions

View file

@ -27,6 +27,19 @@ test "compiler: global variable shadowing" {
);
}
test "compiler: invalid divert target" {
try testEqual(
\\-> foo
\\
\\VAR foo = 123
,
\\<STDIN>:1:4: error: invalid divert target
\\1 | -> foo
\\ | ^
\\
);
}
fn testEqual(source_bytes: [:0]const u8, expected_error: []const u8) !void {
const gpa = std.testing.allocator;
var allocating = std.io.Writer.Allocating.init(gpa);