diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-09-22 10:46:22 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-09-22 10:46:22 -0400 |
| commit | c84548e71d4990352c202da92d47f1398385411f (patch) | |
| tree | a4c4ee25ba2708c1c3ffb92a9942cff58bfa1677 /test/compile_errors.zig | |
| parent | 3c1f9baff10be20910fc6e168c293759d9b8537e (diff) | |
| download | zig-c84548e71d4990352c202da92d47f1398385411f.tar.gz zig-c84548e71d4990352c202da92d47f1398385411f.zip | |
fix @compileLog having unintended side effects
closes #1459
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 62df9f077d..5d9fb84c71 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2,6 +2,20 @@ const tests = @import("tests.zig"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add( + "compile log statement inside function which must be comptime evaluated", + \\fn Foo(comptime T: type) type { + \\ @compileLog(@typeName(T)); + \\ return T; + \\} + \\export fn entry() void { + \\ _ = Foo(i32); + \\ _ = @typeName(Foo(i32)); + \\} + , + ".tmp_source.zig:2:5: error: found compile log statement", + ); + + cases.add( "comptime slice of an undefined slice", \\comptime { \\ var a: []u8 = undefined; @@ -3472,11 +3486,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\} , ".tmp_source.zig:5:5: error: found compile log statement", - ".tmp_source.zig:2:17: note: called from here", ".tmp_source.zig:6:5: error: found compile log statement", - ".tmp_source.zig:2:17: note: called from here", ".tmp_source.zig:7:5: error: found compile log statement", - ".tmp_source.zig:2:17: note: called from here", ); cases.add( |
