diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-02-20 08:04:46 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-02-20 08:04:46 -0500 |
| commit | 079728752eca4cffbb4f7e8dc06d5e23b81d7627 (patch) | |
| tree | 552dcf5837bf1b3f4cab297bed4a9e0e0bea4c0f /test/compile_errors.zig | |
| parent | 067968c57f2c7ed4f0606913aa608f6c2be418d2 (diff) | |
| download | zig-079728752eca4cffbb4f7e8dc06d5e23b81d7627.tar.gz zig-079728752eca4cffbb4f7e8dc06d5e23b81d7627.zip | |
deduplicate compile errors for undeclared identifiers
closes #111
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 86dfd59bee..a9c748bcda 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1,6 +1,22 @@ const tests = @import("tests.zig"); pub fn addCases(cases: *tests.CompileErrorContext) void { + cases.addCase(x: { + var tc = cases.create( + "deduplicate undeclared identifier", + \\export fn a() void { + \\ x += 1; + \\} + \\export fn b() void { + \\ x += 1; + \\} + , + ".tmp_source.zig:2:5: error: use of undeclared identifier 'x'", + ); + tc.expect_exact = true; + break :x tc; + }); + cases.addTest( "export generic function", \\export fn foo(num: var) i32 { @@ -2280,7 +2296,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\} , ".tmp_source.zig:2:5: error: use of undeclared identifier 'i'", - ".tmp_source.zig:2:12: error: use of undeclared identifier 'i'", ); cases.add( @@ -5618,8 +5633,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { ".tmp_source.zig:2:26: error: vector element type must be integer, float, or pointer; '@Vector(4, u8)' is invalid", ); - cases.add( - "compileLog of tagged enum doesn't crash the compiler", + cases.add("compileLog of tagged enum doesn't crash the compiler", \\const Bar = union(enum(u32)) { \\ X: i32 = 1 \\}; @@ -5631,7 +5645,5 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\pub fn main () void { \\ comptime testCompileLog(Bar{.X = 123}); \\} - , - ".tmp_source.zig:6:5: error: found compile log statement" - ); + , ".tmp_source.zig:6:5: error: found compile log statement"); } |
