| author | |
| committer | |
| log | 62625d9d9518644bcf4fa94e1d5c67edde22b91b |
| tree | dd80ae6e32eb3a0d6b24e1641ede3c6446fd2b6c |
| parent | c8d0fb0b212f2c618321caeeac315c1792b06035 |
678 files changed, 2175 insertions(+), 902 deletions(-)
src/test.zig+5-30| ... | @@ -34,15 +34,12 @@ test { | ... | @@ -34,15 +34,12 @@ test { |
| 34 | var ctx = TestContext.init(std.testing.allocator, arena); | 34 | var ctx = TestContext.init(std.testing.allocator, arena); |
| 35 | defer ctx.deinit(); | 35 | defer ctx.deinit(); |
| 36 | 36 | ||
| 37 | const compile_errors_dir_path = try std.fs.path.join(arena, &.{ | ||
| 38 | std.fs.path.dirname(@src().file).?, "..", "test", "compile_errors", | ||
| 39 | }); | ||
| 40 | |||
| 41 | var compile_errors_dir = try std.fs.cwd().openDir(compile_errors_dir_path, .{}); | ||
| 42 | defer compile_errors_dir.close(); | ||
| 43 | |||
| 44 | { | 37 | { |
| 45 | var dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true }); | 38 | const dir_path = try std.fs.path.join(arena, &.{ |
| 39 | std.fs.path.dirname(@src().file).?, "..", "test", "compile_errors", | ||
| 40 | }); | ||
| 41 | |||
| 42 | var dir = try std.fs.cwd().openDir(dir_path, .{ .iterate = true }); | ||
| 46 | defer dir.close(); | 43 | defer dir.close(); |
| 47 | 44 | ||
| 48 | // TODO make this incremental once the bug is solved that it triggers | 45 | // TODO make this incremental once the bug is solved that it triggers |
| ... | @@ -50,28 +47,6 @@ test { | ... | @@ -50,28 +47,6 @@ test { |
| 50 | ctx.addTestCasesFromDir(dir, .independent); | 47 | ctx.addTestCasesFromDir(dir, .independent); |
| 51 | } | 48 | } |
| 52 | 49 | ||
| 53 | if (!skip_stage1) { | ||
| 54 | var stage1_dir = try compile_errors_dir.openDir("stage1", .{}); | ||
| 55 | defer stage1_dir.close(); | ||
| 56 | |||
| 57 | const Config = struct { | ||
| 58 | name: []const u8, | ||
| 59 | is_test: bool, | ||
| 60 | output_mode: std.builtin.OutputMode, | ||
| 61 | }; | ||
| 62 | |||
| 63 | for ([_]Config{ | ||
| 64 | .{ .name = "obj", .is_test = false, .output_mode = .Obj }, | ||
| 65 | .{ .name = "exe", .is_test = false, .output_mode = .Exe }, | ||
| 66 | .{ .name = "test", .is_test = true, .output_mode = .Exe }, | ||
| 67 | }) |config| { | ||
| 68 | var dir = try stage1_dir.openDir(config.name, .{ .iterate = true }); | ||
| 69 | defer dir.close(); | ||
| 70 | |||
| 71 | ctx.addErrorCasesFromDir("stage1", dir, .stage1, config.output_mode, config.is_test, .independent); | ||
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 75 | { | 50 | { |
| 76 | const dir_path = try std.fs.path.join(arena, &.{ | 51 | const dir_path = try std.fs.path.join(arena, &.{ |
| 77 | std.fs.path.dirname(@src().file).?, "..", "test", "incremental", | 52 | std.fs.path.dirname(@src().file).?, "..", "test", "incremental", |
test/cases.zig-5| ... | @@ -1,11 +1,6 @@ | ... | @@ -1,11 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const TestContext = @import("../src/test.zig").TestContext; | 2 | const TestContext = @import("../src/test.zig").TestContext; |
| 3 | 3 | ||
| 4 | // Self-hosted has differing levels of support for various architectures. For now we pass explicit | ||
| 5 | // target parameters to each test case. At some point we will take this to the next level and have | ||
| 6 | // a set of targets that all test cases run on unless specifically overridden. For now, each test | ||
| 7 | // case applies to only the specified target. | ||
| 8 | |||
| 9 | pub fn addCases(ctx: *TestContext) !void { | 4 | pub fn addCases(ctx: *TestContext) !void { |
| 10 | try @import("compile_errors.zig").addCases(ctx); | 5 | try @import("compile_errors.zig").addCases(ctx); |
| 11 | try @import("stage2/cbe.zig").addCases(ctx); | 6 | try @import("stage2/cbe.zig").addCases(ctx); |
test/compile_errors.zig-218| ... | @@ -3,207 +3,6 @@ const builtin = @import("builtin"); | ... | @@ -3,207 +3,6 @@ const builtin = @import("builtin"); |
| 3 | const TestContext = @import("../src/test.zig").TestContext; | 3 | const TestContext = @import("../src/test.zig").TestContext; |
| 4 | 4 | ||
| 5 | pub fn addCases(ctx: *TestContext) !void { | 5 | pub fn addCases(ctx: *TestContext) !void { |
| 6 | { | ||
| 7 | const case = ctx.obj("callconv(.Interrupt) on unsupported platform", .{ | ||
| 8 | .cpu_arch = .aarch64, | ||
| 9 | .os_tag = .linux, | ||
| 10 | .abi = .none, | ||
| 11 | }); | ||
| 12 | case.backend = .stage1; | ||
| 13 | case.addError( | ||
| 14 | \\export fn entry() callconv(.Interrupt) void {} | ||
| 15 | , &[_][]const u8{ | ||
| 16 | "tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64", | ||
| 17 | }); | ||
| 18 | } | ||
| 19 | { | ||
| 20 | var case = ctx.obj("callconv(.Signal) on unsupported platform", .{ | ||
| 21 | .cpu_arch = .x86_64, | ||
| 22 | .os_tag = .linux, | ||
| 23 | .abi = .none, | ||
| 24 | }); | ||
| 25 | case.backend = .stage1; | ||
| 26 | case.addError( | ||
| 27 | \\export fn entry() callconv(.Signal) void {} | ||
| 28 | , &[_][]const u8{ | ||
| 29 | "tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64", | ||
| 30 | }); | ||
| 31 | } | ||
| 32 | { | ||
| 33 | const case = ctx.obj("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", .{ | ||
| 34 | .cpu_arch = .x86_64, | ||
| 35 | .os_tag = .linux, | ||
| 36 | .abi = .none, | ||
| 37 | }); | ||
| 38 | case.backend = .stage1; | ||
| 39 | case.addError( | ||
| 40 | \\const F1 = fn () callconv(.Stdcall) void; | ||
| 41 | \\const F2 = fn () callconv(.Fastcall) void; | ||
| 42 | \\const F3 = fn () callconv(.Thiscall) void; | ||
| 43 | \\export fn entry1() void { var a: F1 = undefined; _ = a; } | ||
| 44 | \\export fn entry2() void { var a: F2 = undefined; _ = a; } | ||
| 45 | \\export fn entry3() void { var a: F3 = undefined; _ = a; } | ||
| 46 | , &[_][]const u8{ | ||
| 47 | "tmp.zig:1:27: error: callconv 'Stdcall' is only available on x86, not x86_64", | ||
| 48 | "tmp.zig:2:27: error: callconv 'Fastcall' is only available on x86, not x86_64", | ||
| 49 | "tmp.zig:3:27: error: callconv 'Thiscall' is only available on x86, not x86_64", | ||
| 50 | }); | ||
| 51 | } | ||
| 52 | { | ||
| 53 | const case = ctx.obj("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", .{ | ||
| 54 | .cpu_arch = .x86_64, | ||
| 55 | .os_tag = .linux, | ||
| 56 | .abi = .none, | ||
| 57 | }); | ||
| 58 | case.backend = .stage1; | ||
| 59 | case.addError( | ||
| 60 | \\export fn entry1() callconv(.Stdcall) void {} | ||
| 61 | \\export fn entry2() callconv(.Fastcall) void {} | ||
| 62 | \\export fn entry3() callconv(.Thiscall) void {} | ||
| 63 | , &[_][]const u8{ | ||
| 64 | "tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64", | ||
| 65 | "tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64", | ||
| 66 | "tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64", | ||
| 67 | }); | ||
| 68 | } | ||
| 69 | { | ||
| 70 | const case = ctx.obj("callconv(.Vectorcall) on unsupported platform", .{ | ||
| 71 | .cpu_arch = .x86_64, | ||
| 72 | .os_tag = .linux, | ||
| 73 | .abi = .none, | ||
| 74 | }); | ||
| 75 | case.backend = .stage1; | ||
| 76 | case.addError( | ||
| 77 | \\export fn entry() callconv(.Vectorcall) void {} | ||
| 78 | , &[_][]const u8{ | ||
| 79 | "tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64", | ||
| 80 | }); | ||
| 81 | } | ||
| 82 | { | ||
| 83 | const case = ctx.obj("callconv(.APCS, .AAPCS, .AAPCSVFP) on unsupported platform", .{ | ||
| 84 | .cpu_arch = .x86_64, | ||
| 85 | .os_tag = .linux, | ||
| 86 | .abi = .none, | ||
| 87 | }); | ||
| 88 | case.backend = .stage1; | ||
| 89 | case.addError( | ||
| 90 | \\export fn entry1() callconv(.APCS) void {} | ||
| 91 | \\export fn entry2() callconv(.AAPCS) void {} | ||
| 92 | \\export fn entry3() callconv(.AAPCSVFP) void {} | ||
| 93 | , &[_][]const u8{ | ||
| 94 | "tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64", | ||
| 95 | "tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64", | ||
| 96 | "tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64", | ||
| 97 | }); | ||
| 98 | } | ||
| 99 | |||
| 100 | { | ||
| 101 | const case = ctx.obj("call with new stack on unsupported target", .{ | ||
| 102 | .cpu_arch = .wasm32, | ||
| 103 | .os_tag = .wasi, | ||
| 104 | .abi = .none, | ||
| 105 | }); | ||
| 106 | case.backend = .stage1; | ||
| 107 | case.addError( | ||
| 108 | \\var buf: [10]u8 align(16) = undefined; | ||
| 109 | \\export fn entry() void { | ||
| 110 | \\ @call(.{.stack = &buf}, foo, .{}); | ||
| 111 | \\} | ||
| 112 | \\fn foo() void {} | ||
| 113 | , &[_][]const u8{ | ||
| 114 | "tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack", | ||
| 115 | }); | ||
| 116 | } | ||
| 117 | |||
| 118 | // Note: One of the error messages here is backwards. It would be nice to fix, but that's not | ||
| 119 | // going to stop me from merging this branch which fixes a bunch of other stuff. | ||
| 120 | ctx.objErrStage1("incompatible sentinels", | ||
| 121 | \\export fn entry1(ptr: [*:255]u8) [*:0]u8 { | ||
| 122 | \\ return ptr; | ||
| 123 | \\} | ||
| 124 | \\export fn entry2(ptr: [*]u8) [*:0]u8 { | ||
| 125 | \\ return ptr; | ||
| 126 | \\} | ||
| 127 | \\export fn entry3() void { | ||
| 128 | \\ var array: [2:0]u8 = [_:255]u8{1, 2}; | ||
| 129 | \\ _ = array; | ||
| 130 | \\} | ||
| 131 | \\export fn entry4() void { | ||
| 132 | \\ var array: [2:0]u8 = [_]u8{1, 2}; | ||
| 133 | \\ _ = array; | ||
| 134 | \\} | ||
| 135 | , &[_][]const u8{ | ||
| 136 | "tmp.zig:2:12: error: expected type '[*:0]u8', found '[*:255]u8'", | ||
| 137 | "tmp.zig:2:12: note: destination pointer requires a terminating '0' sentinel, but source pointer has a terminating '255' sentinel", | ||
| 138 | "tmp.zig:5:12: error: expected type '[*:0]u8', found '[*]u8'", | ||
| 139 | "tmp.zig:5:12: note: destination pointer requires a terminating '0' sentinel", | ||
| 140 | |||
| 141 | "tmp.zig:8:35: error: expected type '[2:255]u8', found '[2:0]u8'", | ||
| 142 | "tmp.zig:8:35: note: destination array requires a terminating '255' sentinel, but source array has a terminating '0' sentinel", | ||
| 143 | "tmp.zig:12:31: error: expected type '[2:0]u8', found '[2]u8'", | ||
| 144 | "tmp.zig:12:31: note: destination array requires a terminating '0' sentinel", | ||
| 145 | }); | ||
| 146 | |||
| 147 | { | ||
| 148 | const case = ctx.obj("variable in inline assembly template cannot be found", .{ | ||
| 149 | .cpu_arch = .x86_64, | ||
| 150 | .os_tag = .linux, | ||
| 151 | .abi = .gnu, | ||
| 152 | }); | ||
| 153 | case.backend = .stage1; | ||
| 154 | case.addError( | ||
| 155 | \\export fn entry() void { | ||
| 156 | \\ var sp = asm volatile ( | ||
| 157 | \\ "mov %[foo], sp" | ||
| 158 | \\ : [bar] "=r" (-> usize) | ||
| 159 | \\ ); | ||
| 160 | \\ _ = sp; | ||
| 161 | \\} | ||
| 162 | , &[_][]const u8{ | ||
| 163 | "tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs", | ||
| 164 | }); | ||
| 165 | } | ||
| 166 | |||
| 167 | { | ||
| 168 | const case = ctx.obj("bad alignment in @asyncCall", .{ | ||
| 169 | .cpu_arch = .aarch64, | ||
| 170 | .os_tag = .linux, | ||
| 171 | .abi = .none, | ||
| 172 | }); | ||
| 173 | case.backend = .stage1; | ||
| 174 | case.addError( | ||
| 175 | \\export fn entry() void { | ||
| 176 | \\ var ptr: fn () callconv(.Async) void = func; | ||
| 177 | \\ var bytes: [64]u8 = undefined; | ||
| 178 | \\ _ = @asyncCall(&bytes, {}, ptr, .{}); | ||
| 179 | \\} | ||
| 180 | \\fn func() callconv(.Async) void {} | ||
| 181 | , &[_][]const u8{ | ||
| 182 | "tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8'", | ||
| 183 | }); | ||
| 184 | } | ||
| 185 | |||
| 186 | if (builtin.os.tag == .linux) { | ||
| 187 | ctx.testErrStage1("implicit dependency on libc", | ||
| 188 | \\extern "c" fn exit(u8) void; | ||
| 189 | \\export fn entry() void { | ||
| 190 | \\ exit(0); | ||
| 191 | \\} | ||
| 192 | , &[_][]const u8{ | ||
| 193 | "tmp.zig:3:5: error: dependency on libc must be explicitly specified in the build command", | ||
| 194 | }); | ||
| 195 | |||
| 196 | ctx.testErrStage1("libc headers note", | ||
| 197 | \\const c = @cImport(@cInclude("stdio.h")); | ||
| 198 | \\export fn entry() void { | ||
| 199 | \\ _ = c.printf("hello, world!\n"); | ||
| 200 | \\} | ||
| 201 | , &[_][]const u8{ | ||
| 202 | "tmp.zig:1:11: error: C import failed", | ||
| 203 | "tmp.zig:1:11: note: libc headers not available; compilation does not link against libc", | ||
| 204 | }); | ||
| 205 | } | ||
| 206 | |||
| 207 | { | 6 | { |
| 208 | const case = ctx.obj("wrong same named struct", .{}); | 7 | const case = ctx.obj("wrong same named struct", .{}); |
| 209 | case.backend = .stage1; | 8 | case.backend = .stage1; |
| ... | @@ -366,21 +165,4 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -366,21 +165,4 @@ pub fn addCases(ctx: *TestContext) !void { |
| 366 | //, &[_][]const u8{ | 165 | //, &[_][]const u8{ |
| 367 | // "tmp.zig:4:1: error: unable to inline function", | 166 | // "tmp.zig:4:1: error: unable to inline function", |
| 368 | //}); | 167 | //}); |
| 369 | |||
| 370 | { | ||
| 371 | const case = ctx.obj("align(N) expr function pointers is a compile error", .{ | ||
| 372 | .cpu_arch = .wasm32, | ||
| 373 | .os_tag = .freestanding, | ||
| 374 | .abi = .none, | ||
| 375 | }); | ||
| 376 | case.backend = .stage1; | ||
| 377 | |||
| 378 | case.addError( | ||
| 379 | \\export fn foo() align(1) void { | ||
| 380 | \\ return; | ||
| 381 | \\} | ||
| 382 | , &[_][]const u8{ | ||
| 383 | "tmp.zig:1:23: error: align(N) expr is not allowed on function prototypes in wasm32/wasm64", | ||
| 384 | }); | ||
| 385 | } | ||
| 386 | } | 168 | } |
test/compile_errors/stage1/exe/main_missing_name.zig+4-1| ... | @@ -1,5 +1,8 @@ | ... | @@ -1,5 +1,8 @@ |
| 1 | pub fn (main) void {} | 1 | pub fn (main) void {} |
| 2 | 2 | ||
| 3 | // main missing name | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 6 | // output_mode=Exe | ||
| 4 | // | 7 | // |
| 5 | // tmp.zig:1:5: error: missing function name | 8 | // tmp.zig:1:5: error: missing function name |
test/compile_errors/stage1/exe/missing_main_fn_in_executable.zig+4-1| ... | @@ -1,5 +1,8 @@ | ... | @@ -1,5 +1,8 @@ |
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | // missing main fn in executable | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 6 | // output_mode=Exe | ||
| 4 | // | 7 | // |
| 5 | // error: root source file has no member called 'main' | 8 | // error: root source file has no member called 'main' |
test/compile_errors/stage1/exe/private_main_fn.zig+4-1| ... | @@ -1,6 +1,9 @@ | ... | @@ -1,6 +1,9 @@ |
| 1 | fn main() void {} | 1 | fn main() void {} |
| 2 | 2 | ||
| 3 | // private main fn | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 6 | // output_mode=Exe | ||
| 4 | // | 7 | // |
| 5 | // error: 'main' is private | 8 | // error: 'main' is private |
| 6 | // tmp.zig:1:1: note: declared here | 9 | // tmp.zig:1:1: note: declared here |
test/compile_errors/stage1/obj/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn a() void { | ... | @@ -5,6 +5,8 @@ export fn a() void { |
| 5 | _ = t; | 5 | _ = t; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // C pointer pointing to non C ABI compatible type or has align attr | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:19: error: C pointers cannot point to non-C-ABI-compatible type 'Foo' | 12 | // tmp.zig:3:19: error: C pointers cannot point to non-C-ABI-compatible type 'Foo' |
test/compile_errors/stage1/obj/C_pointer_to_anyopaque.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn a() void { | ... | @@ -4,6 +4,8 @@ export fn a() void { |
| 4 | _ = y; | 4 | _ = y; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // C pointer to anyopaque | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:16: error: C pointers cannot point to opaque types | 11 | // tmp.zig:3:16: error: C pointers cannot point to opaque types |
test/compile_errors/stage1/obj/Frame_of_generic_function.zig+3-1| ... | @@ -7,6 +7,8 @@ fn func(comptime T: type) void { | ... | @@ -7,6 +7,8 @@ fn func(comptime T: type) void { |
| 7 | _ = x; | 7 | _ = x; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // @Frame() of generic function | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:2:16: error: @Frame() of generic function | 14 | // tmp.zig:2:16: error: @Frame() of generic function |
test/compile_errors/stage1/obj/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig+3-1| ... | @@ -8,7 +8,9 @@ export fn f2(x: V(4, u32)) V(4, u32) { | ... | @@ -8,7 +8,9 @@ export fn f2(x: V(4, u32)) V(4, u32) { |
| 8 | return -y; | 8 | return -y; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // Issue #5586: Make unary minus for unsigned types a compile error | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:3:12: error: negation of type 'u32' | 15 | // tmp.zig:3:12: error: negation of type 'u32' |
| 14 | // tmp.zig:8:12: error: negation of type 'u32' | 16 | // tmp.zig:8:12: error: negation of type 'u32' |
test/compile_errors/stage1/obj/Issue_6823_dont_allow_._to_be_followed_by_.zig+3-1| ... | @@ -3,6 +3,8 @@ fn foo() void { | ... | @@ -3,6 +3,8 @@ fn foo() void { |
| 3 | _ = sequence; | 3 | _ = sequence; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // Issue #6823: don't allow .* to be followed by ** | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:28: error: '.*' cannot be followed by '*'. Are you missing a space? | 10 | // tmp.zig:2:28: error: '.*' cannot be followed by '*'. Are you missing a space? |
test/compile_errors/stage1/obj/Issue_9165_windows_tcp_server_compilation_error.zig+3-1| ... | @@ -9,6 +9,8 @@ pub fn main() !void { | ... | @@ -9,6 +9,8 @@ pub fn main() !void { |
| 9 | } | 9 | } |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // Issue #9165: windows tcp server compilation error | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // error: Unsupported OS | 16 | // error: Unsupported OS |
test/compile_errors/stage1/obj/access_non-existent_member_of_error_set.zig+3-1| ... | @@ -4,6 +4,8 @@ comptime { | ... | @@ -4,6 +4,8 @@ comptime { |
| 4 | _ = z; | 4 | _ = z; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // access non-existent member of error set | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:18: error: no error named 'Bar' in 'Foo' | 11 | // tmp.zig:3:18: error: no error named 'Bar' in 'Foo' |
test/compile_errors/stage1/obj/accessing_runtime_parameter_from_outer_function.zig+3-1| ... | @@ -12,7 +12,9 @@ export fn entry() void { | ... | @@ -12,7 +12,9 @@ export fn entry() void { |
| 12 | _ = x; | 12 | _ = x; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // accessing runtime parameter from outer function | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:4:24: error: 'y' not accessible from inner function | 19 | // tmp.zig:4:24: error: 'y' not accessible from inner function |
| 18 | // tmp.zig:3:28: note: crossed function definition here | 20 | // tmp.zig:3:28: note: crossed function definition here |
test/compile_errors/stage1/obj/add_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a += a; | 3 | a += a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // add assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/add_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a + a; | 3 | _ = a + a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // add on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/add_overflow_in_function_evaluation.zig+3-1| ... | @@ -5,6 +5,8 @@ fn add(a: u16, b: u16) u16 { | ... | @@ -5,6 +5,8 @@ fn add(a: u16, b: u16) u16 { |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } |
| 7 | 7 | ||
| 8 | // add overflow in function evaluation | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:14: error: operation caused overflow | 12 | // tmp.zig:3:14: error: operation caused overflow |
test/compile_errors/stage1/obj/add_wrap_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a +%= a; | 3 | a +%= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // add wrap assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/add_wrap_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a +% a; | 3 | _ = a +% a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // add wrap on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/addition_with_non_numbers.zig+3-1| ... | @@ -5,6 +5,8 @@ const x = Foo {.field = 1} + Foo {.field = 2}; | ... | @@ -5,6 +5,8 @@ const x = Foo {.field = 1} + Foo {.field = 2}; |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } |
| 7 | 7 | ||
| 8 | // addition with non numbers | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:28: error: invalid operands to binary expression: 'Foo' and 'Foo' | 12 | // tmp.zig:4:28: error: invalid operands to binary expression: 'Foo' and 'Foo' |
test/compile_errors/stage1/obj/address_of_number_literal.zig+3-1| ... | @@ -3,6 +3,8 @@ const y = &x; | ... | @@ -3,6 +3,8 @@ const y = &x; |
| 3 | fn foo() *const i32 { return y; } | 3 | fn foo() *const i32 { return y; } |
| 4 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 4 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 5 | 5 | ||
| 6 | // address of number literal | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:30: error: expected type '*const i32', found '*const comptime_int' | 10 | // tmp.zig:3:30: error: expected type '*const i32', found '*const comptime_int' |
test/compile_errors/stage1/obj/alignCast_expects_pointer_or_slice.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | @alignCast(4, @as(u32, 3)); | 2 | @alignCast(4, @as(u32, 3)); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @alignCast expects pointer or slice | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:19: error: expected pointer or slice, found 'u32' | 9 | // tmp.zig:2:19: error: expected pointer or slice, found 'u32' |
test/compile_errors/stage1/obj/align_n_expr_function_pointers_is_a_compile_error.zig created+9| ... | @@ -0,0 +1,9 @@ | ||
| 1 | export fn foo() align(1) void { | ||
| 2 | return; | ||
| 3 | } | ||
| 4 | |||
| 5 | // error | ||
| 6 | // backend=stage1 | ||
| 7 | // target=wasm32-freestanding-none | ||
| 8 | // | ||
| 9 | // tmp.zig:1:23: error: align(N) expr is not allowed on function prototypes in wasm32/wasm64 | ||
test/compile_errors/stage1/obj/aligned_variable_of_zero-bit_type.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn f() void { | ... | @@ -3,6 +3,8 @@ export fn f() void { |
| 3 | _ = s; | 3 | _ = s; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // aligned variable of zero-bit type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned | 10 | // tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned |
test/compile_errors/stage1/obj/alignment_of_enum_field_specified.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry1() void { | ... | @@ -7,6 +7,8 @@ export fn entry1() void { |
| 7 | _ = x; | 7 | _ = x; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // alignment of enum field specified | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:7: error: expected ',' after field | 14 | // tmp.zig:3:7: error: expected ',' after field |
test/compile_errors/stage1/obj/ambiguous_decl_reference.zig+3-1| ... | @@ -12,7 +12,9 @@ export fn entry() void { | ... | @@ -12,7 +12,9 @@ export fn entry() void { |
| 12 | bar(); | 12 | bar(); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // ambiguous decl reference | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:5:13: error: ambiguous reference | 19 | // tmp.zig:5:13: error: ambiguous reference |
| 18 | // tmp.zig:7:9: note: declared here | 20 | // tmp.zig:7:9: note: declared here |
test/compile_errors/stage1/obj/and_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a and a; | 3 | _ = a and a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // and on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/array_access_of_non_array.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn g() void { | ... | @@ -7,7 +7,9 @@ export fn g() void { |
| 7 | _ = bad[0]; | 7 | _ = bad[0]; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // array access of non array | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:8: error: array access of non-array type 'bool' | 14 | // tmp.zig:3:8: error: array access of non-array type 'bool' |
| 13 | // tmp.zig:7:12: error: array access of non-array type 'bool' | 15 | // tmp.zig:7:12: error: array access of non-array type 'bool' |
test/compile_errors/stage1/obj/array_access_of_type.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | _ = b; | 3 | _ = b; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // array access of type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:14: error: array access of non-array type 'type' | 10 | // tmp.zig:2:14: error: array access of non-array type 'type' |
test/compile_errors/stage1/obj/array_access_of_undeclared_identifier.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn f() void { | ... | @@ -2,6 +2,8 @@ export fn f() void { |
| 2 | i[i] = i[i]; | 2 | i[i] = i[i]; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // array access of undeclared identifier | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: use of undeclared identifier 'i' | 9 | // tmp.zig:2:5: error: use of undeclared identifier 'i' |
test/compile_errors/stage1/obj/array_access_with_non_integer_index.zig+3-1| ... | @@ -9,7 +9,9 @@ export fn g() void { | ... | @@ -9,7 +9,9 @@ export fn g() void { |
| 9 | _ = array[bad]; | 9 | _ = array[bad]; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // array access with non integer index | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:4:11: error: expected type 'usize', found 'bool' | 16 | // tmp.zig:4:11: error: expected type 'usize', found 'bool' |
| 15 | // tmp.zig:9:15: error: expected type 'usize', found 'bool' | 17 | // tmp.zig:9:15: error: expected type 'usize', found 'bool' |
test/compile_errors/stage1/obj/array_concatenation_with_wrong_type.zig+3-1| ... | @@ -4,6 +4,8 @@ const a = derp ++ "foo"; | ... | @@ -4,6 +4,8 @@ const a = derp ++ "foo"; |
| 4 | 4 | ||
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 5 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } |
| 6 | 6 | ||
| 7 | // array concatenation with wrong type | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:11: error: expected array, found 'usize' | 11 | // tmp.zig:3:11: error: expected array, found 'usize' |
test/compile_errors/stage1/obj/array_in_c_exported_function.zig+3-1| ... | @@ -6,7 +6,9 @@ export fn zig_return_array() [10]u8 { | ... | @@ -6,7 +6,9 @@ export fn zig_return_array() [10]u8 { |
| 6 | return "1234567890".*; | 6 | return "1234567890".*; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // array in c exported function | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:1:24: error: parameter of type '[10]u8' not allowed in function with calling convention 'C' | 13 | // tmp.zig:1:24: error: parameter of type '[10]u8' not allowed in function with calling convention 'C' |
| 12 | // tmp.zig:5:30: error: return type '[10]u8' not allowed in function with calling convention 'C' | 14 | // tmp.zig:5:30: error: return type '[10]u8' not allowed in function with calling convention 'C' |
test/compile_errors/stage1/obj/asm_at_compile_time.zig+3-1| ... | @@ -10,6 +10,8 @@ fn doSomeAsm() void { | ... | @@ -10,6 +10,8 @@ fn doSomeAsm() void { |
| 10 | ); | 10 | ); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // asm at compile time | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:6:5: error: unable to evaluate constant expression | 17 | // tmp.zig:6:5: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/assign_inline_fn_to_non-comptime_var.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn entry() void { | ... | @@ -4,7 +4,9 @@ export fn entry() void { |
| 4 | } | 4 | } |
| 5 | fn b() callconv(.Inline) void { } | 5 | fn b() callconv(.Inline) void { } |
| 6 | 6 | ||
| 7 | // assign inline fn to non-comptime var | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var | 11 | // tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var |
| 10 | // tmp.zig:5:1: note: declared here | 12 | // tmp.zig:5:1: note: declared here |
test/compile_errors/stage1/obj/assign_null_to_non-optional_pointer.zig+3-1| ... | @@ -2,6 +2,8 @@ const a: *u8 = null; | ... | @@ -2,6 +2,8 @@ const a: *u8 = null; |
| 2 | 2 | ||
| 3 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 3 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } |
| 4 | 4 | ||
| 5 | // assign null to non-optional pointer | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:1:16: error: expected type '*u8', found '@Type(.Null)' | 9 | // tmp.zig:1:16: error: expected type '*u8', found '@Type(.Null)' |
test/compile_errors/stage1/obj/assign_through_constant_pointer.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn f() void { | ... | @@ -3,6 +3,8 @@ export fn f() void { |
| 3 | cstr[0] = 'W'; | 3 | cstr[0] = 'W'; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // assign through constant pointer | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:13: error: cannot assign to constant | 10 | // tmp.zig:3:13: error: cannot assign to constant |
test/compile_errors/stage1/obj/assign_through_constant_slice.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn f() void { | ... | @@ -3,6 +3,8 @@ export fn f() void { |
| 3 | cstr[0] = 'W'; | 3 | cstr[0] = 'W'; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // assign through constant slice | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:13: error: cannot assign to constant | 10 | // tmp.zig:3:13: error: cannot assign to constant |
test/compile_errors/stage1/obj/assign_to_constant_field.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn derp() void { | ... | @@ -6,6 +6,8 @@ export fn derp() void { |
| 6 | f.field = 0; | 6 | f.field = 0; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // assign to constant field | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:6:15: error: cannot assign to constant | 13 | // tmp.zig:6:15: error: cannot assign to constant |
test/compile_errors/stage1/obj/assign_to_constant_variable.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn f() void { | ... | @@ -3,6 +3,8 @@ export fn f() void { |
| 3 | a = 4; | 3 | a = 4; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // assign to constant variable | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: cannot assign to constant | 10 | // tmp.zig:3:9: error: cannot assign to constant |
test/compile_errors/stage1/obj/assign_to_invalid_dereference.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | 'a'.* = 1; | 2 | 'a'.* = 1; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // assign to invalid dereference | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:8: error: attempt to dereference non-pointer type 'comptime_int' | 9 | // tmp.zig:2:8: error: attempt to dereference non-pointer type 'comptime_int' |
test/compile_errors/stage1/obj/assign_too_big_number_to_u16.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | _ = vga_mem; | 3 | _ = vga_mem; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // assign too big number to u16 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:24: error: integer value 753664 cannot be coerced to type 'u16' | 10 | // tmp.zig:2:24: error: integer value 753664 cannot be coerced to type 'u16' |
test/compile_errors/stage1/obj/assign_unreachable.zig+3-1| ... | @@ -2,7 +2,9 @@ export fn f() void { | ... | @@ -2,7 +2,9 @@ export fn f() void { |
| 2 | const a = return; | 2 | const a = return; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // assign unreachable | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: unreachable code | 9 | // tmp.zig:2:5: error: unreachable code |
| 8 | // tmp.zig:2:15: note: control flow is diverted here | 10 | // tmp.zig:2:15: note: control flow is diverted here |
test/compile_errors/stage1/obj/assigning_to_struct_or_union_fields_that_are_not_optionals_with_a_function_that_returns_an_optional.zig+3-1| ... | @@ -14,6 +14,8 @@ export fn entry() void { | ... | @@ -14,6 +14,8 @@ export fn entry() void { |
| 14 | _ = s; | 14 | _ = s; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // assigning to struct or union fields that are not optionals with a function that returns an optional | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:11:27: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'u8', found '?u8' | 21 | // tmp.zig:11:27: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'u8', found '?u8' |
test/compile_errors/stage1/obj/async_function_depends_on_its_own_frame.zig+3-1| ... | @@ -6,6 +6,8 @@ fn amain() callconv(.Async) void { | ... | @@ -6,6 +6,8 @@ fn amain() callconv(.Async) void { |
| 6 | _ = x; | 6 | _ = x; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // async function depends on its own frame | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet | 13 | // tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet |
test/compile_errors/stage1/obj/async_function_indirectly_depends_on_its_own_frame.zig+3-1| ... | @@ -9,7 +9,9 @@ fn other() void { | ... | @@ -9,7 +9,9 @@ fn other() void { |
| 9 | _ = x; | 9 | _ = x; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // async function indirectly depends on its own frame | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:4:1: error: unable to determine async function frame of 'amain' | 16 | // tmp.zig:4:1: error: unable to determine async function frame of 'amain' |
| 15 | // tmp.zig:5:10: note: analysis of function 'other' depends on the frame | 17 | // tmp.zig:5:10: note: analysis of function 'other' depends on the frame |
test/compile_errors/stage1/obj/atomic_orderings_of_atomicStore_Acquire_or_AcqRel.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | @atomicStore(u32, &x, 1, .Acquire); | 3 | @atomicStore(u32, &x, 1, .Acquire); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // atomic orderings of atomicStore Acquire or AcqRel | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:30: error: @atomicStore atomic ordering must not be Acquire or AcqRel | 10 | // tmp.zig:3:30: error: @atomicStore atomic ordering must not be Acquire or AcqRel |
test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-failure_stricter_than_success.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn f() void { | ... | @@ -4,6 +4,8 @@ export fn f() void { |
| 4 | while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {} | 4 | while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {} |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // atomic orderings of cmpxchg - failure stricter than success | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:4:81: error: failure atomic ordering must be no stricter than success | 11 | // tmp.zig:4:81: error: failure atomic ordering must be no stricter than success |
test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-success_Monotonic_or_stricter.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn f() void { | ... | @@ -4,6 +4,8 @@ export fn f() void { |
| 4 | while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {} | 4 | while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {} |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // atomic orderings of cmpxchg - success Monotonic or stricter | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:4:58: error: success atomic ordering must be Monotonic or stricter | 11 | // tmp.zig:4:58: error: success atomic ordering must be Monotonic or stricter |
test/compile_errors/stage1/obj/atomic_orderings_of_fence_Acquire_or_stricter.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | @fence(.Monotonic); | 2 | @fence(.Monotonic); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // atomic orderings of fence Acquire or stricter | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:12: error: atomic ordering must be Acquire or stricter | 9 | // tmp.zig:2:12: error: atomic ordering must be Acquire or stricter |
test/compile_errors/stage1/obj/atomicrmw_with_bool_op_not_.Xchg.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = @atomicRmw(bool, &x, .Add, true, .SeqCst); | 3 | _ = @atomicRmw(bool, &x, .Add, true, .SeqCst); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // atomicrmw with bool op not .Xchg | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:30: error: @atomicRmw with bool only allowed with .Xchg | 10 | // tmp.zig:3:30: error: @atomicRmw with bool only allowed with .Xchg |
test/compile_errors/stage1/obj/atomicrmw_with_enum_op_not_.Xchg.zig+3-1| ... | @@ -9,6 +9,8 @@ export fn entry() void { | ... | @@ -9,6 +9,8 @@ export fn entry() void { |
| 9 | _ = @atomicRmw(E, &x, .Add, .b, .SeqCst); | 9 | _ = @atomicRmw(E, &x, .Add, .b, .SeqCst); |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // atomicrmw with enum op not .Xchg | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:9:27: error: @atomicRmw with enum only allowed with .Xchg | 16 | // tmp.zig:9:27: error: @atomicRmw with enum only allowed with .Xchg |
test/compile_errors/stage1/obj/atomicrmw_with_float_op_not_.Xchg_.Add_or_.Sub.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = @atomicRmw(f32, &x, .And, 2, .SeqCst); | 3 | _ = @atomicRmw(f32, &x, .And, 2, .SeqCst); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // atomicrmw with float op not .Xchg, .Add or .Sub | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:29: error: @atomicRmw with float only allowed with .Xchg, .Add and .Sub | 10 | // tmp.zig:3:29: error: @atomicRmw with float only allowed with .Xchg, .Add and .Sub |
test/compile_errors/stage1/obj/attempt_to_cast_enum_literal_to_error.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | } | 4 | } |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // attempt to cast enum literal to error | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:9: error: expected type 'error{Hi}', found '@Type(.EnumLiteral)' | 11 | // tmp.zig:3:9: error: expected type 'error{Hi}', found '@Type(.EnumLiteral)' |
test/compile_errors/stage1/obj/attempt_to_close_over_comptime_variable_from_outer_scope.zig+3-1| ... | @@ -5,7 +5,9 @@ fn SimpleList(comptime L: usize) type { | ... | @@ -5,7 +5,9 @@ fn SimpleList(comptime L: usize) type { |
| 5 | }; | 5 | }; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // attempt to close over comptime variable from outer scope | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:19: error: mutable 'T' not accessible from here | 12 | // tmp.zig:4:19: error: mutable 'T' not accessible from here |
| 11 | // tmp.zig:2:9: note: declared mutable here | 13 | // tmp.zig:2:9: note: declared mutable here |
test/compile_errors/stage1/obj/attempt_to_create_17_bit_float_type.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = @Type(.{ .Float = .{ .bits = 17 } }); | 3 | _ = @Type(.{ .Float = .{ .bits = 17 } }); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // attempt to create 17 bit float type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:16: error: 17-bit float unsupported | 10 | // tmp.zig:3:16: error: 17-bit float unsupported |
test/compile_errors/stage1/obj/attempt_to_negate_a_non-integer_non-float_or_non-vector_type.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry() void { | ... | @@ -7,6 +7,8 @@ export fn entry() void { |
| 7 | _ = x; | 7 | _ = x; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // attempt to negate a non-integer, non-float or non-vector type | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:6:15: error: negation of type 'anyerror!u32' | 14 | // tmp.zig:6:15: error: negation of type 'anyerror!u32' |
test/compile_errors/stage1/obj/attempt_to_use_0_bit_type_in_extern_fn.zig+3-1| ... | @@ -9,7 +9,9 @@ export fn entry2() void { | ... | @@ -9,7 +9,9 @@ export fn entry2() void { |
| 9 | bar(&{}); | 9 | bar(&{}); |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // attempt to use 0 bit type in extern fn | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C' | 16 | // tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C' |
| 15 | // tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C' | 17 | // tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C' |
test/compile_errors/stage1/obj/attempted_double_ampersand.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry(a: bool, b: bool) i32 { | ... | @@ -5,6 +5,8 @@ export fn entry(a: bool, b: bool) i32 { |
| 5 | return 5678; | 5 | return 5678; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // attempted `&&` | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:2:11: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND | 12 | // tmp.zig:2:11: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND |
test/compile_errors/stage1/obj/attempted_double_pipe_on_boolean_values.zig+3-1| ... | @@ -5,7 +5,9 @@ export fn entry(a: bool, b: bool) i32 { | ... | @@ -5,7 +5,9 @@ export fn entry(a: bool, b: bool) i32 { |
| 5 | return 5678; | 5 | return 5678; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // attempted `||` on boolean values | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:2:9: error: expected error set type, found 'bool' | 12 | // tmp.zig:2:9: error: expected error set type, found 'bool' |
| 11 | // tmp.zig:2:11: note: `||` merges error sets; `or` performs boolean OR | 13 | // tmp.zig:2:11: note: `||` merges error sets; `or` performs boolean OR |
test/compile_errors/stage1/obj/attempted_implicit_cast_from_T_to_slice_const_T.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // attempted implicit cast from T to [*]const T | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:30: error: expected type '[*]const bool', found 'bool' | 10 | // tmp.zig:2:30: error: expected type '[*]const bool', found 'bool' |
test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_array_len_1_T.zig+3-1| ... | @@ -6,7 +6,9 @@ export fn entry(byte: u8) void { | ... | @@ -6,7 +6,9 @@ export fn entry(byte: u8) void { |
| 6 | _ = byte; | 6 | _ = byte; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // attempted implicit cast from *const T to *[1]T | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32' | 13 | // tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32' |
| 12 | // tmp.zig:4:22: note: cast discards const qualifier | 14 | // tmp.zig:4:22: note: cast discards const qualifier |
test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_sliceT.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | _ = x; | 4 | _ = x; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // attempted implicit cast from *const T to []T | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:23: error: expected type '[]u32', found '*const u32' | 11 | // tmp.zig:3:23: error: expected type '[]u32', found '*const u32' |
test/compile_errors/stage1/obj/bad_alignCast_at_comptime.zig+3-1| ... | @@ -4,6 +4,8 @@ comptime { | ... | @@ -4,6 +4,8 @@ comptime { |
| 4 | _ = aligned; | 4 | _ = aligned; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // bad @alignCast at comptime | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:35: error: pointer address 0x1 is not aligned to 4 bytes | 11 | // tmp.zig:3:35: error: pointer address 0x1 is not aligned to 4 bytes |
test/compile_errors/stage1/obj/bad_alignment_in_asynccall.zig created+12| ... | @@ -0,0 +1,12 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | var ptr: fn () callconv(.Async) void = func; | ||
| 3 | var bytes: [64]u8 = undefined; | ||
| 4 | _ = @asyncCall(&bytes, {}, ptr, .{}); | ||
| 5 | } | ||
| 6 | fn func() callconv(.Async) void {} | ||
| 7 | |||
| 8 | // error | ||
| 9 | // backend=stage1 | ||
| 10 | // target=aarch64-linux-none | ||
| 11 | // | ||
| 12 | // tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8' | ||
test/compile_errors/stage1/obj/bad_alignment_in_implicit_cast_from_array_pointer_to_slice.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn a() void { | ... | @@ -4,6 +4,8 @@ export fn a() void { |
| 4 | _ = y; | 4 | _ = y; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // bad alignment in implicit cast from array pointer to slice | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:30: error: expected type '[]align(16) u8', found '*[10]u8' | 11 | // tmp.zig:3:30: error: expected type '[]align(16) u8', found '*[10]u8' |
test/compile_errors/stage1/obj/bad_alignment_type.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry2() void { | ... | @@ -7,7 +7,9 @@ export fn entry2() void { |
| 7 | _ = x; | 7 | _ = x; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // bad alignment type | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:2:20: error: expected type 'u29', found 'bool' | 14 | // tmp.zig:2:20: error: expected type 'u29', found 'bool' |
| 13 | // tmp.zig:6:19: error: fractional component prevents float value 12.340000 from being casted to type 'u29' | 15 | // tmp.zig:6:19: error: fractional component prevents float value 12.340000 from being casted to type 'u29' |
test/compile_errors/stage1/obj/bad_identifier_in_function_with_struct_defined_inside_function_which_references_local_const.zig+3-1| ... | @@ -10,6 +10,8 @@ export fn entry() void { | ... | @@ -10,6 +10,8 @@ export fn entry() void { |
| 10 | _ = Block; | 10 | _ = Block; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // bad identifier in function with struct defined inside function which references local const | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:8:5: error: use of undeclared identifier 'bogus' | 17 | // tmp.zig:8:5: error: use of undeclared identifier 'bogus' |
test/compile_errors/stage1/obj/bad_import.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | const bogus = @import("bogus-does-not-exist.zig",); | 1 | const bogus = @import("bogus-does-not-exist.zig",); |
| 2 | 2 | ||
| 3 | // bad import | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:23: error: unable to load '${DIR}bogus-does-not-exist.zig': FileNotFound | 7 | // tmp.zig:1:23: error: unable to load '${DIR}bogus-does-not-exist.zig': FileNotFound |
test/compile_errors/stage1/obj/bad_usage_of_call.zig+3-1| ... | @@ -19,7 +19,9 @@ fn bar() callconv(.Inline) void {} | ... | @@ -19,7 +19,9 @@ fn bar() callconv(.Inline) void {} |
| 19 | fn baz1() void {} | 19 | fn baz1() void {} |
| 20 | fn baz2() void {} | 20 | fn baz2() void {} |
| 21 | 21 | ||
| 22 | // bad usage of @call | 22 | // error |
| 23 | // backend=stage1 | ||
| 24 | // target=native | ||
| 23 | // | 25 | // |
| 24 | // tmp.zig:2:21: error: expected tuple or struct, found 'void' | 26 | // tmp.zig:2:21: error: expected tuple or struct, found 'void' |
| 25 | // tmp.zig:5:14: error: unable to perform 'never_inline' call at compile-time | 27 | // tmp.zig:5:14: error: unable to perform 'never_inline' call at compile-time |
test/compile_errors/stage1/obj/bin_and_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a &= a; | 3 | a &= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bin and assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/bin_and_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a & a; | 3 | _ = a & a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bin and on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/bin_not_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = ~a; | 3 | _ = ~a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bin not on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:10: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:10: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/bin_or_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a |= a; | 3 | a |= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bin or assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/bin_or_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a | a; | 3 | _ = a | a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bin or on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/bin_xor_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a ^= a; | 3 | a ^= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bin xor assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/bin_xor_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a ^ a; | 3 | _ = a ^ a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bin xor on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/binary_not_on_number_literal.zig+3-1| ... | @@ -4,6 +4,8 @@ var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE - | ... | @@ -4,6 +4,8 @@ var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE - |
| 4 | 4 | ||
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(block_aligned_stuff)); } | 5 | export fn entry() usize { return @sizeOf(@TypeOf(block_aligned_stuff)); } |
| 6 | 6 | ||
| 7 | // binary not on number literal | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:60: error: unable to perform binary not operation on type 'comptime_int' | 11 | // tmp.zig:3:60: error: unable to perform binary not operation on type 'comptime_int' |
test/compile_errors/stage1/obj/bitCast_same_size_but_bit_count_mismatch.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry(byte: u8) void { | ... | @@ -3,6 +3,8 @@ export fn entry(byte: u8) void { |
| 3 | _ = oops; | 3 | _ = oops; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @bitCast same size but bit count mismatch | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:25: error: destination type 'u7' has 7 bits but source type 'u8' has 8 bits | 10 | // tmp.zig:2:25: error: destination type 'u7' has 7 bits but source type 'u8' has 8 bits |
test/compile_errors/stage1/obj/bitCast_to_enum_type.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = y; | 3 | _ = y; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bitCast to enum type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:24: error: cannot cast a value of type 'y' | 10 | // tmp.zig:2:24: error: cannot cast a value of type 'y' |
test/compile_errors/stage1/obj/bitCast_with_different_sizes_inside_an_expression.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = foo; | 3 | _ = foo; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @bitCast with different sizes inside an expression | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:25: error: destination type 'u8' has size 1 but source type 'f32' has size 4 | 10 | // tmp.zig:2:25: error: destination type 'u8' has size 1 but source type 'f32' has size 4 |
test/compile_errors/stage1/obj/bit_shifting_only_works_on_integer_types.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bit shifting only works on integer types | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:16: error: bit shifting operation expected integer type, found '*const u8' | 10 | // tmp.zig:2:16: error: bit shifting operation expected integer type, found '*const u8' |
test/compile_errors/stage1/obj/bogus_compile_var.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const x = @import("builtin").bogus; | 1 | const x = @import("builtin").bogus; |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } | 2 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } |
| 3 | 3 | ||
| 4 | // bogus compile var | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:29: error: container 'builtin' has no member called 'bogus' | 8 | // tmp.zig:1:29: error: container 'builtin' has no member called 'bogus' |
test/compile_errors/stage1/obj/bogus_method_call_on_slice.zig+3-1| ... | @@ -4,6 +4,8 @@ fn f(m: []const u8) void { | ... | @@ -4,6 +4,8 @@ fn f(m: []const u8) void { |
| 4 | } | 4 | } |
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 5 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 6 | 6 | ||
| 7 | // bogus method call on slice | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:6: error: no member named 'copy' in '[]const u8' | 11 | // tmp.zig:3:6: error: no member named 'copy' in '[]const u8' |
test/compile_errors/stage1/obj/bool_not_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = !a; | 3 | _ = !a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // bool not on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:10: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:10: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/branch_on_undefined_value.zig+3-1| ... | @@ -2,6 +2,8 @@ const x = if (undefined) true else false; | ... | @@ -2,6 +2,8 @@ const x = if (undefined) true else false; |
| 2 | 2 | ||
| 3 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } | 3 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } |
| 4 | 4 | ||
| 5 | // branch on undefined value | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:1:15: error: use of undefined value here causes undefined behavior | 9 | // tmp.zig:1:15: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/cImport_with_bogus_include.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | const c = @cImport(@cInclude("bogus.h")); | 1 | const c = @cImport(@cInclude("bogus.h")); |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(c.bogo)); } | 2 | export fn entry() usize { return @sizeOf(@TypeOf(c.bogo)); } |
| 3 | 3 | ||
| 4 | // @cImport with bogus include | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:11: error: C import failed | 8 | // tmp.zig:1:11: error: C import failed |
| 7 | // .h:1:10: note: 'bogus.h' file not found | 9 | // .h:1:10: note: 'bogus.h' file not found |
test/compile_errors/stage1/obj/call_assigned_to_constant.zig+3-1| ... | @@ -16,7 +16,9 @@ export fn entry1() void { | ... | @@ -16,7 +16,9 @@ export fn entry1() void { |
| 16 | baz = bar(42); | 16 | baz = bar(42); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | // call assigned to constant | 19 | // error |
| 20 | // backend=stage1 | ||
| 21 | // target=native | ||
| 20 | // | 22 | // |
| 21 | // tmp.zig:12:14: error: cannot assign to constant | 23 | // tmp.zig:12:14: error: cannot assign to constant |
| 22 | // tmp.zig:16:14: error: cannot assign to constant | 24 | // tmp.zig:16:14: error: cannot assign to constant |
test/compile_errors/stage1/obj/call_with_new_stack_on_unsupported_target.zig created+11| ... | @@ -0,0 +1,11 @@ | ||
| 1 | var buf: [10]u8 align(16) = undefined; | ||
| 2 | export fn entry() void { | ||
| 3 | @call(.{ .stack = &buf }, foo, .{}); | ||
| 4 | } | ||
| 5 | fn foo() void {} | ||
| 6 | |||
| 7 | // error | ||
| 8 | // backend=stage1 | ||
| 9 | // target=wasm32-wasi-none | ||
| 10 | // | ||
| 11 | // tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack | ||
test/compile_errors/stage1/obj/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig created+11| ... | @@ -0,0 +1,11 @@ | ||
| 1 | export fn entry1() callconv(.APCS) void {} | ||
| 2 | export fn entry2() callconv(.AAPCS) void {} | ||
| 3 | export fn entry3() callconv(.AAPCSVFP) void {} | ||
| 4 | |||
| 5 | // error | ||
| 6 | // backend=stage1 | ||
| 7 | // target=x86_64-linux-none | ||
| 8 | // | ||
| 9 | // tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64 | ||
| 10 | // tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64 | ||
| 11 | // tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64 | ||
test/compile_errors/stage1/obj/callconv_interrupt_on_unsupported_platform.zig created+7| ... | @@ -0,0 +1,7 @@ | ||
| 1 | export fn entry() callconv(.Interrupt) void {} | ||
| 2 | |||
| 3 | // error | ||
| 4 | // backend=stage1 | ||
| 5 | // target=aarch64-linux-none | ||
| 6 | // | ||
| 7 | // tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64 | ||
test/compile_errors/stage1/obj/callconv_signal_on_unsupported_platform.zig created+7| ... | @@ -0,0 +1,7 @@ | ||
| 1 | export fn entry() callconv(.Signal) void {} | ||
| 2 | |||
| 3 | // error | ||
| 4 | // backend=stage1 | ||
| 5 | // target=x86_64-linux-none | ||
| 6 | // | ||
| 7 | // tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64 | ||
test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-0.zig created+23| ... | @@ -0,0 +1,23 @@ | ||
| 1 | const F1 = fn () callconv(.Stdcall) void; | ||
| 2 | const F2 = fn () callconv(.Fastcall) void; | ||
| 3 | const F3 = fn () callconv(.Thiscall) void; | ||
| 4 | export fn entry1() void { | ||
| 5 | var a: F1 = undefined; | ||
| 6 | _ = a; | ||
| 7 | } | ||
| 8 | export fn entry2() void { | ||
| 9 | var a: F2 = undefined; | ||
| 10 | _ = a; | ||
| 11 | } | ||
| 12 | export fn entry3() void { | ||
| 13 | var a: F3 = undefined; | ||
| 14 | _ = a; | ||
| 15 | } | ||
| 16 | |||
| 17 | // error | ||
| 18 | // backend=stage1 | ||
| 19 | // target=x86_64-linux-none | ||
| 20 | // | ||
| 21 | // tmp.zig:1:27: error: callconv 'Stdcall' is only available on x86, not x86_64 | ||
| 22 | // tmp.zig:2:27: error: callconv 'Fastcall' is only available on x86, not x86_64 | ||
| 23 | // tmp.zig:3:27: error: callconv 'Thiscall' is only available on x86, not x86_64 | ||
test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-1.zig created+11| ... | @@ -0,0 +1,11 @@ | ||
| 1 | export fn entry1() callconv(.Stdcall) void {} | ||
| 2 | export fn entry2() callconv(.Fastcall) void {} | ||
| 3 | export fn entry3() callconv(.Thiscall) void {} | ||
| 4 | |||
| 5 | // error | ||
| 6 | // backend=stage1 | ||
| 7 | // target=x86_64-linux-none | ||
| 8 | // | ||
| 9 | // tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64 | ||
| 10 | // tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64 | ||
| 11 | // tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64 | ||
test/compile_errors/stage1/obj/callconv_vectorcall_on_unsupported_platform.zig created+7| ... | @@ -0,0 +1,7 @@ | ||
| 1 | export fn entry() callconv(.Vectorcall) void {} | ||
| 2 | |||
| 3 | // error | ||
| 4 | // backend=stage1 | ||
| 5 | // target=x86_64-linux-none | ||
| 6 | // | ||
| 7 | // tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64 | ||
test/compile_errors/stage1/obj/calling_a_generic_function_only_known_at_runtime.zig+3-1| ... | @@ -7,6 +7,8 @@ pub fn main() !void { | ... | @@ -7,6 +7,8 @@ pub fn main() !void { |
| 7 | foos[0](true); | 7 | foos[0](true); |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // calling a generic function only known at runtime | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:7:9: error: calling a generic function requires compile-time known function value | 14 | // tmp.zig:7:9: error: calling a generic function requires compile-time known function value |
test/compile_errors/stage1/obj/calling_function_with_naked_calling_convention.zig+3-1| ... | @@ -3,7 +3,9 @@ export fn entry() void { | ... | @@ -3,7 +3,9 @@ export fn entry() void { |
| 3 | } | 3 | } |
| 4 | fn foo() callconv(.Naked) void { } | 4 | fn foo() callconv(.Naked) void { } |
| 5 | 5 | ||
| 6 | // calling function with naked calling convention | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:5: error: unable to call function with naked calling convention | 10 | // tmp.zig:2:5: error: unable to call function with naked calling convention |
| 9 | // tmp.zig:4:1: note: declared here | 11 | // tmp.zig:4:1: note: declared here |
test/compile_errors/stage1/obj/calling_var_args_extern_function_passing_array_instead_of_pointer.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | } | 3 | } |
| 4 | pub extern fn foo(format: *const u8, ...) void; | 4 | pub extern fn foo(format: *const u8, ...) void; |
| 5 | 5 | ||
| 6 | // calling var args extern function, passing array instead of pointer | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:16: error: expected type '*const u8', found '[5:0]u8' | 10 | // tmp.zig:2:16: error: expected type '*const u8', found '[5:0]u8' |
test/compile_errors/stage1/obj/cannot_break_out_of_defer_expression.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn foo() void { | ... | @@ -6,6 +6,8 @@ export fn foo() void { |
| 6 | } | 6 | } |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // cannot break out of defer expression | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:4:13: error: cannot break out of defer expression | 13 | // tmp.zig:4:13: error: cannot break out of defer expression |
test/compile_errors/stage1/obj/cannot_continue_out_of_defer_expression.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn foo() void { | ... | @@ -6,6 +6,8 @@ export fn foo() void { |
| 6 | } | 6 | } |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // cannot continue out of defer expression | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:4:13: error: cannot continue out of defer expression | 13 | // tmp.zig:4:13: error: cannot continue out of defer expression |
test/compile_errors/stage1/obj/capture_group_on_switch_prong_with_incompatible_payload_types.zig+3-1| ... | @@ -12,7 +12,9 @@ comptime { | ... | @@ -12,7 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // capture group on switch prong with incompatible payload types | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:8:20: error: capture group with incompatible types | 19 | // tmp.zig:8:20: error: capture group with incompatible types |
| 18 | // tmp.zig:8:9: note: type 'usize' here | 20 | // tmp.zig:8:9: note: type 'usize' here |
test/compile_errors/stage1/obj/cast_enum_literal_to_enum_but_it_doesnt_match.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | _ = x; | 7 | _ = x; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // cast enum literal to enum but it doesn't match | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:6:20: error: enum 'Foo' has no field named 'c' | 14 | // tmp.zig:6:20: error: enum 'Foo' has no field named 'c' |
| 13 | // tmp.zig:1:13: note: 'Foo' declared here | 15 | // tmp.zig:1:13: note: 'Foo' declared here |
test/compile_errors/stage1/obj/cast_error_union_of_global_error_set_to_error_union_of_smaller_error_set.zig+3-1| ... | @@ -7,7 +7,9 @@ fn foo() anyerror!i32 { | ... | @@ -7,7 +7,9 @@ fn foo() anyerror!i32 { |
| 7 | return error.B; | 7 | return error.B; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // cast error union of global error set to error union of smaller error set | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:35: error: expected type 'SmallErrorSet!i32', found 'anyerror!i32' | 14 | // tmp.zig:3:35: error: expected type 'SmallErrorSet!i32', found 'anyerror!i32' |
| 13 | // tmp.zig:3:35: note: error set 'anyerror' cannot cast into error set 'SmallErrorSet' | 15 | // tmp.zig:3:35: note: error set 'anyerror' cannot cast into error set 'SmallErrorSet' |
test/compile_errors/stage1/obj/cast_global_error_set_to_error_set.zig+3-1| ... | @@ -7,7 +7,9 @@ fn foo() anyerror { | ... | @@ -7,7 +7,9 @@ fn foo() anyerror { |
| 7 | return error.B; | 7 | return error.B; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // cast global error set to error set | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:31: error: expected type 'SmallErrorSet', found 'anyerror' | 14 | // tmp.zig:3:31: error: expected type 'SmallErrorSet', found 'anyerror' |
| 13 | // tmp.zig:3:31: note: cannot cast global error set into smaller set | 15 | // tmp.zig:3:31: note: cannot cast global error set into smaller set |
test/compile_errors/stage1/obj/cast_negative_integer_literal_to_usize.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // cast negative integer literal to usize | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:26: error: cannot cast negative value -10 to unsigned integer type 'usize' | 10 | // tmp.zig:2:26: error: cannot cast negative value -10 to unsigned integer type 'usize' |
test/compile_errors/stage1/obj/cast_negative_value_to_unsigned_integer.zig+3-1| ... | @@ -9,7 +9,9 @@ export fn entry1() void { | ... | @@ -9,7 +9,9 @@ export fn entry1() void { |
| 9 | _ = unsigned; | 9 | _ = unsigned; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // cast negative value to unsigned integer | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:3:22: error: attempt to cast negative value to unsigned integer | 16 | // tmp.zig:3:22: error: attempt to cast negative value to unsigned integer |
| 15 | // tmp.zig:8:27: error: cannot cast negative value -1 to unsigned integer type 'u32' | 17 | // tmp.zig:8:27: error: cannot cast negative value -1 to unsigned integer type 'u32' |
test/compile_errors/stage1/obj/cast_unreachable.zig+3-1| ... | @@ -3,7 +3,9 @@ fn f() i32 { | ... | @@ -3,7 +3,9 @@ fn f() i32 { |
| 3 | } | 3 | } |
| 4 | export fn entry() void { _ = f(); } | 4 | export fn entry() void { _ = f(); } |
| 5 | 5 | ||
| 6 | // cast unreachable | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:12: error: unreachable code | 10 | // tmp.zig:2:12: error: unreachable code |
| 9 | // tmp.zig:2:21: note: control flow is diverted here | 11 | // tmp.zig:2:21: note: control flow is diverted here |
test/compile_errors/stage1/obj/casting_bit_offset_pointer_to_regular_pointer.zig+3-1| ... | @@ -14,6 +14,8 @@ fn bar(x: *const u3) u3 { | ... | @@ -14,6 +14,8 @@ fn bar(x: *const u3) u3 { |
| 14 | 14 | ||
| 15 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 15 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 16 | 16 | ||
| 17 | // casting bit offset pointer to regular pointer | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:8:26: error: expected type '*const u3', found '*align(:3:1) const u3' | 21 | // tmp.zig:8:26: error: expected type '*const u3', found '*align(:3:1) const u3' |
test/compile_errors/stage1/obj/catch_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a catch false; | 3 | _ = a catch false; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // catch on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:11: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:11: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/chained_comparison_operators.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn a(value: u32) bool { | ... | @@ -2,6 +2,8 @@ export fn a(value: u32) bool { |
| 2 | return 1 < value < 1000; | 2 | return 1 < value < 1000; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // chained comparison operators | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:22: error: comparison operators cannot be chained | 9 | // tmp.zig:2:22: error: comparison operators cannot be chained |
test/compile_errors/stage1/obj/cmpxchg_with_float.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst); | 3 | _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // cmpxchg with float | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:22: error: expected bool, integer, enum or pointer type, found 'f32' | 10 | // tmp.zig:3:22: error: expected bool, integer, enum or pointer type, found 'f32' |
test/compile_errors/stage1/obj/colliding_invalid_top_level_functions.zig+3-1| ... | @@ -2,7 +2,9 @@ fn func() bogus {} | ... | @@ -2,7 +2,9 @@ fn func() bogus {} |
| 2 | fn func() bogus {} | 2 | fn func() bogus {} |
| 3 | export fn entry() usize { return @sizeOf(@TypeOf(func)); } | 3 | export fn entry() usize { return @sizeOf(@TypeOf(func)); } |
| 4 | 4 | ||
| 5 | // colliding invalid top level functions | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:1: error: redeclaration of 'func' | 9 | // tmp.zig:2:1: error: redeclaration of 'func' |
| 8 | // tmp.zig:1:1: note: other declaration here | 10 | // tmp.zig:1:1: note: other declaration here |
test/compile_errors/stage1/obj/compare_optional_to_non-optional_with_invalid_types.zig+3-1| ... | @@ -22,7 +22,9 @@ export fn invalidChildType() void { | ... | @@ -22,7 +22,9 @@ export fn invalidChildType() void { |
| 22 | _ = (x == y); | 22 | _ = (x == y); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | // compare optional to non-optional with invalid types | 25 | // error |
| 26 | // backend=stage1 | ||
| 27 | // target=native | ||
| 26 | // | 28 | // |
| 27 | // :4:12: error: cannot compare types '?i32' and 'comptime_int' | 29 | // :4:12: error: cannot compare types '?i32' and 'comptime_int' |
| 28 | // :4:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int' | 30 | // :4:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int' |
test/compile_errors/stage1/obj/comparing_a_non-optional_pointer_against_null.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = &x == null; | 3 | _ = &x == null; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // comparing a non-optional pointer against null | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:12: error: comparison of '*i32' with null | 10 | // tmp.zig:3:12: error: comparison of '*i32' with null |
test/compile_errors/stage1/obj/comparing_against_undefined_produces_undefined_value.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | if (2 == undefined) {} | 2 | if (2 == undefined) {} |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // comparing against undefined produces undefined value | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:11: error: use of undefined value here causes undefined behavior | 9 | // tmp.zig:2:11: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/comparison_operators_with_undefined_value.zig+3-1| ... | @@ -35,7 +35,9 @@ comptime { | ... | @@ -35,7 +35,9 @@ comptime { |
| 35 | if (a <= a) x += 1; | 35 | if (a <= a) x += 1; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | // comparison operators with undefined value | 38 | // error |
| 39 | // backend=stage1 | ||
| 40 | // target=native | ||
| 39 | // | 41 | // |
| 40 | // tmp.zig:5:11: error: use of undefined value here causes undefined behavior | 42 | // tmp.zig:5:11: error: use of undefined value here causes undefined behavior |
| 41 | // tmp.zig:11:11: error: use of undefined value here causes undefined behavior | 43 | // tmp.zig:11:11: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/comparison_with_error_union_and_error_value.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = number_or_error == error.SomethingAwful; | 3 | _ = number_or_error == error.SomethingAwful; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // comparison with error union and error value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:25: error: operator not allowed for type 'anyerror!i32' | 10 | // tmp.zig:3:25: error: operator not allowed for type 'anyerror!i32' |
test/compile_errors/stage1/obj/compile-time_division_by_zero.zig+3-1| ... | @@ -5,6 +5,8 @@ comptime { | ... | @@ -5,6 +5,8 @@ comptime { |
| 5 | _ = c; | 5 | _ = c; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // compile-time division by zero | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:17: error: division by zero | 12 | // tmp.zig:4:17: error: division by zero |
test/compile_errors/stage1/obj/compile-time_remainder_division_by_zero.zig+3-1| ... | @@ -5,6 +5,8 @@ comptime { | ... | @@ -5,6 +5,8 @@ comptime { |
| 5 | _ = c; | 5 | _ = c; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // compile-time remainder division by zero | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:17: error: division by zero | 12 | // tmp.zig:4:17: error: division by zero |
test/compile_errors/stage1/obj/compileError_shows_traceback_of_references_that_caused_it.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry() i32 { | ... | @@ -7,6 +7,8 @@ export fn entry() i32 { |
| 7 | return bar; | 7 | return bar; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // @compileError shows traceback of references that caused it | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:1:13: error: aoeu | 14 | // tmp.zig:1:13: error: aoeu |
test/compile_errors/stage1/obj/compileLog_of_tagged_enum_doesnt_crash_the_compiler.zig+3-1| ... | @@ -10,6 +10,8 @@ pub fn main () void { | ... | @@ -10,6 +10,8 @@ pub fn main () void { |
| 10 | comptime testCompileLog(Bar{.X = 123}); | 10 | comptime testCompileLog(Bar{.X = 123}); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // compileLog of tagged enum doesn't crash the compiler | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:6:5: error: found compile log statement | 17 | // tmp.zig:6:5: error: found compile log statement |
test/compile_errors/stage1/obj/compile_error_in_struct_init_expression.zig+3-1| ... | @@ -9,6 +9,8 @@ export fn entry() void { | ... | @@ -9,6 +9,8 @@ export fn entry() void { |
| 9 | _ = x; | 9 | _ = x; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // compile error in struct init expression | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:2:14: error: use of undeclared identifier 'crap' | 16 | // tmp.zig:2:14: error: use of undeclared identifier 'crap' |
test/compile_errors/stage1/obj/compile_error_when_evaluating_return_type_of_inferred_error_set.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry() void { | ... | @@ -7,6 +7,8 @@ export fn entry() void { |
| 7 | _ = car; | 7 | _ = car; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // compile error when evaluating return type of inferred error set | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:2:11: error: use of undeclared identifier 'SymbolThatDoesNotExist' | 14 | // tmp.zig:2:11: error: use of undeclared identifier 'SymbolThatDoesNotExist' |
test/compile_errors/stage1/obj/compile_log.zig+3-1| ... | @@ -7,7 +7,9 @@ fn bar(a: i32, b: []const u8) void { | ... | @@ -7,7 +7,9 @@ fn bar(a: i32, b: []const u8) void { |
| 7 | @compileLog("end",); | 7 | @compileLog("end",); |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // compile log | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:5: error: found compile log statement | 14 | // tmp.zig:5:5: error: found compile log statement |
| 13 | // tmp.zig:6:5: error: found compile log statement | 15 | // tmp.zig:6:5: error: found compile log statement |
test/compile_errors/stage1/obj/compile_log_a_pointer_to_an_opaque_value.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | @compileLog(@ptrCast(*const anyopaque, &entry)); | 2 | @compileLog(@ptrCast(*const anyopaque, &entry)); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // compile log a pointer to an opaque value | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: found compile log statement | 9 | // tmp.zig:2:5: error: found compile log statement |
test/compile_errors/stage1/obj/compile_log_statement_inside_function_which_must_be_comptime_evaluated.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry() void { | ... | @@ -7,6 +7,8 @@ export fn entry() void { |
| 7 | _ = @typeName(Foo(i32)); | 7 | _ = @typeName(Foo(i32)); |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // compile log statement inside function which must be comptime evaluated | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:2:5: error: found compile log statement | 14 | // tmp.zig:2:5: error: found compile log statement |
test/compile_errors/stage1/obj/compile_log_statement_warning_deduplication_in_generic_fn.zig+3-1| ... | @@ -7,6 +7,8 @@ fn inner(comptime n: usize) void { | ... | @@ -7,6 +7,8 @@ fn inner(comptime n: usize) void { |
| 7 | inline while (i < n) : (i += 1) { @compileLog("!@#$"); } | 7 | inline while (i < n) : (i += 1) { @compileLog("!@#$"); } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // compile log statement warning deduplication in generic fn | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:7:39: error: found compile log statement | 14 | // tmp.zig:7:39: error: found compile log statement |
test/compile_errors/stage1/obj/compile_time_division_by_zero.zig+3-1| ... | @@ -5,6 +5,8 @@ fn foo(x: u32) u32 { | ... | @@ -5,6 +5,8 @@ fn foo(x: u32) u32 { |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } |
| 7 | 7 | ||
| 8 | // compile time division by zero | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:14: error: division by zero | 12 | // tmp.zig:3:14: error: division by zero |
test/compile_errors/stage1/obj/comptime_cast_enum_to_union_but_field_has_payload.zig+3-1| ... | @@ -9,7 +9,9 @@ export fn entry() void { | ... | @@ -9,7 +9,9 @@ export fn entry() void { |
| 9 | _ = x; | 9 | _ = x; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // comptime cast enum to union but field has payload | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:8:26: error: cast to union 'Value' must initialize 'i32' field 'A' | 16 | // tmp.zig:8:26: error: cast to union 'Value' must initialize 'i32' field 'A' |
| 15 | // tmp.zig:3:5: note: field 'A' declared here | 17 | // tmp.zig:3:5: note: field 'A' declared here |
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_catch.zig+3-1| ... | @@ -8,7 +8,9 @@ fn bad() !void { | ... | @@ -8,7 +8,9 @@ fn bad() !void { |
| 8 | return error.Bad; | 8 | return error.Bad; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // comptime continue inside runtime catch | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:4:21: error: comptime control flow inside runtime block | 15 | // tmp.zig:4:21: error: comptime control flow inside runtime block |
| 14 | // tmp.zig:4:15: note: runtime block created here | 16 | // tmp.zig:4:15: note: runtime block created here |
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_bool.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // comptime continue inside runtime if bool | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:22: error: comptime control flow inside runtime block | 14 | // tmp.zig:5:22: error: comptime control flow inside runtime block |
| 13 | // tmp.zig:5:9: note: runtime block created here | 15 | // tmp.zig:5:9: note: runtime block created here |
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_error.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // comptime continue inside runtime if error | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:20: error: comptime control flow inside runtime block | 14 | // tmp.zig:5:20: error: comptime control flow inside runtime block |
| 13 | // tmp.zig:5:9: note: runtime block created here | 15 | // tmp.zig:5:9: note: runtime block created here |
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_optional.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // comptime continue inside runtime if optional | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:20: error: comptime control flow inside runtime block | 14 | // tmp.zig:5:20: error: comptime control flow inside runtime block |
| 13 | // tmp.zig:5:9: note: runtime block created here | 15 | // tmp.zig:5:9: note: runtime block created here |
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_switch.zig+3-1| ... | @@ -10,7 +10,9 @@ export fn entry() void { | ... | @@ -10,7 +10,9 @@ export fn entry() void { |
| 10 | } | 10 | } |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // comptime continue inside runtime switch | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:6:19: error: comptime control flow inside runtime block | 17 | // tmp.zig:6:19: error: comptime control flow inside runtime block |
| 16 | // tmp.zig:5:9: note: runtime block created here | 18 | // tmp.zig:5:9: note: runtime block created here |
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_bool.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // comptime continue inside runtime while bool | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:25: error: comptime control flow inside runtime block | 14 | // tmp.zig:5:25: error: comptime control flow inside runtime block |
| 13 | // tmp.zig:5:9: note: runtime block created here | 15 | // tmp.zig:5:9: note: runtime block created here |
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_error.zig+3-1| ... | @@ -9,7 +9,9 @@ export fn entry() void { | ... | @@ -9,7 +9,9 @@ export fn entry() void { |
| 9 | } | 9 | } |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // comptime continue inside runtime while error | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:6:13: error: comptime control flow inside runtime block | 16 | // tmp.zig:6:13: error: comptime control flow inside runtime block |
| 15 | // tmp.zig:5:9: note: runtime block created here | 17 | // tmp.zig:5:9: note: runtime block created here |
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_optional.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // comptime continue inside runtime while optional | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:23: error: comptime control flow inside runtime block | 14 | // tmp.zig:5:23: error: comptime control flow inside runtime block |
| 13 | // tmp.zig:5:9: note: runtime block created here | 15 | // tmp.zig:5:9: note: runtime block created here |
test/compile_errors/stage1/obj/comptime_float_in_asm_input.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo() void { | ... | @@ -2,6 +2,8 @@ export fn foo() void { |
| 2 | asm volatile ("" : : [bar]"r"(3.17) : ""); | 2 | asm volatile ("" : : [bar]"r"(3.17) : ""); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // comptime_float in asm input | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:35: error: expected sized integer or sized float, found comptime_float | 9 | // tmp.zig:2:35: error: expected sized integer or sized float, found comptime_float |
test/compile_errors/stage1/obj/comptime_implicit_cast_f64_to_f32.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | _ = y; | 4 | _ = y; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // comptime implicit cast f64 to f32 | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:20: error: cast of value 16777217.000000 to type 'f32' loses information | 11 | // tmp.zig:3:20: error: cast of value 16777217.000000 to type 'f32' loses information |
test/compile_errors/stage1/obj/comptime_int_in_asm_input.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo() void { | ... | @@ -2,6 +2,8 @@ export fn foo() void { |
| 2 | asm volatile ("" : : [bar]"r"(3) : ""); | 2 | asm volatile ("" : : [bar]"r"(3) : ""); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // comptime_int in asm input | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:35: error: expected sized integer or sized float, found comptime_int | 9 | // tmp.zig:2:35: error: expected sized integer or sized float, found comptime_int |
test/compile_errors/stage1/obj/comptime_ptrcast_of_zero-sized_type.zig+3-1| ... | @@ -5,6 +5,8 @@ fn foo() void { | ... | @@ -5,6 +5,8 @@ fn foo() void { |
| 5 | } | 5 | } |
| 6 | comptime { foo(); } | 6 | comptime { foo(); } |
| 7 | 7 | ||
| 8 | // comptime ptrcast of zero-sized type | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:21: error: '*const struct:2:17' and '[*]const u8' do not have the same in-memory representation | 12 | // tmp.zig:3:21: error: '*const struct:2:17' and '[*]const u8' do not have the same in-memory representation |
test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig+3-1| ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { | ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | // comptime slice-sentinel does not match memory at target index (terminated) | 57 | // error |
| 58 | // backend=stage1 | ||
| 59 | // target=native | ||
| 58 | // | 60 | // |
| 59 | // :4:29: error: slice-sentinel does not match memory at target index | 61 | // :4:29: error: slice-sentinel does not match memory at target index |
| 60 | // :12:29: error: slice-sentinel does not match memory at target index | 62 | // :12:29: error: slice-sentinel does not match memory at target index |
test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig+3-1| ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { | ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | // comptime slice-sentinel does not match memory at target index (unterminated) | 57 | // error |
| 58 | // backend=stage1 | ||
| 59 | // target=native | ||
| 58 | // | 60 | // |
| 59 | // :4:29: error: slice-sentinel does not match memory at target index | 61 | // :4:29: error: slice-sentinel does not match memory at target index |
| 60 | // :12:29: error: slice-sentinel does not match memory at target index | 62 | // :12:29: error: slice-sentinel does not match memory at target index |
test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_target-sentinel.zig+3-1| ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { | ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | // comptime slice-sentinel does not match target-sentinel | 57 | // error |
| 58 | // backend=stage1 | ||
| 59 | // target=native | ||
| 58 | // | 60 | // |
| 59 | // :4:29: error: slice-sentinel does not match target-sentinel | 61 | // :4:29: error: slice-sentinel does not match target-sentinel |
| 60 | // :12:29: error: slice-sentinel does not match target-sentinel | 62 | // :12:29: error: slice-sentinel does not match target-sentinel |
test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_terminated.zig+3-1| ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { | ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | // comptime slice-sentinel is out of bounds (terminated) | 57 | // error |
| 58 | // backend=stage1 | ||
| 59 | // target=native | ||
| 58 | // | 60 | // |
| 59 | // :4:29: error: out of bounds slice | 61 | // :4:29: error: out of bounds slice |
| 60 | // :12:29: error: out of bounds slice | 62 | // :12:29: error: out of bounds slice |
test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig+3-1| ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { | ... | @@ -54,7 +54,9 @@ export fn foo_slice() void { |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | // comptime slice-sentinel is out of bounds (unterminated) | 57 | // error |
| 58 | // backend=stage1 | ||
| 59 | // target=native | ||
| 58 | // | 60 | // |
| 59 | // :4:29: error: slice-sentinel is out of bounds | 61 | // :4:29: error: slice-sentinel is out of bounds |
| 60 | // :12:29: error: slice-sentinel is out of bounds | 62 | // :12:29: error: slice-sentinel is out of bounds |
test/compile_errors/stage1/obj/comptime_slice_of_an_undefined_slice.zig+3-1| ... | @@ -4,6 +4,8 @@ comptime { | ... | @@ -4,6 +4,8 @@ comptime { |
| 4 | _ = b; | 4 | _ = b; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // comptime slice of an undefined slice | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:14: error: slice of undefined | 11 | // tmp.zig:3:14: error: slice of undefined |
test/compile_errors/stage1/obj/comptime_slice_of_undefined_pointer_non-zero_len.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = slice; | 3 | _ = slice; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // comptime slice of undefined pointer non-zero len | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:41: error: non-zero length slice of undefined pointer | 10 | // tmp.zig:2:41: error: non-zero length slice of undefined pointer |
test/compile_errors/stage1/obj/comptime_struct_field_no_init_value.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | _ = f; | 6 | _ = f; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // comptime struct field, no init value | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:2:5: error: comptime field without default initialization value | 13 | // tmp.zig:2:5: error: comptime field without default initialization value |
test/compile_errors/stage1/obj/const_frame_cast_to_anyframe.zig+3-1| ... | @@ -11,7 +11,9 @@ fn func() void { | ... | @@ -11,7 +11,9 @@ fn func() void { |
| 11 | suspend {} | 11 | suspend {} |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // const frame cast to anyframe | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:3:12: error: expected type 'anyframe', found '*const @Frame(func)' | 18 | // tmp.zig:3:12: error: expected type 'anyframe', found '*const @Frame(func)' |
| 17 | // tmp.zig:7:24: error: expected type 'anyframe', found '*const @Frame(func)' | 19 | // tmp.zig:7:24: error: expected type 'anyframe', found '*const @Frame(func)' |
test/compile_errors/stage1/obj/const_is_a_statement_not_an_expression.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn f() void { | ... | @@ -2,6 +2,8 @@ export fn f() void { |
| 2 | (const a = 0); | 2 | (const a = 0); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // const is a statement, not an expression | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:6: error: expected expression, found 'const' | 9 | // tmp.zig:2:6: error: expected expression, found 'const' |
test/compile_errors/stage1/obj/container_init_with_non-type.zig+3-1| ... | @@ -3,6 +3,8 @@ const a = zero{1}; | ... | @@ -3,6 +3,8 @@ const a = zero{1}; |
| 3 | 3 | ||
| 4 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 4 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } |
| 5 | 5 | ||
| 6 | // container init with non-type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:11: error: expected type 'type', found 'i32' | 10 | // tmp.zig:2:11: error: expected type 'type', found 'i32' |
test/compile_errors/stage1/obj/control_flow_uses_comptime_var_at_runtime.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn foo() void { | ... | @@ -7,7 +7,9 @@ export fn foo() void { |
| 7 | 7 | ||
| 8 | fn bar() void { } | 8 | fn bar() void { } |
| 9 | 9 | ||
| 10 | // control flow uses comptime var at runtime | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:5: error: control flow attempts to use compile-time variable at runtime | 14 | // tmp.zig:3:5: error: control flow attempts to use compile-time variable at runtime |
| 13 | // tmp.zig:3:24: note: compile-time variable assigned here | 15 | // tmp.zig:3:24: note: compile-time variable assigned here |
test/compile_errors/stage1/obj/control_reaches_end_of_non-void_function.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn a() i32 {} | 1 | fn a() i32 {} |
| 2 | export fn entry() void { _ = a(); } | 2 | export fn entry() void { _ = a(); } |
| 3 | 3 | ||
| 4 | // control reaches end of non-void function | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:12: error: expected type 'i32', found 'void' | 8 | // tmp.zig:1:12: error: expected type 'i32', found 'void' |
test/compile_errors/stage1/obj/declaration_between_fields.zig+3-1| ... | @@ -15,7 +15,9 @@ comptime { | ... | @@ -15,7 +15,9 @@ comptime { |
| 15 | _ = S; | 15 | _ = S; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | // declaration between fields | 18 | // error |
| 19 | // backend=stage1 | ||
| 20 | // target=native | ||
| 19 | // | 21 | // |
| 20 | // tmp.zig:9:5: error: declarations are not allowed between container fields | 22 | // tmp.zig:9:5: error: declarations are not allowed between container fields |
| 21 | // tmp.zig:5:5: note: field before declarations here | 23 | // tmp.zig:5:5: note: field before declarations here |
test/compile_errors/stage1/obj/declaration_with_same_name_as_primitive_must_use_special_syntax.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn entry() void { | ... | @@ -4,7 +4,9 @@ export fn entry() void { |
| 4 | _ = a; | 4 | _ = a; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // declaration with same name as primitive must use special syntax | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:1:7: error: name shadows primitive 'u8' | 11 | // tmp.zig:1:7: error: name shadows primitive 'u8' |
| 10 | // tmp.zig:1:7: note: consider using @"u8" to disambiguate | 12 | // tmp.zig:1:7: note: consider using @"u8" to disambiguate |
test/compile_errors/stage1/obj/deduplicate_undeclared_identifier.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn b() void { | ... | @@ -5,6 +5,8 @@ export fn b() void { |
| 5 | x += 1; | 5 | x += 1; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // deduplicate undeclared identifier | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:2:5: error: use of undeclared identifier 'x' | 12 | // tmp.zig:2:5: error: use of undeclared identifier 'x' |
test/compile_errors/stage1/obj/deref_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a.*; | 3 | _ = a.*; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // deref on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: attempt to dereference undefined value | 10 | // tmp.zig:3:9: error: attempt to dereference undefined value |
test/compile_errors/stage1/obj/deref_slice_and_get_len_field.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = a.*.len; | 3 | _ = a.*.len; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // deref slice and get len field | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:10: error: attempt to dereference non-pointer type '[]u8' | 10 | // tmp.zig:3:10: error: attempt to dereference non-pointer type '[]u8' |
test/compile_errors/stage1/obj/dereference_an_array.zig+3-1| ... | @@ -7,6 +7,8 @@ pub fn pass(in: []u8) []u8 { | ... | @@ -7,6 +7,8 @@ pub fn pass(in: []u8) []u8 { |
| 7 | 7 | ||
| 8 | export fn entry() usize { return @sizeOf(@TypeOf(pass)); } | 8 | export fn entry() usize { return @sizeOf(@TypeOf(pass)); } |
| 9 | 9 | ||
| 10 | // dereference an array | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:4:10: error: attempt to dereference non-pointer type '[10]u8' | 14 | // tmp.zig:4:10: error: attempt to dereference non-pointer type '[10]u8' |
test/compile_errors/stage1/obj/dereference_unknown_length_pointer.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry(x: [*]i32) i32 { | ... | @@ -2,6 +2,8 @@ export fn entry(x: [*]i32) i32 { |
| 2 | return x.*; | 2 | return x.*; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // dereference unknown length pointer | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:13: error: index syntax required for unknown-length pointer type '[*]i32' | 9 | // tmp.zig:2:13: error: index syntax required for unknown-length pointer type '[*]i32' |
test/compile_errors/stage1/obj/direct_struct_loop.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const A = struct { a : A, }; | 1 | const A = struct { a : A, }; |
| 2 | export fn entry() usize { return @sizeOf(A); } | 2 | export fn entry() usize { return @sizeOf(A); } |
| 3 | 3 | ||
| 4 | // direct struct loop | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:11: error: struct 'A' depends on itself | 8 | // tmp.zig:1:11: error: struct 'A' depends on itself |
test/compile_errors/stage1/obj/directly_embedding_opaque_type_in_struct_and_union.zig+3-1| ... | @@ -20,7 +20,9 @@ export fn c() void { | ... | @@ -20,7 +20,9 @@ export fn c() void { |
| 20 | _ = qux; | 20 | _ = qux; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | // directly embedding opaque type in struct and union | 23 | // error |
| 24 | // backend=stage1 | ||
| 25 | // target=native | ||
| 24 | // | 26 | // |
| 25 | // tmp.zig:3:5: error: opaque types have unknown size and therefore cannot be directly embedded in structs | 27 | // tmp.zig:3:5: error: opaque types have unknown size and therefore cannot be directly embedded in structs |
| 26 | // tmp.zig:7:5: error: opaque types have unknown size and therefore cannot be directly embedded in unions | 28 | // tmp.zig:7:5: error: opaque types have unknown size and therefore cannot be directly embedded in unions |
test/compile_errors/stage1/obj/disallow_coercion_from_non-null-terminated_pointer_to_null-terminated_pointer.zig+3-1| ... | @@ -5,6 +5,8 @@ pub fn main() void { | ... | @@ -5,6 +5,8 @@ pub fn main() void { |
| 5 | _ = puts(no_zero_ptr); | 5 | _ = puts(no_zero_ptr); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // disallow coercion from non-null-terminated pointer to null-terminated pointer | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:14: error: expected type '[*:0]const u8', found '[*]const u8' | 12 | // tmp.zig:5:14: error: expected type '[*:0]const u8', found '[*]const u8' |
test/compile_errors/stage1/obj/discarding_error_value.zig+3-1| ... | @@ -5,6 +5,8 @@ fn foo() !void { | ... | @@ -5,6 +5,8 @@ fn foo() !void { |
| 5 | return error.OutOfMemory; | 5 | return error.OutOfMemory; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // discarding error value | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:2:12: error: error is discarded. consider using `try`, `catch`, or `if` | 12 | // tmp.zig:2:12: error: error is discarded. consider using `try`, `catch`, or `if` |
test/compile_errors/stage1/obj/div_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a /= a; | 3 | a /= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // div assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/div_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a / a; | 3 | _ = a / a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // div on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/division_by_zero.zig+3-1| ... | @@ -8,7 +8,9 @@ export fn entry2() usize { return @sizeOf(@TypeOf(lit_float_x)); } | ... | @@ -8,7 +8,9 @@ export fn entry2() usize { return @sizeOf(@TypeOf(lit_float_x)); } |
| 8 | export fn entry3() usize { return @sizeOf(@TypeOf(int_x)); } | 8 | export fn entry3() usize { return @sizeOf(@TypeOf(int_x)); } |
| 9 | export fn entry4() usize { return @sizeOf(@TypeOf(float_x)); } | 9 | export fn entry4() usize { return @sizeOf(@TypeOf(float_x)); } |
| 10 | 10 | ||
| 11 | // division by zero | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:1:21: error: division by zero | 15 | // tmp.zig:1:21: error: division by zero |
| 14 | // tmp.zig:2:25: error: division by zero | 16 | // tmp.zig:2:25: error: division by zero |
test/compile_errors/stage1/obj/dont_implicit_cast_double_pointer_to_anyopaque.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | _ = ptr2; | 6 | _ = ptr2; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // don't implicit cast double pointer to *anyopaque | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:29: error: expected type '*anyopaque', found '**u32' | 13 | // tmp.zig:5:29: error: expected type '*anyopaque', found '**u32' |
test/compile_errors/stage1/obj/double_optional_on_main_return_value.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | pub fn main() ??void { | 1 | pub fn main() ??void { |
| 2 | } | 2 | } |
| 3 | 3 | ||
| 4 | // double ?? on main return value | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8' | 8 | // error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8' |
test/compile_errors/stage1/obj/duplicate_boolean_switch_value.zig+3-1| ... | @@ -15,7 +15,9 @@ comptime { | ... | @@ -15,7 +15,9 @@ comptime { |
| 15 | _ = x; | 15 | _ = x; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | // duplicate boolean switch value | 18 | // error |
| 19 | // backend=stage1 | ||
| 20 | // target=native | ||
| 19 | // | 21 | // |
| 20 | // tmp.zig:5:9: error: duplicate switch value | 22 | // tmp.zig:5:9: error: duplicate switch value |
| 21 | // tmp.zig:13:9: error: duplicate switch value | 23 | // tmp.zig:13:9: error: duplicate switch value |
test/compile_errors/stage1/obj/duplicate_enum_field.zig+3-1| ... | @@ -8,7 +8,9 @@ export fn entry() void { | ... | @@ -8,7 +8,9 @@ export fn entry() void { |
| 8 | _ = a; | 8 | _ = a; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // duplicate enum field | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:3:5: error: duplicate enum field: 'Bar' | 15 | // tmp.zig:3:5: error: duplicate enum field: 'Bar' |
| 14 | // tmp.zig:2:5: note: other field here | 16 | // tmp.zig:2:5: note: other field here |
test/compile_errors/stage1/obj/duplicate_error_in_switch.zig+3-1| ... | @@ -14,7 +14,9 @@ fn foo(x: i32) !void { | ... | @@ -14,7 +14,9 @@ fn foo(x: i32) !void { |
| 14 | } | 14 | } |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // duplicate error in switch | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:5:14: error: duplicate switch value: '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set.Foo' | 21 | // tmp.zig:5:14: error: duplicate switch value: '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set.Foo' |
| 20 | // tmp.zig:3:14: note: other value here | 22 | // tmp.zig:3:14: note: other value here |
test/compile_errors/stage1/obj/duplicate_error_value_in_error_set.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | _ = a; | 7 | _ = a; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // duplicate error value in error set | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:5: error: duplicate error set field 'Bar' | 14 | // tmp.zig:3:5: error: duplicate error set field 'Bar' |
| 13 | // tmp.zig:2:5: note: previous declaration here | 15 | // tmp.zig:2:5: note: previous declaration here |
test/compile_errors/stage1/obj/duplicate_field_in_struct_value_expression.zig+3-1| ... | @@ -13,6 +13,8 @@ export fn f() void { | ... | @@ -13,6 +13,8 @@ export fn f() void { |
| 13 | _ = a; | 13 | _ = a; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // duplicate field in struct value expression | 16 | // error |
| 17 | // backend=stage1 | ||
| 18 | // target=native | ||
| 17 | // | 19 | // |
| 18 | // tmp.zig:11:9: error: duplicate field | 20 | // tmp.zig:11:9: error: duplicate field |
test/compile_errors/stage1/obj/duplicate_struct_field.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | _ = a; | 7 | _ = a; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // duplicate struct field | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:5: error: duplicate struct field: 'Bar' | 14 | // tmp.zig:3:5: error: duplicate struct field: 'Bar' |
| 13 | // tmp.zig:2:5: note: other field here | 15 | // tmp.zig:2:5: note: other field here |
test/compile_errors/stage1/obj/duplicate_union_field.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | _ = a; | 7 | _ = a; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // duplicate union field | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:5: error: duplicate union field: 'Bar' | 14 | // tmp.zig:3:5: error: duplicate union field: 'Bar' |
| 13 | // tmp.zig:2:5: note: other field here | 15 | // tmp.zig:2:5: note: other field here |
test/compile_errors/stage1/obj/embedFile_with_bogus_file.zig+3-1| ... | @@ -2,6 +2,8 @@ const resource = @embedFile("bogus.txt",); | ... | @@ -2,6 +2,8 @@ const resource = @embedFile("bogus.txt",); |
| 2 | 2 | ||
| 3 | export fn entry() usize { return @sizeOf(@TypeOf(resource)); } | 3 | export fn entry() usize { return @sizeOf(@TypeOf(resource)); } |
| 4 | 4 | ||
| 5 | // @embedFile with bogus file | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:1:29: error: unable to find ' | 9 | // tmp.zig:1:29: error: unable to find ' |
test/compile_errors/stage1/obj/empty_for_loop_body.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn a() void { | ... | @@ -2,6 +2,8 @@ export fn a() void { |
| 2 | for(undefined) |x|; | 2 | for(undefined) |x|; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // empty for loop body | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:23: error: expected block or assignment, found ';' | 9 | // tmp.zig:2:23: error: expected block or assignment, found ';' |
test/compile_errors/stage1/obj/empty_if_body.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn a() void { | ... | @@ -2,6 +2,8 @@ export fn a() void { |
| 2 | if(true); | 2 | if(true); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // empty if body | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:13: error: expected block or assignment, found ';' | 9 | // tmp.zig:2:13: error: expected block or assignment, found ';' |
test/compile_errors/stage1/obj/empty_switch_on_an_integer.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | switch(x) {} | 3 | switch(x) {} |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // empty switch on an integer | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: switch must handle all possibilities | 10 | // tmp.zig:3:5: error: switch must handle all possibilities |
test/compile_errors/stage1/obj/empty_while_loop_body.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn a() void { | ... | @@ -2,6 +2,8 @@ export fn a() void { |
| 2 | while(true); | 2 | while(true); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // empty while loop body | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:16: error: expected block or assignment, found ';' | 9 | // tmp.zig:2:16: error: expected block or assignment, found ';' |
test/compile_errors/stage1/obj/endless_loop_in_function_evaluation.zig+3-1| ... | @@ -5,6 +5,8 @@ fn fibonacci(x: i32) i32 { | ... | @@ -5,6 +5,8 @@ fn fibonacci(x: i32) i32 { |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); } |
| 7 | 7 | ||
| 8 | // endless loop in function evaluation | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:21: error: evaluation exceeded 1000 backwards branches | 12 | // tmp.zig:3:21: error: evaluation exceeded 1000 backwards branches |
test/compile_errors/stage1/obj/enum_field_value_references_enum.zig+3-1| ... | @@ -8,6 +8,8 @@ export fn entry() void { | ... | @@ -8,6 +8,8 @@ export fn entry() void { |
| 8 | } | 8 | } |
| 9 | const D = 1; | 9 | const D = 1; |
| 10 | 10 | ||
| 11 | // enum field value references enum | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:1:17: error: enum 'Foo' depends on itself | 15 | // tmp.zig:1:17: error: enum 'Foo' depends on itself |
test/compile_errors/stage1/obj/enum_in_field_count_range_but_not_matching_tag.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry() void { | ... | @@ -7,7 +7,9 @@ export fn entry() void { |
| 7 | _ = x; | 7 | _ = x; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // enum in field count range but not matching tag | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:6:13: error: enum 'Foo' has no tag matching integer value 0 | 14 | // tmp.zig:6:13: error: enum 'Foo' has no tag matching integer value 0 |
| 13 | // tmp.zig:1:13: note: 'Foo' declared here | 15 | // tmp.zig:1:13: note: 'Foo' declared here |
test/compile_errors/stage1/obj/enum_value_already_taken.zig+3-1| ... | @@ -10,7 +10,9 @@ export fn entry() void { | ... | @@ -10,7 +10,9 @@ export fn entry() void { |
| 10 | _ = x; | 10 | _ = x; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // enum value already taken | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:6:5: error: enum tag value 60 already taken | 17 | // tmp.zig:6:5: error: enum tag value 60 already taken |
| 16 | // tmp.zig:4:5: note: other occurrence here | 18 | // tmp.zig:4:5: note: other occurrence here |
test/compile_errors/stage1/obj/enum_with_0_fields.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | const Foo = enum {}; | 1 | const Foo = enum {}; |
| 2 | 2 | ||
| 3 | // enum with 0 fields | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:13: error: enum declarations must have at least one tag | 7 | // tmp.zig:1:13: error: enum declarations must have at least one tag |
test/compile_errors/stage1/obj/enum_with_declarations_unavailable_for_reify_type.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | _ = @Type(@typeInfo(enum { foo, const bar = 1; })); | 2 | _ = @Type(@typeInfo(enum { foo, const bar = 1; })); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // enum with declarations unavailable for @Type | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:15: error: Type.Enum.decls must be empty for @Type | 9 | // tmp.zig:2:15: error: Type.Enum.decls must be empty for @Type |
test/compile_errors/stage1/obj/error_equality_but_sets_have_no_common_members.zig+3-1| ... | @@ -9,6 +9,8 @@ fn foo(x: Set1) void { | ... | @@ -9,6 +9,8 @@ fn foo(x: Set1) void { |
| 9 | } | 9 | } |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // error equality but sets have no common members | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:7:11: error: error sets 'Set1' and 'Set2' have no common errors | 16 | // tmp.zig:7:11: error: error sets 'Set1' and 'Set2' have no common errors |
test/compile_errors/stage1/obj/error_not_handled_in_switch.zig+3-1| ... | @@ -12,7 +12,9 @@ fn foo(x: i32) !void { | ... | @@ -12,7 +12,9 @@ fn foo(x: i32) !void { |
| 12 | } | 12 | } |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // error not handled in switch | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:2:26: error: error.Baz not handled in switch | 19 | // tmp.zig:2:26: error: error.Baz not handled in switch |
| 18 | // tmp.zig:2:26: error: error.Bar not handled in switch | 20 | // tmp.zig:2:26: error: error.Bar not handled in switch |
test/compile_errors/stage1/obj/error_note_for_function_parameter_incompatibility.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn entry() void { | ... | @@ -4,7 +4,9 @@ export fn entry() void { |
| 4 | do_the_thing(bar); | 4 | do_the_thing(bar); |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // error note for function parameter incompatibility | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:4:18: error: expected type 'fn(i32) void', found 'fn(bool) void | 11 | // tmp.zig:4:18: error: expected type 'fn(i32) void', found 'fn(bool) void |
| 10 | // tmp.zig:4:18: note: parameter 0: 'bool' cannot cast into 'i32' | 12 | // tmp.zig:4:18: note: parameter 0: 'bool' cannot cast into 'i32' |
test/compile_errors/stage1/obj/error_union_operator_with_non_error_set_LHS.zig+3-1| ... | @@ -4,6 +4,8 @@ comptime { | ... | @@ -4,6 +4,8 @@ comptime { |
| 4 | _ = x; | 4 | _ = x; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // error union operator with non error set LHS | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:2:15: error: expected error set type, found type 'i32' | 11 | // tmp.zig:2:15: error: expected error set type, found type 'i32' |
test/compile_errors/stage1/obj/error_when_evaluating_return_type.zig+3-1| ... | @@ -10,6 +10,8 @@ export fn entry() void { | ... | @@ -10,6 +10,8 @@ export fn entry() void { |
| 10 | _ = rule_set; | 10 | _ = rule_set; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // error when evaluating return type | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:2:19: error: expected type 'i32', found 'type' | 17 | // tmp.zig:2:19: error: expected type 'i32', found 'type' |
test/compile_errors/stage1/obj/exceeded_maximum_bit_width_of_integer.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn entry2() void { | ... | @@ -7,7 +7,9 @@ export fn entry2() void { |
| 7 | _ = x; | 7 | _ = x; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // exceeded maximum bit width of integer | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:2:15: error: primitive integer type 'u65536' exceeds maximum bit width of 65535 | 14 | // tmp.zig:2:15: error: primitive integer type 'u65536' exceeds maximum bit width of 65535 |
| 13 | // tmp.zig:6:12: error: primitive integer type 'i65536' exceeds maximum bit width of 65535 | 15 | // tmp.zig:6:12: error: primitive integer type 'i65536' exceeds maximum bit width of 65535 |
test/compile_errors/stage1/obj/explicit_cast_float_literal_to_integer_when_there_is_a_fraction_component.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() i32 { | ... | @@ -2,6 +2,8 @@ export fn entry() i32 { |
| 2 | return @as(i32, 12.34); | 2 | return @as(i32, 12.34); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // explicit cast float literal to integer when there is a fraction component | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:21: error: fractional component prevents float value 12.340000 from being casted to type 'i32' | 9 | // tmp.zig:2:21: error: fractional component prevents float value 12.340000 from being casted to type 'i32' |
test/compile_errors/stage1/obj/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig+3-1| ... | @@ -6,6 +6,8 @@ comptime { | ... | @@ -6,6 +6,8 @@ comptime { |
| 6 | _ = y; | 6 | _ = y; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // explicit error set cast known at comptime violates error sets | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:13: error: error.B not a member of error set 'Set2' | 13 | // tmp.zig:5:13: error: error.B not a member of error set 'Set2' |
test/compile_errors/stage1/obj/explicitly_casting_non_tag_type_to_enum.zig+3-1| ... | @@ -11,6 +11,8 @@ export fn entry() void { | ... | @@ -11,6 +11,8 @@ export fn entry() void { |
| 11 | _ = x; | 11 | _ = x; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // explicitly casting non tag type to enum | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:10:31: error: expected integer type, found 'f32' | 18 | // tmp.zig:10:31: error: expected integer type, found 'f32' |
test/compile_errors/stage1/obj/export_function_with_comptime_parameter.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo(comptime x: i32, y: i32) i32{ | ... | @@ -2,6 +2,8 @@ export fn foo(comptime x: i32, y: i32) i32{ |
| 2 | return x + y; | 2 | return x + y; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // export function with comptime parameter | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C' | 9 | // tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C' |
test/compile_errors/stage1/obj/export_generic_function.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo(num: anytype) i32 { | ... | @@ -3,6 +3,8 @@ export fn foo(num: anytype) i32 { |
| 3 | return 0; | 3 | return 0; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // export generic function | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:1:15: error: parameter of type 'anytype' not allowed in function with calling convention 'C' | 10 | // tmp.zig:1:15: error: parameter of type 'anytype' not allowed in function with calling convention 'C' |
test/compile_errors/stage1/obj/exported_async_function.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | export fn foo() callconv(.Async) void {} | 1 | export fn foo() callconv(.Async) void {} |
| 2 | 2 | ||
| 3 | // exported async function | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:1: error: exported function cannot be async | 7 | // tmp.zig:1:1: error: exported function cannot be async |
test/compile_errors/stage1/obj/exported_enum_without_explicit_integer_tag_type.zig+3-1| ... | @@ -7,7 +7,9 @@ comptime { | ... | @@ -7,7 +7,9 @@ comptime { |
| 7 | @export(e, .{ .name = "e" }); | 7 | @export(e, .{ .name = "e" }); |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // exported enum without explicit integer tag type | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:13: error: exported enum without explicit integer tag type | 14 | // tmp.zig:3:13: error: exported enum without explicit integer tag type |
| 13 | // tmp.zig:7:13: error: exported enum value without explicit integer tag type | 15 | // tmp.zig:7:13: error: exported enum value without explicit integer tag type |
test/compile_errors/stage1/obj/extern_function_pointer_mismatch.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn c(x: i32) i32 {return x + 2;} | ... | @@ -5,6 +5,8 @@ export fn c(x: i32) i32 {return x + 2;} |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(fns)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(fns)); } |
| 7 | 7 | ||
| 8 | // extern function pointer mismatch | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32' | 12 | // tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32' |
test/compile_errors/stage1/obj/extern_function_with_comptime_parameter.zig+3-1| ... | @@ -4,6 +4,8 @@ fn f() i32 { | ... | @@ -4,6 +4,8 @@ fn f() i32 { |
| 4 | } | 4 | } |
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 5 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 6 | 6 | ||
| 7 | // extern function with comptime parameter | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C' | 11 | // tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C' |
test/compile_errors/stage1/obj/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig+3-1| ... | @@ -36,6 +36,8 @@ export fn entry() void { | ... | @@ -36,6 +36,8 @@ export fn entry() void { |
| 36 | _ = s; | 36 | _ = s; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | // extern struct with extern-compatible but inferred integer tag type | 39 | // error |
| 40 | // backend=stage1 | ||
| 41 | // target=native | ||
| 40 | // | 42 | // |
| 41 | // tmp.zig:31:5: error: extern structs cannot contain fields of type 'E' | 43 | // tmp.zig:31:5: error: extern structs cannot contain fields of type 'E' |
test/compile_errors/stage1/obj/extern_struct_with_non-extern-compatible_integer_tag_type.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry() void { | ... | @@ -7,6 +7,8 @@ export fn entry() void { |
| 7 | _ = s; | 7 | _ = s; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // extern struct with non-extern-compatible integer tag type | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:5: error: extern structs cannot contain fields of type 'E' | 14 | // tmp.zig:3:5: error: extern structs cannot contain fields of type 'E' |
test/compile_errors/stage1/obj/extern_union_field_missing_type.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | _ = a; | 6 | _ = a; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // extern union field missing type | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:2:5: error: union field missing type | 13 | // tmp.zig:2:5: error: union field missing type |
test/compile_errors/stage1/obj/extern_union_given_enum_tag_type.zig+3-1| ... | @@ -13,6 +13,8 @@ export fn entry() void { | ... | @@ -13,6 +13,8 @@ export fn entry() void { |
| 13 | _ = a; | 13 | _ = a; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // extern union given enum tag type | 16 | // error |
| 17 | // backend=stage1 | ||
| 18 | // target=native | ||
| 17 | // | 19 | // |
| 18 | // tmp.zig:6:30: error: extern union does not support enum tag type | 20 | // tmp.zig:6:30: error: extern union does not support enum tag type |
test/compile_errors/stage1/obj/extern_variable_has_no_type.zig+3-1| ... | @@ -3,6 +3,8 @@ pub export fn entry() void { | ... | @@ -3,6 +3,8 @@ pub export fn entry() void { |
| 3 | foo; | 3 | foo; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // extern variable has no type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:1:8: error: unable to infer variable type | 10 | // tmp.zig:1:8: error: unable to infer variable type |
test/compile_errors/stage1/obj/fieldParentPtr-bad_field_name.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn foo(a: *i32) *Foo { | ... | @@ -5,6 +5,8 @@ export fn foo(a: *i32) *Foo { |
| 5 | return @fieldParentPtr(Foo, "a", a); | 5 | return @fieldParentPtr(Foo, "a", a); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // @fieldParentPtr - bad field name | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:33: error: struct 'Foo' has no field 'a' | 12 | // tmp.zig:5:33: error: struct 'Foo' has no field 'a' |
test/compile_errors/stage1/obj/fieldParentPtr-comptime_field_ptr_not_based_on_struct.zig+3-1| ... | @@ -10,6 +10,8 @@ comptime { | ... | @@ -10,6 +10,8 @@ comptime { |
| 10 | _ = another_foo_ptr; | 10 | _ = another_foo_ptr; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // @fieldParentPtr - comptime field ptr not based on struct | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:9:55: error: pointer value not based on parent struct | 17 | // tmp.zig:9:55: error: pointer value not based on parent struct |
test/compile_errors/stage1/obj/fieldParentPtr-comptime_wrong_field_index.zig+3-1| ... | @@ -9,6 +9,8 @@ comptime { | ... | @@ -9,6 +9,8 @@ comptime { |
| 9 | _ = another_foo_ptr; | 9 | _ = another_foo_ptr; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // @fieldParentPtr - comptime wrong field index | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo' | 16 | // tmp.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo' |
test/compile_errors/stage1/obj/fieldParentPtr-field_pointer_is_not_pointer.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn foo(a: i32) *Foo { | ... | @@ -5,6 +5,8 @@ export fn foo(a: i32) *Foo { |
| 5 | return @fieldParentPtr(Foo, "a", a); | 5 | return @fieldParentPtr(Foo, "a", a); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // @fieldParentPtr - field pointer is not pointer | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:38: error: expected pointer, found 'i32' | 12 | // tmp.zig:5:38: error: expected pointer, found 'i32' |
test/compile_errors/stage1/obj/fieldParentPtr-non_struct.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo(a: *i32) *Foo { | ... | @@ -3,6 +3,8 @@ export fn foo(a: *i32) *Foo { |
| 3 | return @fieldParentPtr(Foo, "a", a); | 3 | return @fieldParentPtr(Foo, "a", a); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @fieldParentPtr - non struct | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:28: error: expected struct type, found 'i32' | 10 | // tmp.zig:3:28: error: expected struct type, found 'i32' |
test/compile_errors/stage1/obj/field_access_of_opaque_type.zig+3-1| ... | @@ -9,6 +9,8 @@ fn bar(x: *MyType) bool { | ... | @@ -9,6 +9,8 @@ fn bar(x: *MyType) bool { |
| 9 | return x.blah; | 9 | return x.blah; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // field access of opaque type | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:9:13: error: no member named 'blah' in opaque type 'MyType' | 16 | // tmp.zig:9:13: error: no member named 'blah' in opaque type 'MyType' |
test/compile_errors/stage1/obj/field_access_of_slices.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | _ = info; | 4 | _ = info; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // field access of slices | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:32: error: type 'type' does not support field access | 11 | // tmp.zig:3:32: error: type 'type' does not support field access |
test/compile_errors/stage1/obj/field_access_of_unknown_length_pointer.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry(foo: [*]Foo) void { | ... | @@ -6,6 +6,8 @@ export fn entry(foo: [*]Foo) void { |
| 6 | foo.a += 1; | 6 | foo.a += 1; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // field access of unknown length pointer | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:6:8: error: type '[*]Foo' does not support field access | 13 | // tmp.zig:6:8: error: type '[*]Foo' does not support field access |
test/compile_errors/stage1/obj/field_type_supplied_in_an_enum.zig+3-1| ... | @@ -4,7 +4,9 @@ const Letter = enum { | ... | @@ -4,7 +4,9 @@ const Letter = enum { |
| 4 | C, | 4 | C, |
| 5 | }; | 5 | }; |
| 6 | 6 | ||
| 7 | // field type supplied in an enum | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:2:8: error: enum fields do not have types | 11 | // tmp.zig:2:8: error: enum fields do not have types |
| 10 | // tmp.zig:1:16: note: consider 'union(enum)' here to make it a tagged union | 12 | // tmp.zig:1:16: note: consider 'union(enum)' here to make it a tagged union |
test/compile_errors/stage1/obj/floatToInt_comptime_safety.zig+3-1| ... | @@ -8,7 +8,9 @@ comptime { | ... | @@ -8,7 +8,9 @@ comptime { |
| 8 | _ = @floatToInt(u8, @as(f32, 256.1)); | 8 | _ = @floatToInt(u8, @as(f32, 256.1)); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // @floatToInt comptime safety | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:2:9: error: integer value '-129' cannot be stored in type 'i8' | 15 | // tmp.zig:2:9: error: integer value '-129' cannot be stored in type 'i8' |
| 14 | // tmp.zig:5:9: error: integer value '-1' cannot be stored in type 'u8' | 16 | // tmp.zig:5:9: error: integer value '-1' cannot be stored in type 'u8' |
test/compile_errors/stage1/obj/float_literal_too_large_error.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a; | 3 | _ = a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // float literal too large error | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: float literal out of range of any type | 10 | // tmp.zig:2:15: error: float literal out of range of any type |
test/compile_errors/stage1/obj/float_literal_too_small_error_denormal.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a; | 3 | _ = a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // float literal too small error (denormal) | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: float literal out of range of any type | 10 | // tmp.zig:2:15: error: float literal out of range of any type |
test/compile_errors/stage1/obj/for_loop_body_expression_ignored.zig+3-1| ... | @@ -10,7 +10,9 @@ export fn f2() void { | ... | @@ -10,7 +10,9 @@ export fn f2() void { |
| 10 | _ = x; | 10 | _ = x; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // for loop body expression ignored | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:5:30: error: expression value is ignored | 17 | // tmp.zig:5:30: error: expression value is ignored |
| 16 | // tmp.zig:9:30: error: expression value is ignored | 18 | // tmp.zig:9:30: error: expression value is ignored |
test/compile_errors/stage1/obj/frame_called_outside_of_function_definition.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() bool { | ... | @@ -4,6 +4,8 @@ export fn entry() bool { |
| 4 | return handle_undef == handle_dummy; | 4 | return handle_undef == handle_dummy; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // @frame() called outside of function definition | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:2:30: error: @frame() called outside of function definition | 11 | // tmp.zig:2:30: error: @frame() called outside of function definition |
test/compile_errors/stage1/obj/frame_causes_function_to_be_async.zig+3-1| ... | @@ -5,7 +5,9 @@ fn func() void { | ... | @@ -5,7 +5,9 @@ fn func() void { |
| 5 | _ = @frame(); | 5 | _ = @frame(); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // @frame() causes function to be async | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async | 12 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async |
| 11 | // tmp.zig:5:9: note: @frame() causes function to be async | 13 | // tmp.zig:5:9: note: @frame() causes function to be async |
test/compile_errors/stage1/obj/function_alignment_non_power_of_2.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | extern fn foo() align(3) void; | 1 | extern fn foo() align(3) void; |
| 2 | export fn entry() void { return foo(); } | 2 | export fn entry() void { return foo(); } |
| 3 | 3 | ||
| 4 | // function alignment non power of 2 | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:23: error: alignment value 3 is not a power of 2 | 8 | // tmp.zig:1:23: error: alignment value 3 is not a power of 2 |
test/compile_errors/stage1/obj/function_call_assigned_to_incorrect_type.zig+3-1| ... | @@ -6,6 +6,8 @@ fn concat() [16]f32 { | ... | @@ -6,6 +6,8 @@ fn concat() [16]f32 { |
| 6 | return [1]f32{0}**16; | 6 | return [1]f32{0}**16; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // function call assigned to incorrect type | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:3:17: error: expected type '[4]f32', found '[16]f32' | 13 | // tmp.zig:3:17: error: expected type '[4]f32', found '[16]f32' |
test/compile_errors/stage1/obj/function_parameter_is_opaque.zig+3-1| ... | @@ -19,7 +19,9 @@ export fn entry4() void { | ... | @@ -19,7 +19,9 @@ export fn entry4() void { |
| 19 | _ = bar; | 19 | _ = bar; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | // function parameter is opaque | 22 | // error |
| 23 | // backend=stage1 | ||
| 24 | // target=native | ||
| 23 | // | 25 | // |
| 24 | // tmp.zig:3:28: error: parameter of opaque type 'FooType' not allowed | 26 | // tmp.zig:3:28: error: parameter of opaque type 'FooType' not allowed |
| 25 | // tmp.zig:8:28: error: parameter of type '@Type(.Null)' not allowed | 27 | // tmp.zig:8:28: error: parameter of type '@Type(.Null)' not allowed |
test/compile_errors/stage1/obj/function_prototype_with_no_body.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | foo(); | 3 | foo(); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // function prototype with no body | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:1:1: error: non-extern function has no body | 10 | // tmp.zig:1:1: error: non-extern function has no body |
test/compile_errors/stage1/obj/function_returning_opaque_type.zig+3-1| ... | @@ -9,7 +9,9 @@ export fn baz() !@TypeOf(undefined) { | ... | @@ -9,7 +9,9 @@ export fn baz() !@TypeOf(undefined) { |
| 9 | return error.InvalidValue; | 9 | return error.InvalidValue; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // function returning opaque type | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:2:18: error: Opaque return type 'FooType' not allowed | 16 | // tmp.zig:2:18: error: Opaque return type 'FooType' not allowed |
| 15 | // tmp.zig:1:1: note: type declared here | 17 | // tmp.zig:1:1: note: type declared here |
test/compile_errors/stage1/obj/function_with_ccc_indirectly_calling_async_function.zig+3-1| ... | @@ -8,7 +8,9 @@ fn bar() void { | ... | @@ -8,7 +8,9 @@ fn bar() void { |
| 8 | suspend {} | 8 | suspend {} |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // function with ccc indirectly calling async function | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async | 15 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async |
| 14 | // tmp.zig:2:8: note: async function call here | 16 | // tmp.zig:2:8: note: async function call here |
test/compile_errors/stage1/obj/function_with_invalid_return_type.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | export fn foo() boid {} | 1 | export fn foo() boid {} |
| 2 | 2 | ||
| 3 | // function with invalid return type | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:17: error: use of undeclared identifier 'boid' | 7 | // tmp.zig:1:17: error: use of undeclared identifier 'boid' |
test/compile_errors/stage1/obj/function_with_non-extern_non-packed_enum_parameter.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const Foo = enum { A, B, C }; | 1 | const Foo = enum { A, B, C }; |
| 2 | export fn entry(foo: Foo) void { _ = foo; } | 2 | export fn entry(foo: Foo) void { _ = foo; } |
| 3 | 3 | ||
| 4 | // function with non-extern non-packed enum parameter | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:2:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C' | 8 | // tmp.zig:2:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C' |
test/compile_errors/stage1/obj/function_with_non-extern_non-packed_struct_parameter.zig+3-1| ... | @@ -5,6 +5,8 @@ const Foo = struct { | ... | @@ -5,6 +5,8 @@ const Foo = struct { |
| 5 | }; | 5 | }; |
| 6 | export fn entry(foo: Foo) void { _ = foo; } | 6 | export fn entry(foo: Foo) void { _ = foo; } |
| 7 | 7 | ||
| 8 | // function with non-extern non-packed struct parameter | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C' | 12 | // tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C' |
test/compile_errors/stage1/obj/function_with_non-extern_non-packed_union_parameter.zig+3-1| ... | @@ -5,6 +5,8 @@ const Foo = union { | ... | @@ -5,6 +5,8 @@ const Foo = union { |
| 5 | }; | 5 | }; |
| 6 | export fn entry(foo: Foo) void { _ = foo; } | 6 | export fn entry(foo: Foo) void { _ = foo; } |
| 7 | 7 | ||
| 8 | // function with non-extern non-packed union parameter | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C' | 12 | // tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C' |
test/compile_errors/stage1/obj/generic_fn_as_parameter_without_comptime_keyword.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | f(g); | 4 | f(g); |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // generic fn as parameter without comptime keyword | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:1:9: error: parameter of type 'fn(anytype) anytype' must be declared comptime | 11 | // tmp.zig:1:9: error: parameter of type 'fn(anytype) anytype' must be declared comptime |
test/compile_errors/stage1/obj/generic_function_call_assigned_to_incorrect_type.zig+3-1| ... | @@ -6,6 +6,8 @@ fn myAlloc(comptime arg: type) anyerror!arg{ | ... | @@ -6,6 +6,8 @@ fn myAlloc(comptime arg: type) anyerror!arg{ |
| 6 | unreachable; | 6 | unreachable; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // generic function call assigned to incorrect type | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:3:18: error: expected type '[]i32', found 'anyerror!i32 | 13 | // tmp.zig:3:18: error: expected type '[]i32', found 'anyerror!i32 |
test/compile_errors/stage1/obj/generic_function_instance_with_non-constant_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ fn test1(a: i32, b: i32) i32 { | ... | @@ -5,6 +5,8 @@ fn test1(a: i32, b: i32) i32 { |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(test1)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(test1)); } |
| 7 | 7 | ||
| 8 | // generic function instance with non-constant expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:16: error: runtime value cannot be passed to comptime arg | 12 | // tmp.zig:3:16: error: runtime value cannot be passed to comptime arg |
test/compile_errors/stage1/obj/generic_function_returning_opaque_type.zig+3-1| ... | @@ -12,7 +12,9 @@ export fn baz() void { | ... | @@ -12,7 +12,9 @@ export fn baz() void { |
| 12 | _ = generic(@TypeOf(undefined)); | 12 | _ = generic(@TypeOf(undefined)); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // generic function returning opaque type | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed | 19 | // tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed |
| 18 | // tmp.zig:2:1: note: function declared here | 20 | // tmp.zig:2:1: note: function declared here |
test/compile_errors/stage1/obj/generic_function_where_return_type_is_self-referenced.zig+3-1| ... | @@ -8,6 +8,8 @@ export fn entry() void { | ... | @@ -8,6 +8,8 @@ export fn entry() void { |
| 8 | _ = t; | 8 | _ = t; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // generic function where return type is self-referenced | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches | 15 | // tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches |
test/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const some_data: [100]u8 align(3) = undefined; | 1 | const some_data: [100]u8 align(3) = undefined; |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(some_data)); } | 2 | export fn entry() usize { return @sizeOf(@TypeOf(some_data)); } |
| 3 | 3 | ||
| 4 | // global variable alignment non power of 2 | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:32: error: alignment value 3 is not a power of 2 | 8 | // tmp.zig:1:32: error: alignment value 3 is not a power of 2 |
test/compile_errors/stage1/obj/global_variable_initializer_must_be_constant_expression.zig+3-1| ... | @@ -2,6 +2,8 @@ extern fn foo() i32; | ... | @@ -2,6 +2,8 @@ extern fn foo() i32; |
| 2 | const x = foo(); | 2 | const x = foo(); |
| 3 | export fn entry() i32 { return x; } | 3 | export fn entry() i32 { return x; } |
| 4 | 4 | ||
| 5 | // global variable initializer must be constant expression | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:11: error: unable to evaluate constant expression | 9 | // tmp.zig:2:11: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/hasDecl_with_non-container.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | _ = @hasDecl(i32, "hi"); | 2 | _ = @hasDecl(i32, "hi"); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @hasDecl with non-container | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:18: error: expected struct, enum, or union; found 'i32' | 9 | // tmp.zig:2:18: error: expected struct, enum, or union; found 'i32' |
test/compile_errors/stage1/obj/if_condition_is_bool_not_int.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn f() void { | ... | @@ -2,6 +2,8 @@ export fn f() void { |
| 2 | if (0) {} | 2 | if (0) {} |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // if condition is bool, not int | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:9: error: expected type 'bool', found 'comptime_int' | 9 | // tmp.zig:2:9: error: expected type 'bool', found 'comptime_int' |
test/compile_errors/stage1/obj/ignored_assert-err-ok_return_value.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | } | 3 | } |
| 4 | fn bar() anyerror!i32 { return 0; } | 4 | fn bar() anyerror!i32 { return 0; } |
| 5 | 5 | ||
| 6 | // ignored assert-err-ok return value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:11: error: expression value is ignored | 10 | // tmp.zig:2:11: error: expression value is ignored |
test/compile_errors/stage1/obj/ignored_comptime_statement_value.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo() void { | ... | @@ -2,6 +2,8 @@ export fn foo() void { |
| 2 | comptime {1;} | 2 | comptime {1;} |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // ignored comptime statement value | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:15: error: expression value is ignored | 9 | // tmp.zig:2:15: error: expression value is ignored |
test/compile_errors/stage1/obj/ignored_comptime_value.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo() void { | ... | @@ -2,6 +2,8 @@ export fn foo() void { |
| 2 | comptime 1; | 2 | comptime 1; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // ignored comptime value | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: expression value is ignored | 9 | // tmp.zig:2:5: error: expression value is ignored |
test/compile_errors/stage1/obj/ignored_deferred_function_call.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | } | 3 | } |
| 4 | fn bar() anyerror!i32 { return 0; } | 4 | fn bar() anyerror!i32 { return 0; } |
| 5 | 5 | ||
| 6 | // ignored deferred function call | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:14: error: error is ignored. consider using `try`, `catch`, or `if` | 10 | // tmp.zig:2:14: error: error is ignored. consider using `try`, `catch`, or `if` |
test/compile_errors/stage1/obj/ignored_deferred_statement_value.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo() void { | ... | @@ -2,6 +2,8 @@ export fn foo() void { |
| 2 | defer {1;} | 2 | defer {1;} |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // ignored deferred statement value | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:12: error: expression value is ignored | 9 | // tmp.zig:2:12: error: expression value is ignored |
test/compile_errors/stage1/obj/ignored_expression_in_while_continuation.zig+3-1| ... | @@ -13,7 +13,9 @@ fn bad() anyerror!void { | ... | @@ -13,7 +13,9 @@ fn bad() anyerror!void { |
| 13 | return error.Bad; | 13 | return error.Bad; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // ignored expression in while continuation | 16 | // error |
| 17 | // backend=stage1 | ||
| 18 | // target=native | ||
| 17 | // | 19 | // |
| 18 | // tmp.zig:2:24: error: error is ignored. consider using `try`, `catch`, or `if` | 20 | // tmp.zig:2:24: error: error is ignored. consider using `try`, `catch`, or `if` |
| 19 | // tmp.zig:6:25: error: error is ignored. consider using `try`, `catch`, or `if` | 21 | // tmp.zig:6:25: error: error is ignored. consider using `try`, `catch`, or `if` |
test/compile_errors/stage1/obj/ignored_return_value.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | } | 3 | } |
| 4 | fn bar() i32 { return 0; } | 4 | fn bar() i32 { return 0; } |
| 5 | 5 | ||
| 6 | // ignored return value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:8: error: expression value is ignored | 10 | // tmp.zig:2:8: error: expression value is ignored |
test/compile_errors/stage1/obj/ignored_statement_value.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo() void { | ... | @@ -2,6 +2,8 @@ export fn foo() void { |
| 2 | 1; | 2 | 1; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // ignored statement value | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: expression value is ignored | 9 | // tmp.zig:2:5: error: expression value is ignored |
test/compile_errors/stage1/obj/illegal_comparison_of_types.zig+3-1| ... | @@ -12,7 +12,9 @@ fn bad_eql_2(a: *const EnumWithData, b: *const EnumWithData) bool { | ... | @@ -12,7 +12,9 @@ fn bad_eql_2(a: *const EnumWithData, b: *const EnumWithData) bool { |
| 12 | export fn entry1() usize { return @sizeOf(@TypeOf(bad_eql_1)); } | 12 | export fn entry1() usize { return @sizeOf(@TypeOf(bad_eql_1)); } |
| 13 | export fn entry2() usize { return @sizeOf(@TypeOf(bad_eql_2)); } | 13 | export fn entry2() usize { return @sizeOf(@TypeOf(bad_eql_2)); } |
| 14 | 14 | ||
| 15 | // illegal comparison of types | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:2:14: error: operator not allowed for type '[]u8' | 19 | // tmp.zig:2:14: error: operator not allowed for type '[]u8' |
| 18 | // tmp.zig:9:16: error: operator not allowed for type 'EnumWithData' | 20 | // tmp.zig:9:16: error: operator not allowed for type 'EnumWithData' |
test/compile_errors/stage1/obj/implicit_cast_between_C_pointer_and_Zig_pointer-bad_const-align-child.zig+3-1| ... | @@ -29,7 +29,9 @@ export fn f() void { | ... | @@ -29,7 +29,9 @@ export fn f() void { |
| 29 | _ = x; | 29 | _ = x; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | // implicit cast between C pointer and Zig pointer - bad const/align/child | 32 | // error |
| 33 | // backend=stage1 | ||
| 34 | // target=native | ||
| 33 | // | 35 | // |
| 34 | // tmp.zig:3:27: error: cast increases pointer alignment | 36 | // tmp.zig:3:27: error: cast increases pointer alignment |
| 35 | // tmp.zig:8:18: error: cast discards const qualifier | 37 | // tmp.zig:8:18: error: cast discards const qualifier |
test/compile_errors/stage1/obj/implicit_cast_const_array_to_mutable_slice.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn entry() void { | ... | @@ -4,7 +4,9 @@ export fn entry() void { |
| 4 | _ = sliceA; | 4 | _ = sliceA; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // implicit cast const array to mutable slice | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:27: error: cannot cast pointer to array literal to slice type '[]u8' | 11 | // tmp.zig:3:27: error: cannot cast pointer to array literal to slice type '[]u8' |
| 10 | // tmp.zig:3:27: note: cast discards const qualifier | 12 | // tmp.zig:3:27: note: cast discards const qualifier |
test/compile_errors/stage1/obj/implicit_cast_from_array_to_mutable_slice.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | foo(global_array); | 4 | foo(global_array); |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // implicit cast from array to mutable slice | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:4:9: error: expected type '[]i32', found '[10]i32' | 11 | // tmp.zig:4:9: error: expected type '[]i32', found '[10]i32' |
test/compile_errors/stage1/obj/implicit_cast_from_f64_to_f32.zig+3-1| ... | @@ -3,6 +3,8 @@ var y: f32 = x; | ... | @@ -3,6 +3,8 @@ var y: f32 = x; |
| 3 | 3 | ||
| 4 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } | 4 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } |
| 5 | 5 | ||
| 6 | // implicit cast from f64 to f32 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:14: error: expected type 'f32', found 'f64' | 10 | // tmp.zig:2:14: error: expected type 'f32', found 'f64' |
test/compile_errors/stage1/obj/implicit_cast_of_error_set_not_a_subset.zig+3-1| ... | @@ -8,7 +8,9 @@ fn foo(set1: Set1) void { | ... | @@ -8,7 +8,9 @@ fn foo(set1: Set1) void { |
| 8 | _ = x; | 8 | _ = x; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // implicit cast of error set not a subset | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:7:19: error: expected type 'Set2', found 'Set1' | 15 | // tmp.zig:7:19: error: expected type 'Set2', found 'Set1' |
| 14 | // tmp.zig:1:23: note: 'error.B' not a member of destination error set | 16 | // tmp.zig:1:23: note: 'error.B' not a member of destination error set |
test/compile_errors/stage1/obj/implicit_casting_C_pointers_which_would_mess_up_null_semantics.zig+3-1| ... | @@ -14,7 +14,9 @@ export fn entry2() void { | ... | @@ -14,7 +14,9 @@ export fn entry2() void { |
| 14 | _ = c_ptr; | 14 | _ = c_ptr; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // implicit casting C pointers which would mess up null semantics | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8' | 21 | // tmp.zig:6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8' |
| 20 | // tmp.zig:6:24: note: pointer type child '[*c]const u8' cannot cast into pointer type child '[*]const u8' | 22 | // tmp.zig:6:24: note: pointer type child '[*c]const u8' cannot cast into pointer type child '[*]const u8' |
test/compile_errors/stage1/obj/implicit_casting_null_c_pointer_to_zig_pointer.zig+3-1| ... | @@ -4,6 +4,8 @@ comptime { | ... | @@ -4,6 +4,8 @@ comptime { |
| 4 | _ = zig_ptr; | 4 | _ = zig_ptr; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // implicit casting null c pointer to zig pointer | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:24: error: null pointer casted to type '*u8' | 11 | // tmp.zig:3:24: error: null pointer casted to type '*u8' |
test/compile_errors/stage1/obj/implicit_casting_too_big_integers_to_C_pointers.zig+3-1| ... | @@ -8,7 +8,9 @@ export fn b() void { | ... | @@ -8,7 +8,9 @@ export fn b() void { |
| 8 | _ = ptr; | 8 | _ = ptr; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // implicit casting too big integers to C pointers | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:2:33: error: integer value 18446744073709551617 cannot be coerced to type 'usize' | 15 | // tmp.zig:2:33: error: integer value 18446744073709551617 cannot be coerced to type 'usize' |
| 14 | // tmp.zig:7:23: error: integer type 'u65' too big for implicit @intToPtr to type '[*c]u8' | 16 | // tmp.zig:7:23: error: integer type 'u65' too big for implicit @intToPtr to type '[*c]u8' |
test/compile_errors/stage1/obj/implicit_casting_undefined_c_pointer_to_zig_pointer.zig+3-1| ... | @@ -4,6 +4,8 @@ comptime { | ... | @@ -4,6 +4,8 @@ comptime { |
| 4 | _ = zig_ptr; | 4 | _ = zig_ptr; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // implicit casting undefined c pointer to zig pointer | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:24: error: use of undefined value here causes undefined behavior | 11 | // tmp.zig:3:24: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/implicit_dependency_on_libc.zig created+11| ... | @@ -0,0 +1,11 @@ | ||
| 1 | extern "c" fn exit(u8) void; | ||
| 2 | export fn entry() void { | ||
| 3 | exit(0); | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage1 | ||
| 8 | // target=native-linux | ||
| 9 | // is_test=1 | ||
| 10 | // | ||
| 11 | // tmp.zig:3:5: error: dependency on libc must be explicitly specified in the build command | ||
test/compile_errors/stage1/obj/implicit_semicolon-block_expr.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - block expr | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:11: error: expected ';' after statement | 12 | // tmp.zig:4:11: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-block_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - block statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:9: error: expected ';' after statement | 12 | // tmp.zig:4:9: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-comptime_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - comptime expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:20: error: expected ';' after statement | 12 | // tmp.zig:4:20: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-comptime_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - comptime statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:18: error: expected ';' after statement | 12 | // tmp.zig:4:18: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-defer.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - defer | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:15: error: expected ';' after statement | 12 | // tmp.zig:4:15: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-for_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - for expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:26: error: expected ';' after statement | 12 | // tmp.zig:4:26: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-for_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - for statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:24: error: expected ';' or 'else' after statement | 12 | // tmp.zig:4:24: error: expected ';' or 'else' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - if-else-if-else expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:45: error: expected ';' after statement | 12 | // tmp.zig:4:45: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - if-else-if-else statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:47: error: expected ';' after statement | 12 | // tmp.zig:4:47: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - if-else-if expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:37: error: expected ';' after statement | 12 | // tmp.zig:4:37: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - if-else-if statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:37: error: expected ';' or 'else' after statement | 12 | // tmp.zig:4:37: error: expected ';' or 'else' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-if-else_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - if-else expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:28: error: expected ';' after statement | 12 | // tmp.zig:4:28: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-if-else_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - if-else statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:28: error: expected ';' after statement | 12 | // tmp.zig:4:28: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-if_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - if expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:20: error: expected ';' after statement | 12 | // tmp.zig:4:20: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-if_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - if statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:18: error: expected ';' or 'else' after statement | 12 | // tmp.zig:4:18: error: expected ';' or 'else' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-test_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - test expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:26: error: expected ';' after statement | 12 | // tmp.zig:4:26: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-test_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - test statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:24: error: expected ';' or 'else' after statement | 12 | // tmp.zig:4:24: error: expected ';' or 'else' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-while-continue_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - while-continue expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:28: error: expected ';' after statement | 12 | // tmp.zig:4:28: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-while-continue_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - while-continue statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:26: error: expected ';' or 'else' after statement | 12 | // tmp.zig:4:26: error: expected ';' or 'else' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-while_expression.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - while expression | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:23: error: expected ';' after statement | 12 | // tmp.zig:4:23: error: expected ';' after statement |
test/compile_errors/stage1/obj/implicit_semicolon-while_statement.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | var bad = {}; | 5 | var bad = {}; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // implicit semicolon - while statement | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:18: error: expected ';' or 'else' after statement | 12 | // tmp.zig:4:18: error: expected ';' or 'else' after statement |
test/compile_errors/stage1/obj/implicitly_casting_enum_to_tag_type.zig+3-1| ... | @@ -10,6 +10,8 @@ export fn entry() void { | ... | @@ -10,6 +10,8 @@ export fn entry() void { |
| 10 | _ = x; | 10 | _ = x; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // implicitly casting enum to tag type | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:9:22: error: expected type 'u2', found 'Small' | 17 | // tmp.zig:9:22: error: expected type 'u2', found 'Small' |
test/compile_errors/stage1/obj/implicitly_increasing_pointer_alignment.zig+3-1| ... | @@ -12,6 +12,8 @@ fn bar(x: *u32) void { | ... | @@ -12,6 +12,8 @@ fn bar(x: *u32) void { |
| 12 | x.* += 1; | 12 | x.* += 1; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // implicitly increasing pointer alignment | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:8:13: error: expected type '*u32', found '*align(1) u32' | 19 | // tmp.zig:8:13: error: expected type '*u32', found '*align(1) u32' |
test/compile_errors/stage1/obj/implicitly_increasing_slice_alignment.zig+3-1| ... | @@ -13,7 +13,9 @@ fn bar(x: []u32) void { | ... | @@ -13,7 +13,9 @@ fn bar(x: []u32) void { |
| 13 | x[0] += 1; | 13 | x[0] += 1; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // implicitly increasing slice alignment | 16 | // error |
| 17 | // backend=stage1 | ||
| 18 | // target=native | ||
| 17 | // | 19 | // |
| 18 | // tmp.zig:9:26: error: cast increases pointer alignment | 20 | // tmp.zig:9:26: error: cast increases pointer alignment |
| 19 | // tmp.zig:9:26: note: '*align(1) u32' has alignment 1 | 21 | // tmp.zig:9:26: note: '*align(1) u32' has alignment 1 |
test/compile_errors/stage1/obj/import_outside_package_path.zig+3-1| ... | @@ -2,6 +2,8 @@ comptime{ | ... | @@ -2,6 +2,8 @@ comptime{ |
| 2 | _ = @import("../a.zig"); | 2 | _ = @import("../a.zig"); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // import outside package path | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:9: error: import of file outside package path: '../a.zig' | 9 | // tmp.zig:2:9: error: import of file outside package path: '../a.zig' |
test/compile_errors/stage1/obj/incompatible_sentinels.zig created+29| ... | @@ -0,0 +1,29 @@ | ||
| 1 | // Note: One of the error messages here is backwards. It would be nice to fix, but that's not | ||
| 2 | // going to stop me from merging this branch which fixes a bunch of other stuff. | ||
| 3 | export fn entry1(ptr: [*:255]u8) [*:0]u8 { | ||
| 4 | return ptr; | ||
| 5 | } | ||
| 6 | export fn entry2(ptr: [*]u8) [*:0]u8 { | ||
| 7 | return ptr; | ||
| 8 | } | ||
| 9 | export fn entry3() void { | ||
| 10 | var array: [2:0]u8 = [_:255]u8{ 1, 2 }; | ||
| 11 | _ = array; | ||
| 12 | } | ||
| 13 | export fn entry4() void { | ||
| 14 | var array: [2:0]u8 = [_]u8{ 1, 2 }; | ||
| 15 | _ = array; | ||
| 16 | } | ||
| 17 | |||
| 18 | // error | ||
| 19 | // backend=stage1 | ||
| 20 | // target=native | ||
| 21 | // | ||
| 22 | // tmp.zig:4:12: error: expected type '[*:0]u8', found '[*:255]u8' | ||
| 23 | // tmp.zig:4:12: note: destination pointer requires a terminating '0' sentinel, but source pointer has a terminating '255' sentinel | ||
| 24 | // tmp.zig:7:12: error: expected type '[*:0]u8', found '[*]u8' | ||
| 25 | // tmp.zig:7:12: note: destination pointer requires a terminating '0' sentinel | ||
| 26 | // tmp.zig:10:35: error: expected type '[2:255]u8', found '[2:0]u8' | ||
| 27 | // tmp.zig:10:35: note: destination array requires a terminating '255' sentinel, but source array has a terminating '0' sentinel | ||
| 28 | // tmp.zig:14:31: error: expected type '[2:0]u8', found '[2]u8' | ||
| 29 | // tmp.zig:14:31: note: destination array requires a terminating '0' sentinel | ||
test/compile_errors/stage1/obj/incorrect_return_type.zig+3-1| ... | @@ -14,6 +14,8 @@ | ... | @@ -14,6 +14,8 @@ |
| 14 | unreachable; | 14 | unreachable; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // incorrect return type | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:8:16: error: expected type 'A', found 'B' | 21 | // tmp.zig:8:16: error: expected type 'A', found 'B' |
test/compile_errors/stage1/obj/increase_pointer_alignment_in_ptrCast.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn entry() u32 { | ... | @@ -4,7 +4,9 @@ export fn entry() u32 { |
| 4 | return ptr.*; | 4 | return ptr.*; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // increase pointer alignment in @ptrCast | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:17: error: cast increases pointer alignment | 11 | // tmp.zig:3:17: error: cast increases pointer alignment |
| 10 | // tmp.zig:3:38: note: '*u8' has alignment 1 | 12 | // tmp.zig:3:38: note: '*u8' has alignment 1 |
test/compile_errors/stage1/obj/indexing_a_undefined_slice_at_comptime.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | slice[0] = 2; | 3 | slice[0] = 2; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // indexing a undefined slice at comptime | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:10: error: index 0 outside slice of size 0 | 10 | // tmp.zig:3:10: error: index 0 outside slice of size 0 |
test/compile_errors/stage1/obj/indexing_an_array_of_size_zero.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn foo() void { | ... | @@ -4,6 +4,8 @@ export fn foo() void { |
| 4 | _ = pointer; | 4 | _ = pointer; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // indexing an array of size zero | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:27: error: accessing a zero length array is not allowed | 11 | // tmp.zig:3:27: error: accessing a zero length array is not allowed |
test/compile_errors/stage1/obj/indexing_an_array_of_size_zero_with_runtime_index.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn foo() void { | ... | @@ -5,6 +5,8 @@ export fn foo() void { |
| 5 | _ = pointer; | 5 | _ = pointer; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // indexing an array of size zero with runtime index | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:27: error: accessing a zero length array is not allowed | 12 | // tmp.zig:4:27: error: accessing a zero length array is not allowed |
test/compile_errors/stage1/obj/indexing_single-item_pointer.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry(ptr: *i32) i32 { | ... | @@ -2,6 +2,8 @@ export fn entry(ptr: *i32) i32 { |
| 2 | return ptr[1]; | 2 | return ptr[1]; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // indexing single-item pointer | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:15: error: index of single-item pointer | 9 | // tmp.zig:2:15: error: index of single-item pointer |
test/compile_errors/stage1/obj/indirect_recursion_of_async_functions_detected.zig+3-1| ... | @@ -27,7 +27,9 @@ fn rangeSumIndirect(x: i32) i32 { | ... | @@ -27,7 +27,9 @@ fn rangeSumIndirect(x: i32) i32 { |
| 27 | return child + 1; | 27 | return child + 1; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | // indirect recursion of async functions detected | 30 | // error |
| 31 | // backend=stage1 | ||
| 32 | // target=native | ||
| 31 | // | 33 | // |
| 32 | // tmp.zig:8:1: error: '@Frame(rangeSum)' depends on itself | 34 | // tmp.zig:8:1: error: '@Frame(rangeSum)' depends on itself |
| 33 | // tmp.zig:15:33: note: when analyzing type '@Frame(rangeSum)' here | 35 | // tmp.zig:15:33: note: when analyzing type '@Frame(rangeSum)' here |
test/compile_errors/stage1/obj/indirect_struct_loop.zig+3-1| ... | @@ -3,6 +3,8 @@ const B = struct { c : C, }; | ... | @@ -3,6 +3,8 @@ const B = struct { c : C, }; |
| 3 | const C = struct { a : A, }; | 3 | const C = struct { a : A, }; |
| 4 | export fn entry() usize { return @sizeOf(A); } | 4 | export fn entry() usize { return @sizeOf(A); } |
| 5 | 5 | ||
| 6 | // indirect struct loop | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:1:11: error: struct 'A' depends on itself | 10 | // tmp.zig:1:11: error: struct 'A' depends on itself |
test/compile_errors/stage1/obj/inferred_array_size_invalid_here.zig+3-1| ... | @@ -8,7 +8,9 @@ export fn entry2() void { | ... | @@ -8,7 +8,9 @@ export fn entry2() void { |
| 8 | _ = a; | 8 | _ = a; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // inferred array size invalid here | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:2:16: error: unable to infer array size | 15 | // tmp.zig:2:16: error: unable to infer array size |
| 14 | // tmp.zig:6:35: error: unable to infer array size | 16 | // tmp.zig:6:35: error: unable to infer array size |
test/compile_errors/stage1/obj/inferring_error_set_of_function_pointer.zig+3-1| ... | @@ -2,6 +2,8 @@ comptime { | ... | @@ -2,6 +2,8 @@ comptime { |
| 2 | const z: ?fn()!void = null; | 2 | const z: ?fn()!void = null; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // inferring error set of function pointer | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:19: error: function prototype may not have inferred error set | 9 | // tmp.zig:2:19: error: function prototype may not have inferred error set |
test/compile_errors/stage1/obj/initializing_array_with_struct_syntax.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // initializing array with struct syntax | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: initializing array with struct syntax | 10 | // tmp.zig:2:15: error: initializing array with struct syntax |
test/compile_errors/stage1/obj/instantiating_an_undefined_value_for_an_invalid_struct_that_contains_itself.zig+3-1| ... | @@ -8,6 +8,8 @@ export fn entry() usize { | ... | @@ -8,6 +8,8 @@ export fn entry() usize { |
| 8 | return @sizeOf(@TypeOf(foo.x)); | 8 | return @sizeOf(@TypeOf(foo.x)); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // instantiating an undefined value for an invalid struct that contains itself | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:1:13: error: struct 'Foo' depends on itself | 15 | // tmp.zig:1:13: error: struct 'Foo' depends on itself |
test/compile_errors/stage1/obj/intToPtr_with_misaligned_address.zig+3-1| ... | @@ -3,6 +3,8 @@ pub fn main() void { | ... | @@ -3,6 +3,8 @@ pub fn main() void { |
| 3 | _ = y; | 3 | _ = y; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // intToPtr with misaligned address | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:13: error: pointer type '[*]align(4) u8' requires aligned address | 10 | // tmp.zig:2:13: error: pointer type '[*]align(4) u8' requires aligned address |
test/compile_errors/stage1/obj/int_to_err_global_invalid_number.zig+3-1| ... | @@ -8,6 +8,8 @@ comptime { | ... | @@ -8,6 +8,8 @@ comptime { |
| 8 | _ = y; | 8 | _ = y; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // int to err global invalid number | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:7:13: error: integer value 3 represents no error | 15 | // tmp.zig:7:13: error: integer value 3 represents no error |
test/compile_errors/stage1/obj/int_to_err_non_global_invalid_number.zig+3-1| ... | @@ -12,6 +12,8 @@ comptime { | ... | @@ -12,6 +12,8 @@ comptime { |
| 12 | _ = y; | 12 | _ = y; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // int to err non global invalid number | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:11:13: error: error.B not a member of error set 'Set2' | 19 | // tmp.zig:11:13: error: error.B not a member of error set 'Set2' |
test/compile_errors/stage1/obj/int_to_ptr_of_0_bits.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn foo() void { | ... | @@ -4,6 +4,8 @@ export fn foo() void { |
| 4 | _ = y; | 4 | _ = y; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // int to ptr of 0 bits | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:30: error: type '*void' has 0 bits and cannot store information | 11 | // tmp.zig:3:30: error: type '*void' has 0 bits and cannot store information |
test/compile_errors/stage1/obj/integer_cast_truncates_bits.zig+3-1| ... | @@ -19,7 +19,9 @@ export fn entry4() void { | ... | @@ -19,7 +19,9 @@ export fn entry4() void { |
| 19 | _ = unsigned; | 19 | _ = unsigned; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | // integer cast truncates bits | 22 | // error |
| 23 | // backend=stage1 | ||
| 24 | // target=native | ||
| 23 | // | 25 | // |
| 24 | // tmp.zig:3:18: error: cast from 'u16' to 'u8' truncates bits | 26 | // tmp.zig:3:18: error: cast from 'u16' to 'u8' truncates bits |
| 25 | // tmp.zig:8:22: error: integer value 300 cannot be coerced to type 'u8' | 27 | // tmp.zig:8:22: error: integer value 300 cannot be coerced to type 'u8' |
test/compile_errors/stage1/obj/integer_overflow_error.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const x : u8 = 300; | 1 | const x : u8 = 300; |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } | 2 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } |
| 3 | 3 | ||
| 4 | // integer overflow error | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:16: error: integer value 300 cannot be coerced to type 'u8' | 8 | // tmp.zig:1:16: error: integer value 300 cannot be coerced to type 'u8' |
test/compile_errors/stage1/obj/integer_underflow_error.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | _ = @intToPtr(*anyopaque, ~@as(usize, @import("std").math.maxInt(usize)) - 1); | 2 | _ = @intToPtr(*anyopaque, ~@as(usize, @import("std").math.maxInt(usize)) - 1); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // integer underflow error | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // :2:78: error: operation caused overflow | 9 | // :2:78: error: operation caused overflow |
test/compile_errors/stage1/obj/invalid_break_expression.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn f() void { | ... | @@ -2,6 +2,8 @@ export fn f() void { |
| 2 | break; | 2 | break; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // invalid break expression | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: break expression outside loop | 9 | // tmp.zig:2:5: error: break expression outside loop |
test/compile_errors/stage1/obj/invalid_builtin_fn.zig+3-1| ... | @@ -2,6 +2,8 @@ fn f() @bogus(foo) { | ... | @@ -2,6 +2,8 @@ fn f() @bogus(foo) { |
| 2 | } | 2 | } |
| 3 | export fn entry() void { _ = f(); } | 3 | export fn entry() void { _ = f(); } |
| 4 | 4 | ||
| 5 | // invalid builtin fn | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:1:8: error: invalid builtin function: '@bogus' | 9 | // tmp.zig:1:8: error: invalid builtin function: '@bogus' |
test/compile_errors/stage1/obj/invalid_cast_from_integral_type_to_enum.zig+3-1| ... | @@ -10,6 +10,8 @@ fn foo(x: usize) void { | ... | @@ -10,6 +10,8 @@ fn foo(x: usize) void { |
| 10 | } | 10 | } |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // invalid cast from integral type to enum | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:9:10: error: expected type 'usize', found 'E' | 17 | // tmp.zig:9:10: error: expected type 'usize', found 'E' |
test/compile_errors/stage1/obj/invalid_comparison_for_function_pointers.zig+3-1| ... | @@ -3,6 +3,8 @@ const invalid = foo > foo; | ... | @@ -3,6 +3,8 @@ const invalid = foo > foo; |
| 3 | 3 | ||
| 4 | export fn entry() usize { return @sizeOf(@TypeOf(invalid)); } | 4 | export fn entry() usize { return @sizeOf(@TypeOf(invalid)); } |
| 5 | 5 | ||
| 6 | // invalid comparison for function pointers | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: operator not allowed for type 'fn() void' | 10 | // tmp.zig:2:21: error: operator not allowed for type 'fn() void' |
test/compile_errors/stage1/obj/invalid_continue_expression.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn f() void { | ... | @@ -2,6 +2,8 @@ export fn f() void { |
| 2 | continue; | 2 | continue; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // invalid continue expression | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: continue expression outside loop | 9 | // tmp.zig:2:5: error: continue expression outside loop |
test/compile_errors/stage1/obj/invalid_deref_on_switch_target.zig+3-1| ... | @@ -10,6 +10,8 @@ const Tile = enum { | ... | @@ -10,6 +10,8 @@ const Tile = enum { |
| 10 | Filled, | 10 | Filled, |
| 11 | }; | 11 | }; |
| 12 | 12 | ||
| 13 | // invalid deref on switch target | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:3:17: error: attempt to dereference non-pointer type 'Tile' | 17 | // tmp.zig:3:17: error: attempt to dereference non-pointer type 'Tile' |
test/compile_errors/stage1/obj/invalid_empty_unicode_escape.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | const a = '\u{}'; | 2 | const a = '\u{}'; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // invalid empty unicode escape | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:19: error: empty unicode escape sequence | 9 | // tmp.zig:2:19: error: empty unicode escape sequence |
test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-1.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid exponent in float literal - 1 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:28: note: invalid byte: 'a' | 11 | // tmp.zig:2:28: note: invalid byte: 'a' |
test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-2.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid exponent in float literal - 2 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:29: note: invalid byte: 'F' | 11 | // tmp.zig:2:29: note: invalid byte: 'F' |
test/compile_errors/stage1/obj/invalid_field_access_in_comptime.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | comptime { var x = doesnt_exist.whatever; _ = x; } | 1 | comptime { var x = doesnt_exist.whatever; _ = x; } |
| 2 | 2 | ||
| 3 | // invalid field access in comptime | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:20: error: use of undeclared identifier 'doesnt_exist' | 7 | // tmp.zig:1:20: error: use of undeclared identifier 'doesnt_exist' |
test/compile_errors/stage1/obj/invalid_field_in_struct_value_expression.zig+3-1| ... | @@ -12,6 +12,8 @@ export fn f() void { | ... | @@ -12,6 +12,8 @@ export fn f() void { |
| 12 | _ = a; | 12 | _ = a; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // invalid field in struct value expression | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:10:9: error: no member named 'foo' in struct 'A' | 19 | // tmp.zig:10:9: error: no member named 'foo' in struct 'A' |
test/compile_errors/stage1/obj/invalid_float_literal.zig+3-1| ... | @@ -6,6 +6,8 @@ pub fn main() void { | ... | @@ -6,6 +6,8 @@ pub fn main() void { |
| 6 | std.debug.assert(bad_float < 1.0); | 6 | std.debug.assert(bad_float < 1.0); |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // invalid float literal | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:29: error: expected expression, found '.' | 13 | // tmp.zig:5:29: error: expected expression, found '.' |
test/compile_errors/stage1/obj/invalid_legacy_unicode_escape.zig+3-1| ... | @@ -2,7 +2,9 @@ export fn entry() void { | ... | @@ -2,7 +2,9 @@ export fn entry() void { |
| 2 | const a = '\U1234'; | 2 | const a = '\U1234'; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // invalid legacy unicode escape | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:15: error: expected expression, found 'invalid bytes' | 9 | // tmp.zig:2:15: error: expected expression, found 'invalid bytes' |
| 8 | // tmp.zig:2:18: note: invalid byte: '1' | 10 | // tmp.zig:2:18: note: invalid byte: '1' |
test/compile_errors/stage1/obj/invalid_maybe_type.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn f() void { | ... | @@ -2,6 +2,8 @@ export fn f() void { |
| 2 | if (true) |x| { _ = x; } | 2 | if (true) |x| { _ = x; } |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // invalid maybe type | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:9: error: expected optional type, found 'bool' | 9 | // tmp.zig:2:9: error: expected optional type, found 'bool' |
test/compile_errors/stage1/obj/invalid_member_of_builtin_enum.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | _ = foo; | 4 | _ = foo; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // invalid member of builtin enum | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:29: error: container 'std.builtin.Mode' has no member called 'x86' | 11 | // tmp.zig:3:29: error: container 'std.builtin.Mode' has no member called 'x86' |
test/compile_errors/stage1/obj/invalid_multiple_dereferences.zig+3-1| ... | @@ -11,7 +11,9 @@ pub const Box = struct { | ... | @@ -11,7 +11,9 @@ pub const Box = struct { |
| 11 | field: i32, | 11 | field: i32, |
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | // invalid multiple dereferences | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:3:8: error: attempt to dereference non-pointer type 'Box' | 18 | // tmp.zig:3:8: error: attempt to dereference non-pointer type 'Box' |
| 17 | // tmp.zig:8:13: error: attempt to dereference non-pointer type 'Box' | 19 | // tmp.zig:8:13: error: attempt to dereference non-pointer type 'Box' |
test/compile_errors/stage1/obj/invalid_optional_type_in_extern_struct.zig+3-1| ... | @@ -3,6 +3,8 @@ const stroo = extern struct { | ... | @@ -3,6 +3,8 @@ const stroo = extern struct { |
| 3 | }; | 3 | }; |
| 4 | export fn testf(fluff: *stroo) void { _ = fluff; } | 4 | export fn testf(fluff: *stroo) void { _ = fluff; } |
| 5 | 5 | ||
| 6 | // invalid optional type in extern struct | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:5: error: extern structs cannot contain fields of type '?[*c]u8' | 10 | // tmp.zig:2:5: error: extern structs cannot contain fields of type '?[*c]u8' |
test/compile_errors/stage1/obj/invalid_pointer_for_var_type.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn f() void { | ... | @@ -6,6 +6,8 @@ export fn f() void { |
| 6 | } | 6 | } |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // invalid pointer for var type | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:2:13: error: unable to evaluate constant expression | 13 | // tmp.zig:2:13: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/invalid_pointer_syntax.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo() void { | ... | @@ -2,6 +2,8 @@ export fn foo() void { |
| 2 | var guid: *:0 const u8 = undefined; | 2 | var guid: *:0 const u8 = undefined; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // invalid pointer syntax | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:16: error: expected type expression, found ':' | 9 | // tmp.zig:2:16: error: expected type expression, found ':' |
test/compile_errors/stage1/obj/invalid_shift_amount_error.zig+3-1| ... | @@ -4,6 +4,8 @@ fn f() u16 { | ... | @@ -4,6 +4,8 @@ fn f() u16 { |
| 4 | } | 4 | } |
| 5 | export fn entry() u16 { return f(); } | 5 | export fn entry() u16 { return f(); } |
| 6 | 6 | ||
| 7 | // invalid shift amount error | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:17: error: integer value 8 cannot be coerced to type 'u3' | 11 | // tmp.zig:3:17: error: integer value 8 cannot be coerced to type 'u3' |
test/compile_errors/stage1/obj/invalid_struct_field.zig+3-1| ... | @@ -11,7 +11,9 @@ export fn g() void { | ... | @@ -11,7 +11,9 @@ export fn g() void { |
| 11 | _ = y; | 11 | _ = y; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // invalid struct field | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:4:6: error: no member named 'foo' in struct 'A' | 18 | // tmp.zig:4:6: error: no member named 'foo' in struct 'A' |
| 17 | // tmp.zig:10:16: error: no member named 'bar' in struct 'A' | 19 | // tmp.zig:10:16: error: no member named 'bar' in struct 'A' |
test/compile_errors/stage1/obj/invalid_suspend_in_exported_function.zig+3-1| ... | @@ -7,7 +7,9 @@ fn func() void { | ... | @@ -7,7 +7,9 @@ fn func() void { |
| 7 | suspend {} | 7 | suspend {} |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // invalid suspend in exported function | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async | 14 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async |
| 13 | // tmp.zig:3:18: note: await here is a suspend point | 15 | // tmp.zig:3:18: note: await here is a suspend point |
test/compile_errors/stage1/obj/invalid_type.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn a() bogus {} | 1 | fn a() bogus {} |
| 2 | export fn entry() void { _ = a(); } | 2 | export fn entry() void { _ = a(); } |
| 3 | 3 | ||
| 4 | // invalid type | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:8: error: use of undeclared identifier 'bogus' | 8 | // tmp.zig:1:8: error: use of undeclared identifier 'bogus' |
test/compile_errors/stage1/obj/invalid_type_used_in_array_type.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry() void { | ... | @@ -7,6 +7,8 @@ export fn entry() void { |
| 7 | _ = a; | 7 | _ = a; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // invalid type used in array type | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:2:12: error: use of undeclared identifier 'SomeNonexistentType' | 14 | // tmp.zig:2:12: error: use of undeclared identifier 'SomeNonexistentType' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-1.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 1 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:23: note: invalid byte: '_' | 11 | // tmp.zig:2:23: note: invalid byte: '_' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-10.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 10 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:25: note: invalid byte: '_' | 11 | // tmp.zig:2:25: note: invalid byte: '_' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-11.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 11 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:28: note: invalid byte: '_' | 11 | // tmp.zig:2:28: note: invalid byte: '_' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-12.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 12 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:23: note: invalid byte: 'x' | 11 | // tmp.zig:2:23: note: invalid byte: 'x' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-13.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 13 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:23: note: invalid byte: '_' | 11 | // tmp.zig:2:23: note: invalid byte: '_' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-14.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 14 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:27: note: invalid byte: 'p' | 11 | // tmp.zig:2:27: note: invalid byte: 'p' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-2.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 2 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:23: note: invalid byte: '.' | 11 | // tmp.zig:2:23: note: invalid byte: '.' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-3.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 3 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:25: note: invalid byte: ';' | 11 | // tmp.zig:2:25: note: invalid byte: ';' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-4.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 4 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:25: note: invalid byte: '_' | 11 | // tmp.zig:2:25: note: invalid byte: '_' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-5.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 5 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:26: note: invalid byte: '_' | 11 | // tmp.zig:2:26: note: invalid byte: '_' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-6.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 6 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:26: note: invalid byte: '_' | 11 | // tmp.zig:2:26: note: invalid byte: '_' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-7.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 7 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:28: note: invalid byte: ';' | 11 | // tmp.zig:2:28: note: invalid byte: ';' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-9.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in float literal - 9 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:23: note: invalid byte: '_' | 11 | // tmp.zig:2:23: note: invalid byte: '_' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-1.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in int literal - 1 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:26: note: invalid byte: ';' | 11 | // tmp.zig:2:26: note: invalid byte: ';' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-2.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in int literal - 2 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:28: note: invalid byte: ';' | 11 | // tmp.zig:2:28: note: invalid byte: ';' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-3.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in int literal - 3 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:28: note: invalid byte: ';' | 11 | // tmp.zig:2:28: note: invalid byte: ';' |
test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-4.zig+3-1| ... | @@ -3,7 +3,9 @@ fn main() void { | ... | @@ -3,7 +3,9 @@ fn main() void { |
| 3 | _ = bad; | 3 | _ = bad; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // invalid underscore placement in int literal - 4 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' | 10 | // tmp.zig:2:21: error: expected expression, found 'invalid bytes' |
| 9 | // tmp.zig:2:28: note: invalid byte: ';' | 11 | // tmp.zig:2:28: note: invalid byte: ';' |
test/compile_errors/stage1/obj/invalid_union_field_access_in_comptime.zig+3-1| ... | @@ -8,6 +8,8 @@ comptime { | ... | @@ -8,6 +8,8 @@ comptime { |
| 8 | _ = bar_val; | 8 | _ = bar_val; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // invalid union field access in comptime | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set | 15 | // tmp.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set |
test/compile_errors/stage1/obj/issue_2032_compile_diagnostic_string_for_top_level_decl_type.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = foo; | 3 | _ = foo; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // compile diagnostic string for top level decl type (issue 2032) | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:27: error: type 'u32' does not support array initialization | 10 | // tmp.zig:2:27: error: type 'u32' does not support array initialization |
test/compile_errors/stage1/obj/issue_2687_coerce_from_undefined_array_pointer_to_slice.zig+3-1| ... | @@ -18,7 +18,9 @@ export fn foo3() void { | ... | @@ -18,7 +18,9 @@ export fn foo3() void { |
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | // issue #2687: coerce from undefined array pointer to slice | 21 | // error |
| 22 | // backend=stage1 | ||
| 23 | // target=native | ||
| 22 | // | 24 | // |
| 23 | // tmp.zig:3:19: error: use of undefined value here causes undefined behavior | 25 | // tmp.zig:3:19: error: use of undefined value here causes undefined behavior |
| 24 | // tmp.zig:9:23: error: use of undefined value here causes undefined behavior | 26 | // tmp.zig:9:23: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/issue_3818_bitcast_from_parray-slice_to_u16.zig+3-1| ... | @@ -9,7 +9,9 @@ export fn foo2() void { | ... | @@ -9,7 +9,9 @@ export fn foo2() void { |
| 9 | _ = word; | 9 | _ = word; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // issue #3818: bitcast from parray/slice to u16 | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8' | 16 | // tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8' |
| 15 | // tmp.zig:8:32: error: destination type 'u16' has size 2 but source type '[]const u8' has size 16 | 17 | // tmp.zig:8:32: error: destination type 'u16' has size 2 but source type '[]const u8' has size 16 |
test/compile_errors/stage1/obj/issue_4207_coerce_from_non-terminated-slice_to_terminated-pointer.zig+3-1| ... | @@ -3,7 +3,9 @@ export fn foo() [*:0]const u8 { | ... | @@ -3,7 +3,9 @@ export fn foo() [*:0]const u8 { |
| 3 | return buffer[0..]; | 3 | return buffer[0..]; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // issue #4207: coerce from non-terminated-slice to terminated-pointer | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // :3:18: error: expected type '[*:0]const u8', found '*[64]u8' | 10 | // :3:18: error: expected type '[*:0]const u8', found '*[64]u8' |
| 9 | // :3:18: note: destination pointer requires a terminating '0' sentinel | 11 | // :3:18: note: destination pointer requires a terminating '0' sentinel |
test/compile_errors/stage1/obj/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig+3-1| ... | @@ -8,7 +8,9 @@ export fn foo() void { | ... | @@ -8,7 +8,9 @@ export fn foo() void { |
| 8 | comptime ignore(@typeInfo(MyStruct).Struct.fields[0]); | 8 | comptime ignore(@typeInfo(MyStruct).Struct.fields[0]); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // issue #5221: invalid struct init type referenced by @typeInfo and passed into function | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // :5:28: error: cannot cast pointer to array literal to slice type '[]u8' | 15 | // :5:28: error: cannot cast pointer to array literal to slice type '[]u8' |
| 14 | // :5:28: note: cast discards const qualifier | 16 | // :5:28: note: cast discards const qualifier |
test/compile_errors/stage1/obj/issue_5618_coercion_of_optional_anyopaque_to_anyopaque_must_fail.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn foo() void { | ... | @@ -4,6 +4,8 @@ export fn foo() void { |
| 4 | v = u; | 4 | v = u; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // Issue #5618: coercion of ?*anyopaque to *anyopaque must fail. | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:4:9: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type '*anyopaque', found '?*anyopaque' | 11 | // tmp.zig:4:9: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type '*anyopaque', found '?*anyopaque' |
test/compile_errors/stage1/obj/issue_7810-comptime_slice-len_increment_beyond_bounds.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn foo_slice_len_increment_beyond_bounds() void { | ... | @@ -7,6 +7,8 @@ export fn foo_slice_len_increment_beyond_bounds() void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // comptime slice-len increment beyond bounds | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // :6:12: error: out of bounds slice | 14 | // :6:12: error: out of bounds slice |
test/compile_errors/stage1/obj/issue_9346_return_outside_of_function_scope.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | pub const empty = return 1; | 1 | pub const empty = return 1; |
| 2 | 2 | ||
| 3 | // issue #9346: return outside of function scope | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:19: error: 'return' outside function scope | 7 | // tmp.zig:1:19: error: 'return' outside function scope |
test/compile_errors/stage1/obj/labeled_break_not_found.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | } | 6 | } |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // labeled break not found | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:4:20: error: label not found: 'outer' | 13 | // tmp.zig:4:20: error: label not found: 'outer' |
test/compile_errors/stage1/obj/labeled_continue_not_found.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry() void { | ... | @@ -7,6 +7,8 @@ export fn entry() void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // labeled continue not found | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:23: error: label not found: 'outer' | 14 | // tmp.zig:5:23: error: label not found: 'outer' |
test/compile_errors/stage1/obj/lazy_pointer_with_undefined_element_type.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn foo() void { | ... | @@ -5,6 +5,8 @@ export fn foo() void { |
| 5 | _ = I; | 5 | _ = I; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // lazy pointer with undefined element type | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // :3:28: error: use of undefined value here causes undefined behavior | 12 | // :3:28: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/libc_headers_note.zig created+12| ... | @@ -0,0 +1,12 @@ | ||
| 1 | const c = @cImport(@cInclude("stdio.h")); | ||
| 2 | export fn entry() void { | ||
| 3 | _ = c.printf("hello, world!\n"); | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage1 | ||
| 8 | // is_test=1 | ||
| 9 | // target=native-linux | ||
| 10 | // | ||
| 11 | // tmp.zig:1:11: error: C import failed | ||
| 12 | // tmp.zig:1:11: note: libc headers not available; compilation does not link against libc | ||
test/compile_errors/stage1/obj/load_too_many_bytes_from_comptime_reinterpreted_pointer.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | _ = int_val; | 6 | _ = int_val; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // load too many bytes from comptime reinterpreted pointer | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:28: error: attempt to read 8 bytes from pointer to f32 which is 4 bytes | 13 | // tmp.zig:5:28: error: attempt to read 8 bytes from pointer to f32 which is 4 bytes |
test/compile_errors/stage1/obj/load_vector_pointer_with_unknown_runtime_index.zig+3-1| ... | @@ -10,6 +10,8 @@ fn loadv(ptr: anytype) i32 { | ... | @@ -10,6 +10,8 @@ fn loadv(ptr: anytype) i32 { |
| 10 | return ptr.*; | 10 | return ptr.*; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // load vector pointer with unknown runtime index | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:10:12: error: unable to determine vector element index of type '*align(16:0:4:?) i32 | 17 | // tmp.zig:10:12: error: unable to determine vector element index of type '*align(16:0:4:?) i32 |
test/compile_errors/stage1/obj/local_shadows_global_that_occurs_later.zig+3-1| ... | @@ -4,7 +4,9 @@ pub fn main() void { | ... | @@ -4,7 +4,9 @@ pub fn main() void { |
| 4 | } | 4 | } |
| 5 | fn foo() void {} | 5 | fn foo() void {} |
| 6 | 6 | ||
| 7 | // local shadows global that occurs later | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:2:9: error: local shadows declaration of 'foo' | 11 | // tmp.zig:2:9: error: local shadows declaration of 'foo' |
| 10 | // tmp.zig:5:1: note: declared here | 12 | // tmp.zig:5:1: note: declared here |
test/compile_errors/stage1/obj/local_variable_redeclaration.zig+3-1| ... | @@ -3,7 +3,9 @@ export fn f() void { | ... | @@ -3,7 +3,9 @@ export fn f() void { |
| 3 | var a = 0; | 3 | var a = 0; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // local variable redeclaration | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: redeclaration of local constant 'a' | 10 | // tmp.zig:3:9: error: redeclaration of local constant 'a' |
| 9 | // tmp.zig:2:11: note: previous declaration here | 11 | // tmp.zig:2:11: note: previous declaration here |
test/compile_errors/stage1/obj/local_variable_redeclares_parameter.zig+3-1| ... | @@ -3,7 +3,9 @@ fn f(a : i32) void { | ... | @@ -3,7 +3,9 @@ fn f(a : i32) void { |
| 3 | } | 3 | } |
| 4 | export fn entry() void { f(1); } | 4 | export fn entry() void { f(1); } |
| 5 | 5 | ||
| 6 | // local variable redeclares parameter | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:11: error: redeclaration of function parameter 'a' | 10 | // tmp.zig:2:11: error: redeclaration of function parameter 'a' |
| 9 | // tmp.zig:1:6: note: previous declaration here | 11 | // tmp.zig:1:6: note: previous declaration here |
test/compile_errors/stage1/obj/local_variable_shadowing_global.zig+3-1| ... | @@ -6,7 +6,9 @@ export fn entry() void { | ... | @@ -6,7 +6,9 @@ export fn entry() void { |
| 6 | _ = Bar; | 6 | _ = Bar; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // local variable shadowing global | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:9: error: local shadows declaration of 'Bar' | 13 | // tmp.zig:5:9: error: local shadows declaration of 'Bar' |
| 12 | // tmp.zig:2:1: note: declared here | 14 | // tmp.zig:2:1: note: declared here |
test/compile_errors/stage1/obj/locally_shadowing_a_primitive_type.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn foo() void { | ... | @@ -4,7 +4,9 @@ export fn foo() void { |
| 4 | _ = a; | 4 | _ = a; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // locally shadowing a primitive type | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:2:11: error: name shadows primitive 'u8' | 11 | // tmp.zig:2:11: error: name shadows primitive 'u8' |
| 10 | // tmp.zig:2:11: note: consider using @"u8" to disambiguate | 12 | // tmp.zig:2:11: note: consider using @"u8" to disambiguate |
test/compile_errors/stage1/obj/main_function_with_bogus_args_type.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | pub fn main(args: [][]bogus) !void {_ = args;} | 1 | pub fn main(args: [][]bogus) !void {_ = args;} |
| 2 | 2 | ||
| 3 | // main function with bogus args type | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:23: error: use of undeclared identifier 'bogus' | 7 | // tmp.zig:1:23: error: use of undeclared identifier 'bogus' |
test/compile_errors/stage1/obj/method_call_with_first_arg_type_primitive.zig+3-1| ... | @@ -14,6 +14,8 @@ export fn f() void { | ... | @@ -14,6 +14,8 @@ export fn f() void { |
| 14 | derp.init(); | 14 | derp.init(); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // method call with first arg type primitive | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:14:5: error: expected type 'i32', found 'Foo' | 21 | // tmp.zig:14:5: error: expected type 'i32', found 'Foo' |
test/compile_errors/stage1/obj/method_call_with_first_arg_type_wrong_container.zig+3-1| ... | @@ -23,6 +23,8 @@ export fn foo() void { | ... | @@ -23,6 +23,8 @@ export fn foo() void { |
| 23 | x.init(); | 23 | x.init(); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | // method call with first arg type wrong container | 26 | // error |
| 27 | // backend=stage1 | ||
| 28 | // target=native | ||
| 27 | // | 29 | // |
| 28 | // tmp.zig:23:5: error: expected type '*Allocator', found '*List' | 30 | // tmp.zig:23:5: error: expected type '*Allocator', found '*List' |
test/compile_errors/stage1/obj/missing_boolean_switch_value.zig+3-1| ... | @@ -11,7 +11,9 @@ comptime { | ... | @@ -11,7 +11,9 @@ comptime { |
| 11 | _ = x; | 11 | _ = x; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // missing boolean switch value | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:2:15: error: switch must handle all possibilities | 18 | // tmp.zig:2:15: error: switch must handle all possibilities |
| 17 | // tmp.zig:8:15: error: switch must handle all possibilities | 19 | // tmp.zig:8:15: error: switch must handle all possibilities |
test/compile_errors/stage1/obj/missing_const_in_slice_with_nested_array_type.zig+3-1| ... | @@ -11,6 +11,8 @@ export fn entry() void { | ... | @@ -11,6 +11,8 @@ export fn entry() void { |
| 11 | _ = geo_data; | 11 | _ = geo_data; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // missing const in slice with nested array type | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:4:30: error: array literal requires address-of operator (&) to coerce to slice type '[][2]f32' | 18 | // tmp.zig:4:30: error: array literal requires address-of operator (&) to coerce to slice type '[][2]f32' |
test/compile_errors/stage1/obj/missing_else_clause.zig+3-1| ... | @@ -8,7 +8,9 @@ fn g(b: bool) void { | ... | @@ -8,7 +8,9 @@ fn g(b: bool) void { |
| 8 | } | 8 | } |
| 9 | export fn entry() void { f(true); g(true); } | 9 | export fn entry() void { f(true); g(true); } |
| 10 | 10 | ||
| 11 | // missing else clause | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:2:21: error: expected type 'i32', found 'void' | 15 | // tmp.zig:2:21: error: expected type 'i32', found 'void' |
| 14 | // tmp.zig:6:15: error: incompatible types: 'i32' and 'void' | 16 | // tmp.zig:6:15: error: incompatible types: 'i32' and 'void' |
test/compile_errors/stage1/obj/missing_field_in_struct_value_expression.zig+3-1| ... | @@ -13,6 +13,8 @@ export fn f() void { | ... | @@ -13,6 +13,8 @@ export fn f() void { |
| 13 | _ = a; | 13 | _ = a; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // missing field in struct value expression | 16 | // error |
| 17 | // backend=stage1 | ||
| 18 | // target=native | ||
| 17 | // | 19 | // |
| 18 | // tmp.zig:9:17: error: missing field: 'x' | 20 | // tmp.zig:9:17: error: missing field: 'x' |
test/compile_errors/stage1/obj/missing_function_call_param.zig+3-1| ... | @@ -24,6 +24,8 @@ fn f(foo: *const Foo, index: usize) void { | ... | @@ -24,6 +24,8 @@ fn f(foo: *const Foo, index: usize) void { |
| 24 | 24 | ||
| 25 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 25 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 26 | 26 | ||
| 27 | // missing function call param | 27 | // error |
| 28 | // backend=stage1 | ||
| 29 | // target=native | ||
| 28 | // | 30 | // |
| 29 | // tmp.zig:20:34: error: expected 1 argument(s), found 0 | 31 | // tmp.zig:20:34: error: expected 1 argument(s), found 0 |
test/compile_errors/stage1/obj/missing_function_name.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn () void {} | 1 | fn () void {} |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 2 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 3 | 3 | ||
| 4 | // missing function name | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:1: error: missing function name | 8 | // tmp.zig:1:1: error: missing function name |
test/compile_errors/stage1/obj/missing_param_name.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn f(i32) void {} | 1 | fn f(i32) void {} |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 2 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 3 | 3 | ||
| 4 | // missing param name | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:6: error: missing parameter name | 8 | // tmp.zig:1:6: error: missing parameter name |
test/compile_errors/stage1/obj/missing_parameter_name_of_generic_function.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | dump(a); | 4 | dump(a); |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // missing parameter name of generic function | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:1:9: error: missing parameter name | 11 | // tmp.zig:1:9: error: missing parameter name |
test/compile_errors/stage1/obj/missing_result_type_for_phi_node.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | foo() catch 0; | 5 | foo() catch 0; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // missing result type for phi node | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:17: error: integer value 0 cannot be coerced to type 'void' | 12 | // tmp.zig:5:17: error: integer value 0 cannot be coerced to type 'void' |
test/compile_errors/stage1/obj/misspelled_type_with_pointer_only_reference.zig+3-1| ... | @@ -30,6 +30,8 @@ fn foo() void { | ... | @@ -30,6 +30,8 @@ fn foo() void { |
| 30 | 30 | ||
| 31 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 31 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 32 | 32 | ||
| 33 | // misspelled type with pointer only reference | 33 | // error |
| 34 | // backend=stage1 | ||
| 35 | // target=native | ||
| 34 | // | 36 | // |
| 35 | // tmp.zig:5:16: error: use of undeclared identifier 'JsonList' | 37 | // tmp.zig:5:16: error: use of undeclared identifier 'JsonList' |
test/compile_errors/stage1/obj/mod_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a %= a; | 3 | a %= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // mod assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/mod_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a % a; | 3 | _ = a % a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // mod on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/mul_overflow_in_function_evaluation.zig+3-1| ... | @@ -5,6 +5,8 @@ fn mul(a: u16, b: u16) u16 { | ... | @@ -5,6 +5,8 @@ fn mul(a: u16, b: u16) u16 { |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } |
| 7 | 7 | ||
| 8 | // mul overflow in function evaluation | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:14: error: operation caused overflow | 12 | // tmp.zig:3:14: error: operation caused overflow |
test/compile_errors/stage1/obj/mult_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a *= a; | 3 | a *= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // mult assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/mult_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a * a; | 3 | _ = a * a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // mult on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/mult_wrap_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a *%= a; | 3 | a *%= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // mult wrap assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/mult_wrap_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a *% a; | 3 | _ = a *% a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // mult wrap on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/multiple_function_definitions.zig+3-1| ... | @@ -2,7 +2,9 @@ fn a() void {} | ... | @@ -2,7 +2,9 @@ fn a() void {} |
| 2 | fn a() void {} | 2 | fn a() void {} |
| 3 | export fn entry() void { a(); } | 3 | export fn entry() void { a(); } |
| 4 | 4 | ||
| 5 | // multiple function definitions | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:1: error: redeclaration of 'a' | 9 | // tmp.zig:2:1: error: redeclaration of 'a' |
| 8 | // tmp.zig:1:1: note: other declaration here | 10 | // tmp.zig:1:1: note: other declaration here |
test/compile_errors/stage1/obj/negate_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = -a; | 3 | _ = -a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // negate on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:10: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:10: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/negate_wrap_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = -%a; | 3 | _ = -%a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // negate wrap on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:11: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:11: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/negation_overflow_in_function_evaluation.zig+3-1| ... | @@ -5,6 +5,8 @@ fn neg(x: i8) i8 { | ... | @@ -5,6 +5,8 @@ fn neg(x: i8) i8 { |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } |
| 7 | 7 | ||
| 8 | // negation overflow in function evaluation | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:12: error: negation caused overflow | 12 | // tmp.zig:3:12: error: negation caused overflow |
test/compile_errors/stage1/obj/nested_error_set_mismatch.zig+3-1| ... | @@ -10,7 +10,9 @@ fn foo() ?OtherError!i32 { | ... | @@ -10,7 +10,9 @@ fn foo() ?OtherError!i32 { |
| 10 | return null; | 10 | return null; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // nested error set mismatch | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:5:34: error: expected type '?NextError!i32', found '?OtherError!i32' | 17 | // tmp.zig:5:34: error: expected type '?NextError!i32', found '?OtherError!i32' |
| 16 | // tmp.zig:5:34: note: optional type child 'OtherError!i32' cannot cast into optional type child 'NextError!i32' | 18 | // tmp.zig:5:34: note: optional type child 'OtherError!i32' cannot cast into optional type child 'NextError!i32' |
test/compile_errors/stage1/obj/no_else_prong_on_switch_on_global_error_set.zig+3-1| ... | @@ -7,6 +7,8 @@ fn foo(a: anyerror) void { | ... | @@ -7,6 +7,8 @@ fn foo(a: anyerror) void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // no else prong on switch on global error set | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:5: error: else prong required when switching on type 'anyerror' | 14 | // tmp.zig:5:5: error: else prong required when switching on type 'anyerror' |
test/compile_errors/stage1/obj/noalias_on_non_pointer_param.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn f(noalias x: i32) void { _ = x; } | 1 | fn f(noalias x: i32) void { _ = x; } |
| 2 | export fn entry() void { f(1234); } | 2 | export fn entry() void { f(1234); } |
| 3 | 3 | ||
| 4 | // noalias on non pointer param | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:6: error: noalias on non-pointer parameter | 8 | // tmp.zig:1:6: error: noalias on non-pointer parameter |
test/compile_errors/stage1/obj/non-async_function_pointer_eventually_is_inferred_to_become_async.zig+3-1| ... | @@ -6,7 +6,9 @@ fn func() void { | ... | @@ -6,7 +6,9 @@ fn func() void { |
| 6 | suspend {} | 6 | suspend {} |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // non-async function pointer eventually is inferred to become async | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:1: error: 'func' cannot be async | 13 | // tmp.zig:5:1: error: 'func' cannot be async |
| 12 | // tmp.zig:3:20: note: required to be non-async here | 14 | // tmp.zig:3:20: note: required to be non-async here |
test/compile_errors/stage1/obj/non-const_expression_function_call_with_struct_return_value_outside_function.zig+3-1| ... | @@ -10,6 +10,8 @@ var global_side_effect = false; | ... | @@ -10,6 +10,8 @@ var global_side_effect = false; |
| 10 | 10 | ||
| 11 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 11 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } |
| 12 | 12 | ||
| 13 | // non-const expression function call with struct return value outside function | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:6:26: error: unable to evaluate constant expression | 17 | // tmp.zig:6:26: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/non-const_expression_in_struct_literal_outside_function.zig+3-1| ... | @@ -6,6 +6,8 @@ extern fn get_it() i32; | ... | @@ -6,6 +6,8 @@ extern fn get_it() i32; |
| 6 | 6 | ||
| 7 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 7 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } |
| 8 | 8 | ||
| 9 | // non-const expression in struct literal outside function | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:4:21: error: unable to evaluate constant expression | 13 | // tmp.zig:4:21: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/non-const_switch_number_literal.zig+3-1| ... | @@ -10,6 +10,8 @@ fn bar() i32 { | ... | @@ -10,6 +10,8 @@ fn bar() i32 { |
| 10 | return 2; | 10 | return 2; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // non-const switch number literal | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:5:17: error: cannot store runtime value in type 'comptime_int' | 17 | // tmp.zig:5:17: error: cannot store runtime value in type 'comptime_int' |
test/compile_errors/stage1/obj/non-const_variables_of_things_that_require_const_variables.zig+3-1| ... | @@ -35,7 +35,9 @@ const Foo = struct { | ... | @@ -35,7 +35,9 @@ const Foo = struct { |
| 35 | fn bar(self: *const Foo) void {_ = self;} | 35 | fn bar(self: *const Foo) void {_ = self;} |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | // non-const variables of things that require const variables | 38 | // error |
| 39 | // backend=stage1 | ||
| 40 | // target=native | ||
| 39 | // | 41 | // |
| 40 | // tmp.zig:2:4: error: variable of type '*const comptime_int' must be const or comptime | 42 | // tmp.zig:2:4: error: variable of type '*const comptime_int' must be const or comptime |
| 41 | // tmp.zig:6:4: error: variable of type '@Type(.Undefined)' must be const or comptime | 43 | // tmp.zig:6:4: error: variable of type '@Type(.Undefined)' must be const or comptime |
test/compile_errors/stage1/obj/non-enum_tag_type_passed_to_union.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | _ = x; | 6 | _ = x; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // non-enum tag type passed to union | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:1:19: error: expected enum tag type, found 'u32' | 13 | // tmp.zig:1:19: error: expected enum tag type, found 'u32' |
test/compile_errors/stage1/obj/non-extern_function_with_var_args.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | foo(); | 3 | foo(); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // non-extern function with var args | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:1:14: error: expected type expression, found '...' | 10 | // tmp.zig:1:14: error: expected type expression, found '...' |
test/compile_errors/stage1/obj/non-inline_for_loop_on_a_type_that_requires_comptime.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry() void { | ... | @@ -7,6 +7,8 @@ export fn entry() void { |
| 7 | for (xx) |f| { _ = f;} | 7 | for (xx) |f| { _ = f;} |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // non-inline for loop on a type that requires comptime | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:7:5: error: values of type 'Foo' must be comptime known, but index value is runtime known | 14 | // tmp.zig:7:5: error: values of type 'Foo' must be comptime known, but index value is runtime known |
test/compile_errors/stage1/obj/non-integer_tag_type_to_automatic_union_enum.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | _ = x; | 6 | _ = x; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // non-integer tag type to automatic union enum | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:1:24: error: expected integer tag type, found 'f32' | 13 | // tmp.zig:1:24: error: expected integer tag type, found 'f32' |
test/compile_errors/stage1/obj/non-pure_function_returns_type.zig+3-1| ... | @@ -17,6 +17,8 @@ export fn function_with_return_type_type() void { | ... | @@ -17,6 +17,8 @@ export fn function_with_return_type_type() void { |
| 17 | list.length = 10; | 17 | list.length = 10; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | // non-pure function returns type | 20 | // error |
| 21 | // backend=stage1 | ||
| 22 | // target=native | ||
| 21 | // | 23 | // |
| 22 | // tmp.zig:3:7: error: unable to evaluate constant expression | 24 | // tmp.zig:3:7: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/non_async_function_pointer_passed_to_asyncCall.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | } | 5 | } |
| 6 | fn afunc() void { } | 6 | fn afunc() void { } |
| 7 | 7 | ||
| 8 | // non async function pointer passed to @asyncCall | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:32: error: expected async function, found 'fn() void' | 12 | // tmp.zig:4:32: error: expected async function, found 'fn() void' |
test/compile_errors/stage1/obj/non_compile_time_array_concatenation.zig+3-1| ... | @@ -4,6 +4,8 @@ fn f() []u8 { | ... | @@ -4,6 +4,8 @@ fn f() []u8 { |
| 4 | var s: [10]u8 = undefined; | 4 | var s: [10]u8 = undefined; |
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 5 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 6 | 6 | ||
| 7 | // non compile time array concatenation | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:2:12: error: unable to evaluate constant expression | 11 | // tmp.zig:2:12: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/non_constant_expression_in_array_size.zig+3-1| ... | @@ -6,7 +6,9 @@ fn get() usize { return global_var; } | ... | @@ -6,7 +6,9 @@ fn get() usize { return global_var; } |
| 6 | 6 | ||
| 7 | export fn entry() usize { return @sizeOf(@TypeOf(Foo)); } | 7 | export fn entry() usize { return @sizeOf(@TypeOf(Foo)); } |
| 8 | 8 | ||
| 9 | // non constant expression in array size | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:25: error: cannot store runtime value in compile time variable | 13 | // tmp.zig:5:25: error: cannot store runtime value in compile time variable |
| 12 | // tmp.zig:2:12: note: called from here | 14 | // tmp.zig:2:12: note: called from here |
test/compile_errors/stage1/obj/non_error_sets_used_in_merge_error_sets_operator.zig+3-1| ... | @@ -7,7 +7,9 @@ export fn bar() void { | ... | @@ -7,7 +7,9 @@ export fn bar() void { |
| 7 | _ = Errors; | 7 | _ = Errors; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // non error sets used in merge error sets operator | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:2:20: error: expected error set type, found type 'u8' | 14 | // tmp.zig:2:20: error: expected error set type, found type 'u8' |
| 13 | // tmp.zig:2:23: note: `||` merges error sets; `or` performs boolean OR | 15 | // tmp.zig:2:23: note: `||` merges error sets; `or` performs boolean OR |
test/compile_errors/stage1/obj/non_float_passed_to_floatToInt.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // non float passed to @floatToInt | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:32: error: expected float type, found 'i32' | 10 | // tmp.zig:2:32: error: expected float type, found 'i32' |
test/compile_errors/stage1/obj/non_int_passed_to_intToFloat.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // non int passed to @intToFloat | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:32: error: expected int type, found 'comptime_float' | 10 | // tmp.zig:2:32: error: expected int type, found 'comptime_float' |
test/compile_errors/stage1/obj/non_pointer_given_to_ptrToInt.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry(x: i32) usize { | ... | @@ -2,6 +2,8 @@ export fn entry(x: i32) usize { |
| 2 | return @ptrToInt(x); | 2 | return @ptrToInt(x); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // non pointer given to @ptrToInt | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:22: error: expected pointer, found 'i32' | 9 | // tmp.zig:2:22: error: expected pointer, found 'i32' |
test/compile_errors/stage1/obj/normal_string_with_newline.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | const foo = "a | 1 | const foo = "a |
| 2 | b"; | 2 | b"; |
| 3 | 3 | ||
| 4 | // normal string with newline | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:13: error: expected expression, found 'invalid bytes' | 8 | // tmp.zig:1:13: error: expected expression, found 'invalid bytes' |
| 7 | // tmp.zig:1:15: note: invalid byte: '\n' | 9 | // tmp.zig:1:15: note: invalid byte: '\n' |
test/compile_errors/stage1/obj/offsetOf-bad_field_name.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn foo() usize { | ... | @@ -5,6 +5,8 @@ export fn foo() usize { |
| 5 | return @offsetOf(Foo, "a",); | 5 | return @offsetOf(Foo, "a",); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // @offsetOf - bad field name | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:27: error: struct 'Foo' has no field 'a' | 12 | // tmp.zig:5:27: error: struct 'Foo' has no field 'a' |
test/compile_errors/stage1/obj/offsetOf-non_struct.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() usize { | ... | @@ -3,6 +3,8 @@ export fn foo() usize { |
| 3 | return @offsetOf(Foo, "a",); | 3 | return @offsetOf(Foo, "a",); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @offsetOf - non struct | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:22: error: expected struct type, found 'i32' | 10 | // tmp.zig:3:22: error: expected struct type, found 'i32' |
test/compile_errors/stage1/obj/only_equality_binary_operator_allowed_for_error_sets.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = z; | 3 | _ = z; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // only equality binary operator allowed for error sets | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:23: error: operator not allowed for errors | 10 | // tmp.zig:2:23: error: operator not allowed for errors |
test/compile_errors/stage1/obj/opaque_type_with_field.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | _ = foo; | 4 | _ = foo; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // opaque type with field | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:1:25: error: opaque types cannot have fields | 11 | // tmp.zig:1:25: error: opaque types cannot have fields |
test/compile_errors/stage1/obj/optional_pointer_to_void_in_extern_struct.zig+3-1| ... | @@ -7,6 +7,8 @@ const Bar = extern struct { | ... | @@ -7,6 +7,8 @@ const Bar = extern struct { |
| 7 | }; | 7 | }; |
| 8 | export fn entry(bar: *Bar) void {_ = bar;} | 8 | export fn entry(bar: *Bar) void {_ = bar;} |
| 9 | 9 | ||
| 10 | // optional pointer to void in extern struct | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:2:5: error: extern structs cannot contain fields of type '?*const void' | 14 | // tmp.zig:2:5: error: extern structs cannot contain fields of type '?*const void' |
test/compile_errors/stage1/obj/or_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a or a; | 3 | _ = a or a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // or on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/orelse_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a orelse false; | 3 | _ = a orelse false; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // orelse on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:11: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:11: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/out_of_range_comptime_int_passed_to_floatToInt.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // out of range comptime_int passed to @floatToInt | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:31: error: integer value 200 cannot be coerced to type 'i8' | 10 | // tmp.zig:2:31: error: integer value 200 cannot be coerced to type 'i8' |
test/compile_errors/stage1/obj/overflow_in_enum_value_allocation.zig+3-1| ... | @@ -7,6 +7,8 @@ pub fn main() void { | ... | @@ -7,6 +7,8 @@ pub fn main() void { |
| 7 | _ = y; | 7 | _ = y; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // overflow in enum value allocation | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:5: error: enumeration value 256 too large for type 'u8' | 14 | // tmp.zig:3:5: error: enumeration value 256 too large for type 'u8' |
test/compile_errors/stage1/obj/packed_union_given_enum_tag_type.zig+3-1| ... | @@ -13,6 +13,8 @@ export fn entry() void { | ... | @@ -13,6 +13,8 @@ export fn entry() void { |
| 13 | _ = a; | 13 | _ = a; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // packed union given enum tag type | 16 | // error |
| 17 | // backend=stage1 | ||
| 18 | // target=native | ||
| 17 | // | 19 | // |
| 18 | // tmp.zig:6:30: error: packed union does not support enum tag type | 20 | // tmp.zig:6:30: error: packed union does not support enum tag type |
test/compile_errors/stage1/obj/packed_union_with_automatic_layout_field.zig+3-1| ... | @@ -11,6 +11,8 @@ export fn entry() void { | ... | @@ -11,6 +11,8 @@ export fn entry() void { |
| 11 | _ = a; | 11 | _ = a; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // packed union with automatic layout field | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:6:5: error: non-packed, non-extern struct 'Foo' not allowed in packed union; no guaranteed in-memory representation | 18 | // tmp.zig:6:5: error: non-packed, non-extern struct 'Foo' not allowed in packed union; no guaranteed in-memory representation |
test/compile_errors/stage1/obj/panic_called_at_compile_time.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | } | 4 | } |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // @panic called at compile time | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:9: error: encountered @panic at compile-time | 11 | // tmp.zig:3:9: error: encountered @panic at compile-time |
test/compile_errors/stage1/obj/parameter_redeclaration.zig+3-1| ... | @@ -2,7 +2,9 @@ fn f(a : i32, a : i32) void { | ... | @@ -2,7 +2,9 @@ fn f(a : i32, a : i32) void { |
| 2 | } | 2 | } |
| 3 | export fn entry() void { f(1, 2); } | 3 | export fn entry() void { f(1, 2); } |
| 4 | 4 | ||
| 5 | // parameter redeclaration | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:1:15: error: redeclaration of function parameter 'a' | 9 | // tmp.zig:1:15: error: redeclaration of function parameter 'a' |
| 8 | // tmp.zig:1:6: note: previous declaration here | 10 | // tmp.zig:1:6: note: previous declaration here |
test/compile_errors/stage1/obj/parameter_shadowing_global.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn entry() void { | ... | @@ -4,7 +4,9 @@ export fn entry() void { |
| 4 | f(1234); | 4 | f(1234); |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // parameter shadowing global | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:2:6: error: local shadows declaration of 'Foo' | 11 | // tmp.zig:2:6: error: local shadows declaration of 'Foo' |
| 10 | // tmp.zig:1:1: note: declared here | 12 | // tmp.zig:1:1: note: declared here |
test/compile_errors/stage1/obj/pass_const_ptr_to_mutable_ptr_fn.zig+3-1| ... | @@ -10,6 +10,8 @@ fn ptrEql(a: *[]const u8, b: *[]const u8) bool { | ... | @@ -10,6 +10,8 @@ fn ptrEql(a: *[]const u8, b: *[]const u8) bool { |
| 10 | 10 | ||
| 11 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 11 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 12 | 12 | ||
| 13 | // pass const ptr to mutable ptr fn | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:4:19: error: expected type '*[]const u8', found '*const []const u8' | 17 | // tmp.zig:4:19: error: expected type '*[]const u8', found '*const []const u8' |
test/compile_errors/stage1/obj/passing_a_not-aligned-enough_pointer_to_cmpxchg.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() bool { | ... | @@ -5,6 +5,8 @@ export fn entry() bool { |
| 5 | return x == 5678; | 5 | return x == 5678; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // passing a not-aligned-enough pointer to cmpxchg | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:32: error: expected type '*i32', found '*align(1) i32' | 12 | // tmp.zig:4:32: error: expected type '*i32', found '*align(1) i32' |
test/compile_errors/stage1/obj/passing_an_under-aligned_function_pointer.zig+3-1| ... | @@ -6,6 +6,8 @@ fn testImplicitlyDecreaseFnAlign(ptr: fn () align(8) i32, answer: i32) void { | ... | @@ -6,6 +6,8 @@ fn testImplicitlyDecreaseFnAlign(ptr: fn () align(8) i32, answer: i32) void { |
| 6 | } | 6 | } |
| 7 | fn alignedSmall() align(4) i32 { return 1234; } | 7 | fn alignedSmall() align(4) i32 { return 1234; } |
| 8 | 8 | ||
| 9 | // passing an under-aligned function pointer | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32' | 13 | // tmp.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32' |
test/compile_errors/stage1/obj/peer_cast_then_implicit_cast_const_pointer_to_mutable_C_pointer.zig+3-1| ... | @@ -3,7 +3,9 @@ export fn func() void { | ... | @@ -3,7 +3,9 @@ export fn func() void { |
| 3 | strValue = strValue orelse ""; | 3 | strValue = strValue orelse ""; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // peer cast then implicit cast const pointer to mutable C pointer | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:32: error: expected type '[*c]u8', found '*const [0:0]u8' | 10 | // tmp.zig:3:32: error: expected type '[*c]u8', found '*const [0:0]u8' |
| 9 | // tmp.zig:3:32: note: cast discards const qualifier | 11 | // tmp.zig:3:32: note: cast discards const qualifier |
test/compile_errors/stage1/obj/pointer_arithmetic_on_pointer-to-array.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn foo() void { | ... | @@ -5,6 +5,8 @@ export fn foo() void { |
| 5 | _ = z; | 5 | _ = z; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // pointer arithmetic on pointer-to-array | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:4:17: error: integer value 1 cannot be coerced to type '*[10]u8' | 12 | // tmp.zig:4:17: error: integer value 1 cannot be coerced to type '*[10]u8' |
test/compile_errors/stage1/obj/pointer_attributes_checked_when_coercing_pointer_to_anon_literal.zig+3-1| ... | @@ -12,7 +12,9 @@ comptime { | ... | @@ -12,7 +12,9 @@ comptime { |
| 12 | _ = c; | 12 | _ = c; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // pointer attributes checked when coercing pointer to anon literal | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:2:31: error: cannot cast pointer to array literal to slice type '[][]const u8' | 19 | // tmp.zig:2:31: error: cannot cast pointer to array literal to slice type '[][]const u8' |
| 18 | // tmp.zig:2:31: note: cast discards const qualifier | 20 | // tmp.zig:2:31: note: cast discards const qualifier |
test/compile_errors/stage1/obj/pointer_to_noreturn.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn a() *noreturn {} | 1 | fn a() *noreturn {} |
| 2 | export fn entry() void { _ = a(); } | 2 | export fn entry() void { _ = a(); } |
| 3 | 3 | ||
| 4 | // pointer to noreturn | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:9: error: pointer to noreturn not allowed | 8 | // tmp.zig:1:9: error: pointer to noreturn not allowed |
test/compile_errors/stage1/obj/popCount-non-integer.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry(x: f32) u32 { | ... | @@ -2,6 +2,8 @@ export fn entry(x: f32) u32 { |
| 2 | return @popCount(f32, x); | 2 | return @popCount(f32, x); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @popCount - non-integer | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:22: error: expected integer type, found 'f32' | 9 | // tmp.zig:2:22: error: expected integer type, found 'f32' |
test/compile_errors/stage1/obj/prevent_bad_implicit_casting_of_anyframe_types.zig+3-1| ... | @@ -15,7 +15,9 @@ export fn c() void { | ... | @@ -15,7 +15,9 @@ export fn c() void { |
| 15 | } | 15 | } |
| 16 | fn func() void {} | 16 | fn func() void {} |
| 17 | 17 | ||
| 18 | // prevent bad implicit casting of anyframe types | 18 | // error |
| 19 | // backend=stage1 | ||
| 20 | // target=native | ||
| 19 | // | 21 | // |
| 20 | // tmp.zig:3:28: error: expected type 'anyframe->i32', found 'anyframe' | 22 | // tmp.zig:3:28: error: expected type 'anyframe->i32', found 'anyframe' |
| 21 | // tmp.zig:8:28: error: expected type 'anyframe->i32', found 'i32' | 23 | // tmp.zig:8:28: error: expected type 'anyframe->i32', found 'i32' |
test/compile_errors/stage1/obj/primitives_take_precedence_over_declarations.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | _ = a; | 4 | _ = a; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // primitives take precedence over declarations | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:19: error: integer value 300 cannot be coerced to type 'u8' | 11 | // tmp.zig:3:19: error: integer value 300 cannot be coerced to type 'u8' |
test/compile_errors/stage1/obj/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn entry() bool { | ... | @@ -4,7 +4,9 @@ export fn entry() bool { |
| 4 | return p == null; | 4 | return p == null; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // @ptrCast a 0 bit type to a non- 0 bit type | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:15: error: '*u0' and '?*u0' do not have the same in-memory representation | 11 | // tmp.zig:3:15: error: '*u0' and '?*u0' do not have the same in-memory representation |
| 10 | // tmp.zig:3:31: note: '*u0' has no in-memory bits | 12 | // tmp.zig:3:31: note: '*u0' has no in-memory bits |
test/compile_errors/stage1/obj/ptrCast_discards_const_qualifier.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | _ = y; | 4 | _ = y; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // @ptrCast discards const qualifier | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:15: error: cast discards const qualifier | 11 | // tmp.zig:3:15: error: cast discards const qualifier |
test/compile_errors/stage1/obj/ptrToInt_0_to_non_optional_pointer.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = b; | 3 | _ = b; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @ptrToInt 0 to non optional pointer | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:13: error: pointer type '*i32' does not allow address zero | 10 | // tmp.zig:2:13: error: pointer type '*i32' does not allow address zero |
test/compile_errors/stage1/obj/ptrToInt_on_void.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() bool { | ... | @@ -2,6 +2,8 @@ export fn entry() bool { |
| 2 | return @ptrToInt(&{}) == @ptrToInt(&{}); | 2 | return @ptrToInt(&{}) == @ptrToInt(&{}); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @ptrToInt on *void | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:23: error: pointer to size 0 type has no address | 9 | // tmp.zig:2:23: error: pointer to size 0 type has no address |
test/compile_errors/stage1/obj/ptrcast_to_non-pointer.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry(a: *i32) usize { | ... | @@ -2,6 +2,8 @@ export fn entry(a: *i32) usize { |
| 2 | return @ptrCast(usize, a); | 2 | return @ptrCast(usize, a); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // ptrcast to non-pointer | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:21: error: expected pointer, found 'usize' | 9 | // tmp.zig:2:21: error: expected pointer, found 'usize' |
test/compile_errors/stage1/obj/range_operator_in_switch_used_on_error_set.zig+3-1| ... | @@ -12,6 +12,8 @@ fn foo(x: i32) !void { | ... | @@ -12,6 +12,8 @@ fn foo(x: i32) !void { |
| 12 | } | 12 | } |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // range operator in switch used on error set | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:3:17: error: operator not allowed for errors | 19 | // tmp.zig:3:17: error: operator not allowed for errors |
test/compile_errors/stage1/obj/reading_past_end_of_pointer_casted_array.zig+3-1| ... | @@ -6,6 +6,8 @@ comptime { | ... | @@ -6,6 +6,8 @@ comptime { |
| 6 | _ = deref; | 6 | _ = deref; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // reading past end of pointer casted array | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:26: error: attempt to read 4 bytes from [4]u8 at index 1 which is 3 bytes | 13 | // tmp.zig:5:26: error: attempt to read 4 bytes from [4]u8 at index 1 which is 3 bytes |
test/compile_errors/stage1/obj/recursive_inferred_error_set.zig+3-1| ... | @@ -5,6 +5,8 @@ fn foo() !void { | ... | @@ -5,6 +5,8 @@ fn foo() !void { |
| 5 | try foo(); | 5 | try foo(); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // recursive inferred error set | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:5: error: cannot resolve inferred error set '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set': function 'foo' not fully analyzed yet | 12 | // tmp.zig:5:5: error: cannot resolve inferred error set '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set': function 'foo' not fully analyzed yet |
test/compile_errors/stage1/obj/redefinition_of_enums.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | const A = enum {x}; | 1 | const A = enum {x}; |
| 2 | const A = enum {x}; | 2 | const A = enum {x}; |
| 3 | 3 | ||
| 4 | // redefinition of enums | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:2:1: error: redeclaration of 'A' | 8 | // tmp.zig:2:1: error: redeclaration of 'A' |
| 7 | // tmp.zig:1:1: note: other declaration here | 9 | // tmp.zig:1:1: note: other declaration here |
test/compile_errors/stage1/obj/redefinition_of_global_variables.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | var a : i32 = 1; | 1 | var a : i32 = 1; |
| 2 | var a : i32 = 2; | 2 | var a : i32 = 2; |
| 3 | 3 | ||
| 4 | // redefinition of global variables | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:2:1: error: redeclaration of 'a' | 8 | // tmp.zig:2:1: error: redeclaration of 'a' |
| 7 | // tmp.zig:1:1: note: other declaration here | 9 | // tmp.zig:1:1: note: other declaration here |
test/compile_errors/stage1/obj/redefinition_of_struct.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | const A = struct { x : i32, }; | 1 | const A = struct { x : i32, }; |
| 2 | const A = struct { y : i32, }; | 2 | const A = struct { y : i32, }; |
| 3 | 3 | ||
| 4 | // redefinition of struct | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:2:1: error: redeclaration of 'A' | 8 | // tmp.zig:2:1: error: redeclaration of 'A' |
| 7 | // tmp.zig:1:1: note: other declaration here | 9 | // tmp.zig:1:1: note: other declaration here |
test/compile_errors/stage1/obj/refer_to_the_type_of_a_generic_function.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | f(i32); | 4 | f(i32); |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // refer to the type of a generic function | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:4:5: error: use of undefined value here causes undefined behavior | 11 | // tmp.zig:4:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/referring_to_a_struct_that_is_invalid.zig+3-1| ... | @@ -10,6 +10,8 @@ fn assert(ok: bool) void { | ... | @@ -10,6 +10,8 @@ fn assert(ok: bool) void { |
| 10 | if (!ok) unreachable; | 10 | if (!ok) unreachable; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // referring to a struct that is invalid | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:10:14: error: reached unreachable code | 17 | // tmp.zig:10:14: error: reached unreachable code |
test/compile_errors/stage1/obj/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig+3-1| ... | @@ -14,6 +14,8 @@ export fn entry() void { | ... | @@ -14,6 +14,8 @@ export fn entry() void { |
| 14 | _ = afoo; | 14 | _ = afoo; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // regression test #2980: base type u32 is not type checked properly when assigning a value within a struct | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:12:25: error: cannot convert error union to payload type. consider using `try`, `catch`, or `if`. expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(get_uval)).Fn.return_type.?).ErrorUnion.error_set!u32' | 21 | // tmp.zig:12:25: error: cannot convert error union to payload type. consider using `try`, `catch`, or `if`. expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(get_uval)).Fn.return_type.?).ErrorUnion.error_set!u32' |
test/compile_errors/stage1/obj/reify_type.Fn_with_is_generic_true.zig+3-1| ... | @@ -10,6 +10,8 @@ const Foo = @Type(.{ | ... | @@ -10,6 +10,8 @@ const Foo = @Type(.{ |
| 10 | }); | 10 | }); |
| 11 | comptime { _ = Foo; } | 11 | comptime { _ = Foo; } |
| 12 | 12 | ||
| 13 | // @Type(.Fn) with is_generic = true | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:1:20: error: Type.Fn.is_generic must be false for @Type | 17 | // tmp.zig:1:20: error: Type.Fn.is_generic must be false for @Type |
test/compile_errors/stage1/obj/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig+3-1| ... | @@ -10,6 +10,8 @@ const Foo = @Type(.{ | ... | @@ -10,6 +10,8 @@ const Foo = @Type(.{ |
| 10 | }); | 10 | }); |
| 11 | comptime { _ = Foo; } | 11 | comptime { _ = Foo; } |
| 12 | 12 | ||
| 13 | // @Type(.Fn) with is_var_args = true and non-C callconv | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:1:20: error: varargs functions must have C calling convention | 17 | // tmp.zig:1:20: error: varargs functions must have C calling convention |
test/compile_errors/stage1/obj/reify_type.Fn_with_return_type_null.zig+3-1| ... | @@ -10,6 +10,8 @@ const Foo = @Type(.{ | ... | @@ -10,6 +10,8 @@ const Foo = @Type(.{ |
| 10 | }); | 10 | }); |
| 11 | comptime { _ = Foo; } | 11 | comptime { _ = Foo; } |
| 12 | 12 | ||
| 13 | // @Type(.Fn) with return_type = null | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:1:20: error: Type.Fn.return_type must be non-null for @Type | 17 | // tmp.zig:1:20: error: Type.Fn.return_type must be non-null for @Type |
test/compile_errors/stage1/obj/reify_type.Pointer_with_invalid_address_space.zig+3-1| ... | @@ -11,6 +11,8 @@ export fn entry() void { | ... | @@ -11,6 +11,8 @@ export fn entry() void { |
| 11 | }}); | 11 | }}); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // @Type(.Pointer) with invalid address space | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:2:16: error: address space 'gs' not available in stage 1 compiler, must be .generic | 18 | // tmp.zig:2:16: error: address space 'gs' not available in stage 1 compiler, must be .generic |
test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig+3-1| ... | @@ -11,6 +11,8 @@ export fn entry() void { | ... | @@ -11,6 +11,8 @@ export fn entry() void { |
| 11 | _ = @intToEnum(Tag, 0); | 11 | _ = @intToEnum(Tag, 0); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // @Type for exhaustive enum with non-integer tag type | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:1:20: error: Type.Enum.tag_type must be an integer type, not 'bool' | 18 | // tmp.zig:1:20: error: Type.Enum.tag_type must be an integer type, not 'bool' |
test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig+3-1| ... | @@ -11,6 +11,8 @@ export fn entry() void { | ... | @@ -11,6 +11,8 @@ export fn entry() void { |
| 11 | _ = @intToEnum(Tag, 0); | 11 | _ = @intToEnum(Tag, 0); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // @Type for exhaustive enum with undefined tag type | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:1:20: error: use of undefined value here causes undefined behavior | 18 | // tmp.zig:1:20: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_zero_fields.zig+3-1| ... | @@ -11,6 +11,8 @@ export fn entry() void { | ... | @@ -11,6 +11,8 @@ export fn entry() void { |
| 11 | _ = @intToEnum(Tag, 0); | 11 | _ = @intToEnum(Tag, 0); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // @Type for exhaustive enum with zero fields | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:1:20: error: enums must have 1 or more fields | 18 | // tmp.zig:1:20: error: enums must have 1 or more fields |
test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_enum_field.zig+3-1| ... | @@ -27,6 +27,8 @@ export fn entry() void { | ... | @@ -27,6 +27,8 @@ export fn entry() void { |
| 27 | tagged = .{ .unsigned = 1 }; | 27 | tagged = .{ .unsigned = 1 }; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | // @Type for tagged union with extra enum field | 30 | // error |
| 31 | // backend=stage1 | ||
| 32 | // target=native | ||
| 31 | // | 33 | // |
| 32 | // tmp.zig:14:23: error: enum field missing: 'arst' | 34 | // tmp.zig:14:23: error: enum field missing: 'arst' |
test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_union_field.zig+3-1| ... | @@ -27,7 +27,9 @@ export fn entry() void { | ... | @@ -27,7 +27,9 @@ export fn entry() void { |
| 27 | tagged = .{ .unsigned = 1 }; | 27 | tagged = .{ .unsigned = 1 }; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | // @Type for tagged union with extra union field | 30 | // error |
| 31 | // backend=stage1 | ||
| 32 | // target=native | ||
| 31 | // | 33 | // |
| 32 | // tmp.zig:13:23: error: enum field not found: 'arst' | 34 | // tmp.zig:13:23: error: enum field not found: 'arst' |
| 33 | // tmp.zig:1:20: note: enum declared here | 35 | // tmp.zig:1:20: note: enum declared here |
test/compile_errors/stage1/obj/reify_type_for_union_with_opaque_field.zig+3-1| ... | @@ -12,6 +12,8 @@ export fn entry() void { | ... | @@ -12,6 +12,8 @@ export fn entry() void { |
| 12 | _ = Untagged{}; | 12 | _ = Untagged{}; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // @Type for union with opaque field | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:1:25: error: opaque types have unknown size and therefore cannot be directly embedded in unions | 19 | // tmp.zig:1:25: error: opaque types have unknown size and therefore cannot be directly embedded in unions |
test/compile_errors/stage1/obj/reify_type_for_union_with_zero_fields.zig+3-1| ... | @@ -10,6 +10,8 @@ export fn entry() void { | ... | @@ -10,6 +10,8 @@ export fn entry() void { |
| 10 | _ = Untagged{}; | 10 | _ = Untagged{}; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // @Type for union with zero fields | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:1:25: error: unions must have 1 or more fields | 17 | // tmp.zig:1:25: error: unions must have 1 or more fields |
test/compile_errors/stage1/obj/reify_type_union_payload_is_undefined.zig+3-1| ... | @@ -3,6 +3,8 @@ const Foo = @Type(.{ | ... | @@ -3,6 +3,8 @@ const Foo = @Type(.{ |
| 3 | }); | 3 | }); |
| 4 | comptime { _ = Foo; } | 4 | comptime { _ = Foo; } |
| 5 | 5 | ||
| 6 | // @Type() union payload is undefined | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:1:20: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:1:20: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/reify_type_with_Type.Int.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | }); | 6 | }); |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // @Type with Type.Int | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:3:31: error: expected type 'std.builtin.Type', found 'std.builtin.Type.Int' | 13 | // tmp.zig:3:31: error: expected type 'std.builtin.Type', found 'std.builtin.Type.Int' |
test/compile_errors/stage1/obj/reify_type_with_non-constant_expression.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | _ = @Type(globalTypeInfo); | 4 | _ = @Type(globalTypeInfo); |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // @Type with non-constant expression | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:4:15: error: unable to evaluate constant expression | 11 | // tmp.zig:4:15: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/reify_type_with_undefined.zig+3-1| ... | @@ -12,7 +12,9 @@ comptime { | ... | @@ -12,7 +12,9 @@ comptime { |
| 12 | }); | 12 | }); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // @Type with undefined | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:2:16: error: use of undefined value here causes undefined behavior | 19 | // tmp.zig:2:16: error: use of undefined value here causes undefined behavior |
| 18 | // tmp.zig:5:16: error: use of undefined value here causes undefined behavior | 20 | // tmp.zig:5:16: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr.zig+3-1| ... | @@ -11,6 +11,8 @@ pub const Container = struct { | ... | @@ -11,6 +11,8 @@ pub const Container = struct { |
| 11 | not_optional: i32, | 11 | not_optional: i32, |
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | // result location incompatibility mismatching handle_is_ptr | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32' | 18 | // tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32' |
test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr_generic_call.zig+3-1| ... | @@ -11,6 +11,8 @@ pub const Container = struct { | ... | @@ -11,6 +11,8 @@ pub const Container = struct { |
| 11 | not_optional: i32, | 11 | not_optional: i32, |
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | // result location incompatibility mismatching handle_is_ptr (generic call) | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32' | 18 | // tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32' |
test/compile_errors/stage1/obj/return_from_defer_expression.zig+3-1| ... | @@ -14,6 +14,8 @@ pub fn maybeInt() ?i32 { | ... | @@ -14,6 +14,8 @@ pub fn maybeInt() ?i32 { |
| 14 | 14 | ||
| 15 | export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); } | 15 | export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); } |
| 16 | 16 | ||
| 17 | // return from defer expression | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:4:11: error: 'try' not allowed inside defer expression | 21 | // tmp.zig:4:11: error: 'try' not allowed inside defer expression |
test/compile_errors/stage1/obj/returning_error_from_void_async_function.zig+3-1| ... | @@ -5,6 +5,8 @@ fn amain() callconv(.Async) void { | ... | @@ -5,6 +5,8 @@ fn amain() callconv(.Async) void { |
| 5 | return error.ShouldBeCompileError; | 5 | return error.ShouldBeCompileError; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // returning error from void async function | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:17: error: expected type 'void', found 'error{ShouldBeCompileError}' | 12 | // tmp.zig:5:17: error: expected type 'void', found 'error{ShouldBeCompileError}' |
test/compile_errors/stage1/obj/runtime-known_async_function_called.zig+3-1| ... | @@ -7,6 +7,8 @@ fn amain() void { | ... | @@ -7,6 +7,8 @@ fn amain() void { |
| 7 | } | 7 | } |
| 8 | fn afunc() callconv(.Async) void {} | 8 | fn afunc() callconv(.Async) void {} |
| 9 | 9 | ||
| 10 | // runtime-known async function called | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:6:12: error: function is not comptime-known; @asyncCall required | 14 | // tmp.zig:6:12: error: function is not comptime-known; @asyncCall required |
test/compile_errors/stage1/obj/runtime-known_function_called_with_async_keyword.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | 5 | ||
| 6 | fn afunc() callconv(.Async) void { } | 6 | fn afunc() callconv(.Async) void { } |
| 7 | 7 | ||
| 8 | // runtime-known function called with async keyword | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:15: error: function is not comptime-known; @asyncCall required | 12 | // tmp.zig:3:15: error: function is not comptime-known; @asyncCall required |
test/compile_errors/stage1/obj/runtime_assignment_to_comptime_struct_type.zig+3-1| ... | @@ -8,6 +8,8 @@ export fn f() void { | ... | @@ -8,6 +8,8 @@ export fn f() void { |
| 8 | _ = foo; | 8 | _ = foo; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // runtime assignment to comptime struct type | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:7:23: error: unable to evaluate constant expression | 15 | // tmp.zig:7:23: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/runtime_assignment_to_comptime_union_type.zig+3-1| ... | @@ -8,6 +8,8 @@ export fn f() void { | ... | @@ -8,6 +8,8 @@ export fn f() void { |
| 8 | _ = foo; | 8 | _ = foo; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // runtime assignment to comptime union type | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:7:23: error: unable to evaluate constant expression | 15 | // tmp.zig:7:23: error: unable to evaluate constant expression |
test/compile_errors/stage1/obj/runtime_cast_to_union_which_has_non-void_fields.zig+3-1| ... | @@ -12,7 +12,9 @@ fn foo(l: Letter) void { | ... | @@ -12,7 +12,9 @@ fn foo(l: Letter) void { |
| 12 | _ = x; | 12 | _ = x; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // runtime cast to union which has non-void fields | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:11:20: error: runtime cast to union 'Value' which has non-void fields | 19 | // tmp.zig:11:20: error: runtime cast to union 'Value' which has non-void fields |
| 18 | // tmp.zig:3:5: note: field 'A' has type 'i32' | 20 | // tmp.zig:3:5: note: field 'A' has type 'i32' |
test/compile_errors/stage1/obj/runtime_index_into_comptime_type_slice.zig+3-1| ... | @@ -10,6 +10,8 @@ export fn entry() void { | ... | @@ -10,6 +10,8 @@ export fn entry() void { |
| 10 | _ = field; | 10 | _ = field; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // runtime index into comptime type slice | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:9:51: error: values of type 'std.builtin.Type.StructField' must be comptime known, but index value is runtime known | 17 | // tmp.zig:9:51: error: values of type 'std.builtin.Type.StructField' must be comptime known, but index value is runtime known |
test/compile_errors/stage1/obj/saturating_arithmetic_does_not_allow_floats.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn a() void { | ... | @@ -2,6 +2,8 @@ export fn a() void { |
| 2 | _ = @as(f32, 1.0) +| @as(f32, 1.0); | 2 | _ = @as(f32, 1.0) +| @as(f32, 1.0); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // saturating arithmetic does not allow floats | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // error: invalid operands to binary expression: 'f32' and 'f32' | 9 | // error: invalid operands to binary expression: 'f32' and 'f32' |
test/compile_errors/stage1/obj/saturating_shl_assign_does_not_allow_negative_rhs_at_comptime.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn a() void { | ... | @@ -5,6 +5,8 @@ export fn a() void { |
| 5 | } | 5 | } |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // saturating shl assign does not allow negative rhs at comptime | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // error: shift by negative value -2 | 12 | // error: shift by negative value -2 |
test/compile_errors/stage1/obj/saturating_shl_does_not_allow_negative_rhs_at_comptime.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn a() void { | ... | @@ -2,6 +2,8 @@ export fn a() void { |
| 2 | _ = @as(i32, 1) <<| @as(i32, -2); | 2 | _ = @as(i32, 1) <<| @as(i32, -2); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // saturating shl does not allow negative rhs at comptime | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // error: shift by negative value -2 | 9 | // error: shift by negative value -2 |
test/compile_errors/stage1/obj/setAlignStack_in_inline_function.zig+3-1| ... | @@ -5,6 +5,8 @@ fn foo() callconv(.Inline) void { | ... | @@ -5,6 +5,8 @@ fn foo() callconv(.Inline) void { |
| 5 | @setAlignStack(16); | 5 | @setAlignStack(16); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // @setAlignStack in inline function | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:5: error: @setAlignStack in inline function | 12 | // tmp.zig:5:5: error: @setAlignStack in inline function |
test/compile_errors/stage1/obj/setAlignStack_in_naked_function.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() callconv(.Naked) void { | ... | @@ -2,6 +2,8 @@ export fn entry() callconv(.Naked) void { |
| 2 | @setAlignStack(16); | 2 | @setAlignStack(16); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @setAlignStack in naked function | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: @setAlignStack in naked function | 9 | // tmp.zig:2:5: error: @setAlignStack in naked function |
test/compile_errors/stage1/obj/setAlignStack_outside_function.zig+3-1| ... | @@ -2,6 +2,8 @@ comptime { | ... | @@ -2,6 +2,8 @@ comptime { |
| 2 | @setAlignStack(16); | 2 | @setAlignStack(16); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @setAlignStack outside function | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: @setAlignStack outside function | 9 | // tmp.zig:2:5: error: @setAlignStack outside function |
test/compile_errors/stage1/obj/setAlignStack_set_twice.zig+3-1| ... | @@ -3,7 +3,9 @@ export fn entry() void { | ... | @@ -3,7 +3,9 @@ export fn entry() void { |
| 3 | @setAlignStack(16); | 3 | @setAlignStack(16); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @setAlignStack set twice | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: alignstack set twice | 10 | // tmp.zig:3:5: error: alignstack set twice |
| 9 | // tmp.zig:2:5: note: first set here | 11 | // tmp.zig:2:5: note: first set here |
test/compile_errors/stage1/obj/setAlignStack_too_big.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | @setAlignStack(511 + 1); | 2 | @setAlignStack(511 + 1); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @setAlignStack too big | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: attempt to @setAlignStack(512); maximum is 256 | 9 | // tmp.zig:2:5: error: attempt to @setAlignStack(512); maximum is 256 |
test/compile_errors/stage1/obj/setFloatMode_twice_for_same_scope.zig+3-1| ... | @@ -3,7 +3,9 @@ export fn foo() void { | ... | @@ -3,7 +3,9 @@ export fn foo() void { |
| 3 | @setFloatMode(@import("std").builtin.FloatMode.Optimized); | 3 | @setFloatMode(@import("std").builtin.FloatMode.Optimized); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @setFloatMode twice for same scope | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: float mode set twice for same scope | 10 | // tmp.zig:3:5: error: float mode set twice for same scope |
| 9 | // tmp.zig:2:5: note: first set here | 11 | // tmp.zig:2:5: note: first set here |
test/compile_errors/stage1/obj/setRuntimeSafety_twice_for_same_scope.zig+3-1| ... | @@ -3,7 +3,9 @@ export fn foo() void { | ... | @@ -3,7 +3,9 @@ export fn foo() void { |
| 3 | @setRuntimeSafety(false); | 3 | @setRuntimeSafety(false); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @setRuntimeSafety twice for same scope | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: runtime safety set twice for same scope | 10 | // tmp.zig:3:5: error: runtime safety set twice for same scope |
| 9 | // tmp.zig:2:5: note: first set here | 11 | // tmp.zig:2:5: note: first set here |
test/compile_errors/stage1/obj/setting_a_section_on_a_local_variable.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() i32 { | ... | @@ -3,6 +3,8 @@ export fn entry() i32 { |
| 3 | return foo; | 3 | return foo; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // setting a section on a local variable | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:30: error: cannot set section of local variable 'foo' | 10 | // tmp.zig:2:30: error: cannot set section of local variable 'foo' |
test/compile_errors/stage1/obj/shift_amount_has_to_be_an_integer_type.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // shift amount has to be an integer type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:21: error: shift amount has to be an integer type, but found '*const u8' | 10 | // tmp.zig:2:21: error: shift amount has to be an integer type, but found '*const u8' |
test/compile_errors/stage1/obj/shift_by_negative_comptime_integer.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a; | 3 | _ = a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // shift by negative comptime integer | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:18: error: shift by negative value -1 | 10 | // tmp.zig:2:18: error: shift by negative value -1 |
test/compile_errors/stage1/obj/shift_left_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a >>= 2; | 3 | a >>= 2; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // shift left assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/shift_left_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a << 2; | 3 | _ = a << 2; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // shift left on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/shift_right_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a >>= 2; | 3 | a >>= 2; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // shift right assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/shift_right_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a >> 2; | 3 | _ = a >> 2; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // shift right on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/shifting_RHS_is_log2_of_LHS_int_bit_width.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry(x: u8, y: u8) u8 { | ... | @@ -2,6 +2,8 @@ export fn entry(x: u8, y: u8) u8 { |
| 2 | return x << y; | 2 | return x << y; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // shifting RHS is log2 of LHS int bit width | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:17: error: expected type 'u3', found 'u8' | 9 | // tmp.zig:2:17: error: expected type 'u3', found 'u8' |
test/compile_errors/stage1/obj/shifting_without_int_type_or_comptime_known.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry(x: u8) u8 { | ... | @@ -2,6 +2,8 @@ export fn entry(x: u8) u8 { |
| 2 | return 0x11 << x; | 2 | return 0x11 << x; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // shifting without int type or comptime known | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be compile-time known | 9 | // tmp.zig:2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be compile-time known |
test/compile_errors/stage1/obj/shlExact_shifts_out_1_bits.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @shlExact shifts out 1 bits | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: operation caused overflow | 10 | // tmp.zig:2:15: error: operation caused overflow |
test/compile_errors/stage1/obj/shrExact_shifts_out_1_bits.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @shrExact shifts out 1 bits | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: exact shift shifted out 1 bits | 10 | // tmp.zig:2:15: error: exact shift shifted out 1 bits |
test/compile_errors/stage1/obj/signed_integer_division.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 { | ... | @@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 { |
| 2 | return a / b; | 2 | return a / b; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // signed integer division | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact | 9 | // tmp.zig:2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact |
test/compile_errors/stage1/obj/signed_integer_remainder_division.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 { | ... | @@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 { |
| 2 | return a % b; | 2 | return a % b; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // signed integer remainder division | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:14: error: remainder division with 'i32' and 'i32': signed integers and floats must use @rem or @mod | 9 | // tmp.zig:2:14: error: remainder division with 'i32' and 'i32': signed integers and floats must use @rem or @mod |
test/compile_errors/stage1/obj/sizeOf_bad_type.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() usize { | ... | @@ -2,6 +2,8 @@ export fn entry() usize { |
| 2 | return @sizeOf(@TypeOf(null)); | 2 | return @sizeOf(@TypeOf(null)); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @sizeOf bad type | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:20: error: no size available for type '@Type(.Null)' | 9 | // tmp.zig:2:20: error: no size available for type '@Type(.Null)' |
test/compile_errors/stage1/obj/slice_cannot_have_its_bytes_reinterpreted.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn foo() void { | ... | @@ -4,6 +4,8 @@ export fn foo() void { |
| 4 | _ = value; | 4 | _ = value; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // slice cannot have its bytes reinterpreted | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // :3:52: error: slice '[]const u8' cannot have its bytes reinterpreted | 11 | // :3:52: error: slice '[]const u8' cannot have its bytes reinterpreted |
test/compile_errors/stage1/obj/slice_passed_as_array_init_type.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // slice passed as array init type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8' | 10 | // tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8' |
test/compile_errors/stage1/obj/slice_passed_as_array_init_type_with_elems.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // slice passed as array init type with elems | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8' | 10 | // tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8' |
test/compile_errors/stage1/obj/slice_sentinel_mismatch-1.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = y; | 3 | _ = y; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // slice sentinel mismatch - 1 | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:37: error: expected type '[:1]const u8', found '*const [2:2]u8' | 10 | // tmp.zig:2:37: error: expected type '[:1]const u8', found '*const [2:2]u8' |
test/compile_errors/stage1/obj/slice_sentinel_mismatch-2.zig+3-1| ... | @@ -4,7 +4,9 @@ fn foo() [:0]u8 { | ... | @@ -4,7 +4,9 @@ fn foo() [:0]u8 { |
| 4 | } | 4 | } |
| 5 | comptime { _ = foo; } | 5 | comptime { _ = foo; } |
| 6 | 6 | ||
| 7 | // slice sentinel mismatch - 2 | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:12: error: expected type '[:0]u8', found '[]u8' | 11 | // tmp.zig:3:12: error: expected type '[:0]u8', found '[]u8' |
| 10 | // tmp.zig:3:12: note: destination pointer requires a terminating '0' sentinel | 12 | // tmp.zig:3:12: note: destination pointer requires a terminating '0' sentinel |
test/compile_errors/stage1/obj/slicing_of_global_undefined_pointer.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = buf[0..1]; | 3 | _ = buf[0..1]; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // slicing of global undefined pointer | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:12: error: non-zero length slice of undefined pointer | 10 | // tmp.zig:3:12: error: non-zero length slice of undefined pointer |
test/compile_errors/stage1/obj/slicing_single-item_pointer.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry(ptr: *i32) void { | ... | @@ -3,6 +3,8 @@ export fn entry(ptr: *i32) void { |
| 3 | _ = slice; | 3 | _ = slice; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // slicing single-item pointer | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:22: error: slice of single-item pointer | 10 | // tmp.zig:2:22: error: slice of single-item pointer |
test/compile_errors/stage1/obj/specify_enum_tag_type_that_is_too_small.zig+3-1| ... | @@ -11,6 +11,8 @@ export fn entry() void { | ... | @@ -11,6 +11,8 @@ export fn entry() void { |
| 11 | _ = x; | 11 | _ = x; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // specify enum tag type that is too small | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:6:5: error: enumeration value 4 too large for type 'u2' | 18 | // tmp.zig:6:5: error: enumeration value 4 too large for type 'u2' |
test/compile_errors/stage1/obj/specify_non-integer_enum_tag_type.zig+3-1| ... | @@ -9,6 +9,8 @@ export fn entry() void { | ... | @@ -9,6 +9,8 @@ export fn entry() void { |
| 9 | _ = x; | 9 | _ = x; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // specify non-integer enum tag type | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:1:21: error: expected integer, found 'f32' | 16 | // tmp.zig:1:21: error: expected integer, found 'f32' |
test/compile_errors/stage1/obj/src_outside_function.zig+3-1| ... | @@ -2,6 +2,8 @@ comptime { | ... | @@ -2,6 +2,8 @@ comptime { |
| 2 | @src(); | 2 | @src(); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @src outside function | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: @src outside function | 9 | // tmp.zig:2:5: error: @src outside function |
test/compile_errors/stage1/obj/std.fmt_error_for_unused_arguments.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | @import("std").debug.print("{d} {d} {d} {d} {d}", .{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}); | 2 | @import("std").debug.print("{d} {d} {d} {d} {d}", .{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // std.fmt error for unused arguments | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // ?:?:?: error: 10 unused arguments in '{d} {d} {d} {d} {d}' | 9 | // ?:?:?: error: 10 unused arguments in '{d} {d} {d} {d} {d}' |
test/compile_errors/stage1/obj/store_vector_pointer_with_unknown_runtime_index.zig+3-1| ... | @@ -9,6 +9,8 @@ fn storev(ptr: anytype, val: i32) void { | ... | @@ -9,6 +9,8 @@ fn storev(ptr: anytype, val: i32) void { |
| 9 | ptr.* = val; | 9 | ptr.* = val; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // store vector pointer with unknown runtime index | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:9:8: error: unable to determine vector element index of type '*align(16:0:4:?) i32 | 16 | // tmp.zig:9:8: error: unable to determine vector element index of type '*align(16:0:4:?) i32 |
test/compile_errors/stage1/obj/storing_runtime_value_in_compile_time_variable_then_using_it.zig+3-1| ... | @@ -42,6 +42,8 @@ export fn entry() void { | ... | @@ -42,6 +42,8 @@ export fn entry() void { |
| 42 | } | 42 | } |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | // storing runtime value in compile time variable then using it | 45 | // error |
| 46 | // backend=stage1 | ||
| 47 | // target=native | ||
| 46 | // | 48 | // |
| 47 | // tmp.zig:38:29: error: cannot store runtime value in compile time variable | 49 | // tmp.zig:38:29: error: cannot store runtime value in compile time variable |
test/compile_errors/stage1/obj/struct_depends_on_itself_via_optional_field.zig+3-1| ... | @@ -10,7 +10,9 @@ export fn entry() void { | ... | @@ -10,7 +10,9 @@ export fn entry() void { |
| 10 | _ = obj; | 10 | _ = obj; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // struct depends on itself via optional field | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:1:17: error: struct 'LhsExpr' depends on itself | 17 | // tmp.zig:1:17: error: struct 'LhsExpr' depends on itself |
| 16 | // tmp.zig:5:5: note: while checking this field | 18 | // tmp.zig:5:5: note: while checking this field |
test/compile_errors/stage1/obj/struct_field_missing_type.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | _ = a; | 6 | _ = a; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // struct field missing type | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:2:5: error: struct field missing type | 13 | // tmp.zig:2:5: error: struct field missing type |
test/compile_errors/stage1/obj/struct_init_syntax_for_array.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = foo; | 3 | _ = foo; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // struct init syntax for array | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:1:13: error: initializing array with struct syntax | 10 | // tmp.zig:1:13: error: initializing array with struct syntax |
test/compile_errors/stage1/obj/struct_with_declarations_unavailable_for_reify_type.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | _ = @Type(@typeInfo(struct { const foo = 1; })); | 2 | _ = @Type(@typeInfo(struct { const foo = 1; })); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // struct with declarations unavailable for @Type | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:15: error: Type.Struct.decls must be empty for @Type | 9 | // tmp.zig:2:15: error: Type.Struct.decls must be empty for @Type |
test/compile_errors/stage1/obj/struct_with_invalid_field.zig+3-1| ... | @@ -23,6 +23,8 @@ export fn entry() void { | ... | @@ -23,6 +23,8 @@ export fn entry() void { |
| 23 | _ = a; | 23 | _ = a; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | // struct with invalid field | 26 | // error |
| 27 | // backend=stage1 | ||
| 28 | // target=native | ||
| 27 | // | 29 | // |
| 28 | // tmp.zig:14:17: error: use of undeclared identifier 'HeaderValue' | 30 | // tmp.zig:14:17: error: use of undeclared identifier 'HeaderValue' |
test/compile_errors/stage1/obj/sub_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a -= a; | 3 | a -= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // sub assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/sub_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a - a; | 3 | _ = a - a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // sub on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/sub_overflow_in_function_evaluation.zig+3-1| ... | @@ -5,6 +5,8 @@ fn sub(a: u16, b: u16) u16 { | ... | @@ -5,6 +5,8 @@ fn sub(a: u16, b: u16) u16 { |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } |
| 7 | 7 | ||
| 8 | // sub overflow in function evaluation | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:14: error: operation caused overflow | 12 | // tmp.zig:3:14: error: operation caused overflow |
test/compile_errors/stage1/obj/sub_wrap_assign_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | a -%= a; | 3 | a -%= a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // sub wrap assign on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:5: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/sub_wrap_on_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = a -% a; | 3 | _ = a -% a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // sub wrap on undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:3:9: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/suspend_inside_suspend_block.zig+3-1| ... | @@ -8,7 +8,9 @@ fn foo() void { | ... | @@ -8,7 +8,9 @@ fn foo() void { |
| 8 | } | 8 | } |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // suspend inside suspend block | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:6:9: error: cannot suspend inside suspend block | 15 | // tmp.zig:6:9: error: cannot suspend inside suspend block |
| 14 | // tmp.zig:5:5: note: other suspend block here | 16 | // tmp.zig:5:5: note: other suspend block here |
test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong.zig+3-1| ... | @@ -16,7 +16,9 @@ fn f(n: Number) i32 { | ... | @@ -16,7 +16,9 @@ fn f(n: Number) i32 { |
| 16 | 16 | ||
| 17 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 17 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 18 | 18 | ||
| 19 | // switch expression - duplicate enumeration prong | 19 | // error |
| 20 | // backend=stage1 | ||
| 21 | // target=native | ||
| 20 | // | 22 | // |
| 21 | // tmp.zig:13:15: error: duplicate switch value | 23 | // tmp.zig:13:15: error: duplicate switch value |
| 22 | // tmp.zig:10:15: note: other value here | 24 | // tmp.zig:10:15: note: other value here |
test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong_when_else_present.zig+3-1| ... | @@ -17,7 +17,9 @@ fn f(n: Number) i32 { | ... | @@ -17,7 +17,9 @@ fn f(n: Number) i32 { |
| 17 | 17 | ||
| 18 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 18 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 19 | 19 | ||
| 20 | // switch expression - duplicate enumeration prong when else present | 20 | // error |
| 21 | // backend=stage1 | ||
| 22 | // target=native | ||
| 21 | // | 23 | // |
| 22 | // tmp.zig:13:15: error: duplicate switch value | 24 | // tmp.zig:13:15: error: duplicate switch value |
| 23 | // tmp.zig:10:15: note: other value here | 25 | // tmp.zig:10:15: note: other value here |
test/compile_errors/stage1/obj/switch_expression-duplicate_or_overlapping_integer_value.zig+3-1| ... | @@ -8,7 +8,9 @@ fn foo(x: u8) u8 { | ... | @@ -8,7 +8,9 @@ fn foo(x: u8) u8 { |
| 8 | } | 8 | } |
| 9 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 9 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 10 | 10 | ||
| 11 | // switch expression - duplicate or overlapping integer value | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:6:9: error: duplicate switch value | 15 | // tmp.zig:6:9: error: duplicate switch value |
| 14 | // tmp.zig:5:14: note: previous value here | 16 | // tmp.zig:5:14: note: previous value here |
test/compile_errors/stage1/obj/switch_expression-duplicate_type.zig+3-1| ... | @@ -9,7 +9,9 @@ fn foo(comptime T: type, x: T) u8 { | ... | @@ -9,7 +9,9 @@ fn foo(comptime T: type, x: T) u8 { |
| 9 | } | 9 | } |
| 10 | export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } | 10 | export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } |
| 11 | 11 | ||
| 12 | // switch expression - duplicate type | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:6:9: error: duplicate switch value | 16 | // tmp.zig:6:9: error: duplicate switch value |
| 15 | // tmp.zig:4:9: note: previous value here | 17 | // tmp.zig:4:9: note: previous value here |
test/compile_errors/stage1/obj/switch_expression-duplicate_type_struct_alias.zig+3-1| ... | @@ -13,7 +13,9 @@ fn foo(comptime T: type, x: T) u8 { | ... | @@ -13,7 +13,9 @@ fn foo(comptime T: type, x: T) u8 { |
| 13 | } | 13 | } |
| 14 | export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } | 14 | export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } |
| 15 | 15 | ||
| 16 | // switch expression - duplicate type (struct alias) | 16 | // error |
| 17 | // backend=stage1 | ||
| 18 | // target=native | ||
| 17 | // | 19 | // |
| 18 | // tmp.zig:10:9: error: duplicate switch value | 20 | // tmp.zig:10:9: error: duplicate switch value |
| 19 | // tmp.zig:8:9: note: previous value here | 21 | // tmp.zig:8:9: note: previous value here |
test/compile_errors/stage1/obj/switch_expression-missing_enumeration_prong.zig+3-1| ... | @@ -14,6 +14,8 @@ fn f(n: Number) i32 { | ... | @@ -14,6 +14,8 @@ fn f(n: Number) i32 { |
| 14 | 14 | ||
| 15 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 15 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 16 | 16 | ||
| 17 | // switch expression - missing enumeration prong | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:8:5: error: enumeration value 'Number.Four' not handled in switch | 21 | // tmp.zig:8:5: error: enumeration value 'Number.Four' not handled in switch |
test/compile_errors/stage1/obj/switch_expression-multiple_else_prongs.zig+3-1| ... | @@ -9,6 +9,8 @@ export fn entry() void { | ... | @@ -9,6 +9,8 @@ export fn entry() void { |
| 9 | f(1234); | 9 | f(1234); |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // switch expression - multiple else prongs | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:5:9: error: multiple else prongs in switch expression | 16 | // tmp.zig:5:9: error: multiple else prongs in switch expression |
test/compile_errors/stage1/obj/switch_expression-non_exhaustive_integer_prongs.zig+3-1| ... | @@ -5,6 +5,8 @@ fn foo(x: u8) void { | ... | @@ -5,6 +5,8 @@ fn foo(x: u8) void { |
| 5 | } | 5 | } |
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 6 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 7 | 7 | ||
| 8 | // switch expression - non exhaustive integer prongs | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:2:5: error: switch must handle all possibilities | 12 | // tmp.zig:2:5: error: switch must handle all possibilities |
test/compile_errors/stage1/obj/switch_expression-switch_on_pointer_type_with_no_else.zig+3-1| ... | @@ -6,6 +6,8 @@ fn foo(x: *u8) void { | ... | @@ -6,6 +6,8 @@ fn foo(x: *u8) void { |
| 6 | const y: u8 = 100; | 6 | const y: u8 = 100; |
| 7 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 7 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 8 | 8 | ||
| 9 | // switch expression - switch on pointer type with no else | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:2:5: error: else prong required when switching on type '*u8' | 13 | // tmp.zig:2:5: error: else prong required when switching on type '*u8' |
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_bool.zig+3-1| ... | @@ -7,6 +7,8 @@ fn foo(x: bool) void { | ... | @@ -7,6 +7,8 @@ fn foo(x: bool) void { |
| 7 | } | 7 | } |
| 8 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 8 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 9 | 9 | ||
| 10 | // switch expression - unreachable else prong (bool) | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:9: error: unreachable else prong, all cases already handled | 14 | // tmp.zig:5:9: error: unreachable else prong, all cases already handled |
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_enum.zig+3-1| ... | @@ -17,6 +17,8 @@ fn foo(x: u8) void { | ... | @@ -17,6 +17,8 @@ fn foo(x: u8) void { |
| 17 | 17 | ||
| 18 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 18 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 19 | 19 | ||
| 20 | // switch expression - unreachable else prong (enum) | 20 | // error |
| 21 | // backend=stage1 | ||
| 22 | // target=native | ||
| 21 | // | 23 | // |
| 22 | // tmp.zig:14:9: error: unreachable else prong, all cases already handled | 24 | // tmp.zig:14:9: error: unreachable else prong, all cases already handled |
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_i8.zig+3-1| ... | @@ -10,6 +10,8 @@ fn foo(x: i8) void { | ... | @@ -10,6 +10,8 @@ fn foo(x: i8) void { |
| 10 | } | 10 | } |
| 11 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 11 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 12 | 12 | ||
| 13 | // switch expression - unreachable else prong (range i8) | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:8:9: error: unreachable else prong, all cases already handled | 17 | // tmp.zig:8:9: error: unreachable else prong, all cases already handled |
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_u8.zig+3-1| ... | @@ -10,6 +10,8 @@ fn foo(x: u8) void { | ... | @@ -10,6 +10,8 @@ fn foo(x: u8) void { |
| 10 | } | 10 | } |
| 11 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 11 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 12 | 12 | ||
| 13 | // switch expression - unreachable else prong (range u8) | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:8:9: error: unreachable else prong, all cases already handled | 17 | // tmp.zig:8:9: error: unreachable else prong, all cases already handled |
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u1.zig+3-1| ... | @@ -7,6 +7,8 @@ fn foo(x: u1) void { | ... | @@ -7,6 +7,8 @@ fn foo(x: u1) void { |
| 7 | } | 7 | } |
| 8 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 8 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 9 | 9 | ||
| 10 | // switch expression - unreachable else prong (u1) | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:5:9: error: unreachable else prong, all cases already handled | 14 | // tmp.zig:5:9: error: unreachable else prong, all cases already handled |
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u2.zig+3-1| ... | @@ -9,6 +9,8 @@ fn foo(x: u2) void { | ... | @@ -9,6 +9,8 @@ fn foo(x: u2) void { |
| 9 | } | 9 | } |
| 10 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 10 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } |
| 11 | 11 | ||
| 12 | // switch expression - unreachable else prong (u2) | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:7:9: error: unreachable else prong, all cases already handled | 16 | // tmp.zig:7:9: error: unreachable else prong, all cases already handled |
test/compile_errors/stage1/obj/switch_on_enum_with_1_field_with_no_prongs.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | switch (f) {} | 5 | switch (f) {} |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // switch on enum with 1 field with no prongs | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:5: error: enumeration value 'Foo.M' not handled in switch | 12 | // tmp.zig:5:5: error: enumeration value 'Foo.M' not handled in switch |
test/compile_errors/stage1/obj/switch_on_union_with_no_attached_enum.zig+3-1| ... | @@ -14,7 +14,9 @@ fn foo(a: *const Payload) void { | ... | @@ -14,7 +14,9 @@ fn foo(a: *const Payload) void { |
| 14 | } | 14 | } |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // switch on union with no attached enum | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:11:14: error: switch on union which has no attached enum | 21 | // tmp.zig:11:14: error: switch on union which has no attached enum |
| 20 | // tmp.zig:1:17: note: consider 'union(enum)' here | 22 | // tmp.zig:1:17: note: consider 'union(enum)' here |
test/compile_errors/stage1/obj/switch_with_invalid_expression_parameter.zig+3-1| ... | @@ -10,6 +10,8 @@ fn Test(comptime T: type) void { | ... | @@ -10,6 +10,8 @@ fn Test(comptime T: type) void { |
| 10 | _ = x; | 10 | _ = x; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // switch with invalid expression parameter | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:7:17: error: switch on type 'type' provides no expression parameter | 17 | // tmp.zig:7:17: error: switch on type 'type' provides no expression parameter |
test/compile_errors/stage1/obj/switch_with_overlapping_case_ranges.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | } | 6 | } |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // switch with overlapping case ranges | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:9: error: duplicate switch value | 13 | // tmp.zig:5:9: error: duplicate switch value |
test/compile_errors/stage1/obj/tagName_used_on_union_with_no_associated_enum_tag.zig+3-1| ... | @@ -8,7 +8,9 @@ export fn entry() void { | ... | @@ -8,7 +8,9 @@ export fn entry() void { |
| 8 | _ = tagName; | 8 | _ = tagName; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // @tagName used on union with no associated enum tag | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:7:19: error: union has no associated enum | 15 | // tmp.zig:7:19: error: union has no associated enum |
| 14 | // tmp.zig:1:18: note: declared here | 16 | // tmp.zig:1:18: note: declared here |
test/compile_errors/stage1/obj/take_slice_of_invalid_dereference.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // take slice of invalid dereference | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:18: error: attempt to dereference non-pointer type 'comptime_int' | 10 | // tmp.zig:2:18: error: attempt to dereference non-pointer type 'comptime_int' |
test/compile_errors/stage1/obj/taking_bit_offset_of_void_field_in_struct.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn foo() void { | ... | @@ -6,6 +6,8 @@ export fn foo() void { |
| 6 | _ = fieldOffset; | 6 | _ = fieldOffset; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // taking bit offset of void field in struct | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:45: error: zero-bit field 'val' in struct 'Empty' has no offset | 13 | // tmp.zig:5:45: error: zero-bit field 'val' in struct 'Empty' has no offset |
test/compile_errors/stage1/obj/taking_byte_offset_of_void_field_in_struct.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn foo() void { | ... | @@ -6,6 +6,8 @@ export fn foo() void { |
| 6 | _ = fieldOffset; | 6 | _ = fieldOffset; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // taking byte offset of void field in struct | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:5:42: error: zero-bit field 'val' in struct 'Empty' has no offset | 13 | // tmp.zig:5:42: error: zero-bit field 'val' in struct 'Empty' has no offset |
test/compile_errors/stage1/obj/threadlocal_qualifier_on_const.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() i32 { | ... | @@ -3,6 +3,8 @@ export fn entry() i32 { |
| 3 | return x; | 3 | return x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // threadlocal qualifier on const | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:1:1: error: threadlocal variable cannot be constant | 10 | // tmp.zig:1:1: error: threadlocal variable cannot be constant |
test/compile_errors/stage1/obj/top_level_decl_dependency_loop.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn entry() void { | ... | @@ -5,6 +5,8 @@ export fn entry() void { |
| 5 | _ = c; | 5 | _ = c; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // top level decl dependency loop | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:2:19: error: dependency loop detected | 12 | // tmp.zig:2:19: error: dependency loop detected |
test/compile_errors/stage1/obj/truncate_sign_mismatch.zig+3-1| ... | @@ -15,7 +15,9 @@ export fn entry4() u8 { | ... | @@ -15,7 +15,9 @@ export fn entry4() u8 { |
| 15 | return @truncate(u8, x); | 15 | return @truncate(u8, x); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | // truncate sign mismatch | 18 | // error |
| 19 | // backend=stage1 | ||
| 20 | // target=native | ||
| 19 | // | 21 | // |
| 20 | // tmp.zig:3:26: error: expected signed integer type, found 'u32' | 22 | // tmp.zig:3:26: error: expected signed integer type, found 'u32' |
| 21 | // tmp.zig:7:26: error: expected unsigned integer type, found 'i32' | 23 | // tmp.zig:7:26: error: expected unsigned integer type, found 'i32' |
test/compile_errors/stage1/obj/truncate_undefined_value.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = z; | 3 | _ = z; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @truncate undefined value | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:27: error: use of undefined value here causes undefined behavior | 10 | // tmp.zig:2:27: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/try_in_function_with_non_error_return_type.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn f() void { | ... | @@ -3,6 +3,8 @@ export fn f() void { |
| 3 | } | 3 | } |
| 4 | fn something() anyerror!void { } | 4 | fn something() anyerror!void { } |
| 5 | 5 | ||
| 6 | // try in function with non error return type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:5: error: expected type 'void', found 'anyerror' | 10 | // tmp.zig:2:5: error: expected type 'void', found 'anyerror' |
test/compile_errors/stage1/obj/type_checking_function_pointers.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | a(c); | 6 | a(c); |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // type checking function pointers | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:6:7: error: expected type 'fn(*const u8) void', found 'fn(u8) void' | 13 | // tmp.zig:6:7: error: expected type 'fn(*const u8) void', found 'fn(u8) void' |
test/compile_errors/stage1/obj/type_variables_must_be_constant.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() foo { | ... | @@ -3,6 +3,8 @@ export fn entry() foo { |
| 3 | return 1; | 3 | return 1; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // type variables must be constant | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:1:1: error: variable of type 'type' must be constant | 10 | // tmp.zig:1:1: error: variable of type 'type' must be constant |
test/compile_errors/stage1/obj/undeclared_identifier.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn a() void { | ... | @@ -4,6 +4,8 @@ export fn a() void { |
| 4 | c; | 4 | c; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // undeclared identifier | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:5: error: use of undeclared identifier 'b' | 11 | // tmp.zig:3:5: error: use of undeclared identifier 'b' |
test/compile_errors/stage1/obj/undeclared_identifier_error_should_mark_fn_as_impure.zig+3-1| ... | @@ -5,6 +5,8 @@ fn test_a_thing() void { | ... | @@ -5,6 +5,8 @@ fn test_a_thing() void { |
| 5 | bad_fn_call(); | 5 | bad_fn_call(); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // undeclared identifier error should mark fn as impure | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:5: error: use of undeclared identifier 'bad_fn_call' | 12 | // tmp.zig:5:5: error: use of undeclared identifier 'bad_fn_call' |
test/compile_errors/stage1/obj/undeclared_identifier_in_unanalyzed_branch.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn a() void { | ... | @@ -4,6 +4,8 @@ export fn a() void { |
| 4 | } | 4 | } |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // undeclared identifier in unanalyzed branch | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:9: error: use of undeclared identifier 'lol_this_doesnt_exist' | 11 | // tmp.zig:3:9: error: use of undeclared identifier 'lol_this_doesnt_exist' |
test/compile_errors/stage1/obj/undefined_as_field_type_is_rejected.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry1() void { | ... | @@ -6,6 +6,8 @@ export fn entry1() void { |
| 6 | _ = foo; | 6 | _ = foo; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // undefined as field type is rejected | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:2:8: error: use of undefined value here causes undefined behavior | 13 | // tmp.zig:2:8: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/undefined_function_call.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn a() void { | ... | @@ -2,6 +2,8 @@ export fn a() void { |
| 2 | b(); | 2 | b(); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // undefined function call | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: use of undeclared identifier 'b' | 9 | // tmp.zig:2:5: error: use of undeclared identifier 'b' |
test/compile_errors/stage1/obj/underscore_is_not_a_declarable_symbol.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn f1() usize { | ... | @@ -3,6 +3,8 @@ export fn f1() usize { |
| 3 | return _; | 3 | return _; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // `_` is not a declarable symbol | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:9: error: '_' used as an identifier without @"_" syntax | 10 | // tmp.zig:2:9: error: '_' used as an identifier without @"_" syntax |
test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_for.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn returns() void { | ... | @@ -6,6 +6,8 @@ export fn returns() void { |
| 6 | } | 6 | } |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // `_` should not be usable inside for | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax | 13 | // tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax |
test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while.zig+3-1| ... | @@ -9,6 +9,8 @@ fn optionalReturn() ?u32 { | ... | @@ -9,6 +9,8 @@ fn optionalReturn() ?u32 { |
| 9 | return 1; | 9 | return 1; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // `_` should not be usable inside while | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax | 16 | // tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax |
test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while_else.zig+3-1| ... | @@ -11,6 +11,8 @@ fn optionalReturnError() !?u32 { | ... | @@ -11,6 +11,8 @@ fn optionalReturnError() !?u32 { |
| 11 | return error.optionalReturnError; | 11 | return error.optionalReturnError; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // `_` should not be usable inside while else | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:6:17: error: '_' used as an identifier without @"_" syntax | 18 | // tmp.zig:6:17: error: '_' used as an identifier without @"_" syntax |
test/compile_errors/stage1/obj/union_auto-enum_value_already_taken.zig+3-1| ... | @@ -10,7 +10,9 @@ export fn entry() void { | ... | @@ -10,7 +10,9 @@ export fn entry() void { |
| 10 | _ = x; | 10 | _ = x; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // union auto-enum value already taken | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 14 | // | 16 | // |
| 15 | // tmp.zig:6:9: error: enum tag value 60 already taken | 17 | // tmp.zig:6:9: error: enum tag value 60 already taken |
| 16 | // tmp.zig:4:9: note: other occurrence here | 18 | // tmp.zig:4:9: note: other occurrence here |
test/compile_errors/stage1/obj/union_enum_field_does_not_match_enum.zig+3-1| ... | @@ -14,7 +14,9 @@ export fn entry() void { | ... | @@ -14,7 +14,9 @@ export fn entry() void { |
| 14 | _ = a; | 14 | _ = a; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // union enum field does not match enum | 17 | // error |
| 18 | // backend=stage1 | ||
| 19 | // target=native | ||
| 18 | // | 20 | // |
| 19 | // tmp.zig:10:5: error: enum field not found: 'D' | 21 | // tmp.zig:10:5: error: enum field not found: 'D' |
| 20 | // tmp.zig:1:16: note: enum declared here | 22 | // tmp.zig:1:16: note: enum declared here |
test/compile_errors/stage1/obj/union_fields_with_value_assignments.zig+3-1| ... | @@ -6,7 +6,9 @@ export fn entry() void { | ... | @@ -6,7 +6,9 @@ export fn entry() void { |
| 6 | _ = x; | 6 | _ = x; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // union fields with value assignments | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:1:24: error: explicitly valued tagged union missing integer tag type | 13 | // tmp.zig:1:24: error: explicitly valued tagged union missing integer tag type |
| 12 | // tmp.zig:2:14: note: tag value specified here | 14 | // tmp.zig:2:14: note: tag value specified here |
test/compile_errors/stage1/obj/union_with_0_fields.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | const Foo = union {}; | 1 | const Foo = union {}; |
| 2 | 2 | ||
| 3 | // union with 0 fields | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:13: error: union declarations must have at least one tag | 7 | // tmp.zig:1:13: error: union declarations must have at least one tag |
test/compile_errors/stage1/obj/union_with_specified_enum_omits_field.zig+3-1| ... | @@ -11,7 +11,9 @@ export fn entry() usize { | ... | @@ -11,7 +11,9 @@ export fn entry() usize { |
| 11 | return @sizeOf(Payload); | 11 | return @sizeOf(Payload); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // union with specified enum omits field | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 15 | // | 17 | // |
| 16 | // tmp.zig:6:17: error: enum field missing: 'C' | 18 | // tmp.zig:6:17: error: enum field missing: 'C' |
| 17 | // tmp.zig:4:5: note: declared here | 19 | // tmp.zig:4:5: note: declared here |
test/compile_errors/stage1/obj/union_with_too_small_explicit_signed_tag_type.zig+3-1| ... | @@ -8,7 +8,9 @@ export fn entry() void { | ... | @@ -8,7 +8,9 @@ export fn entry() void { |
| 8 | _ = U{ .D = 1 }; | 8 | _ = U{ .D = 1 }; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // union with too small explicit signed tag type | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:1:22: error: specified integer tag type cannot represent every field | 15 | // tmp.zig:1:22: error: specified integer tag type cannot represent every field |
| 14 | // tmp.zig:1:22: note: type i2 cannot fit values in range 0...3 | 16 | // tmp.zig:1:22: note: type i2 cannot fit values in range 0...3 |
test/compile_errors/stage1/obj/union_with_too_small_explicit_unsigned_tag_type.zig+3-1| ... | @@ -9,7 +9,9 @@ export fn entry() void { | ... | @@ -9,7 +9,9 @@ export fn entry() void { |
| 9 | _ = U{ .E = 1 }; | 9 | _ = U{ .E = 1 }; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // union with too small explicit unsigned tag type | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:1:22: error: specified integer tag type cannot represent every field | 16 | // tmp.zig:1:22: error: specified integer tag type cannot represent every field |
| 15 | // tmp.zig:1:22: note: type u2 cannot fit values in range 0...4 | 17 | // tmp.zig:1:22: note: type u2 cannot fit values in range 0...4 |
test/compile_errors/stage1/obj/unknown_length_pointer_to_opaque.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | export const T = [*]opaque {}; | 1 | export const T = [*]opaque {}; |
| 2 | 2 | ||
| 3 | // unknown length pointer to opaque | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:21: error: unknown-length pointer to opaque | 7 | // tmp.zig:1:21: error: unknown-length pointer to opaque |
test/compile_errors/stage1/obj/unreachable_code-double_break.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn a() void { | ... | @@ -4,7 +4,9 @@ export fn a() void { |
| 4 | }; | 4 | }; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // unreachable code - double break | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:9: error: unreachable code | 11 | // tmp.zig:3:9: error: unreachable code |
| 10 | // tmp.zig:3:20: note: control flow is diverted here | 12 | // tmp.zig:3:20: note: control flow is diverted here |
test/compile_errors/stage1/obj/unreachable_code-nested_returns.zig+3-1| ... | @@ -2,7 +2,9 @@ export fn a() i32 { | ... | @@ -2,7 +2,9 @@ export fn a() i32 { |
| 2 | return return 1; | 2 | return return 1; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // unreachable code - nested returns | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: unreachable code | 9 | // tmp.zig:2:5: error: unreachable code |
| 8 | // tmp.zig:2:12: note: control flow is diverted here | 10 | // tmp.zig:2:12: note: control flow is diverted here |
test/compile_errors/stage1/obj/unreachable_code.zig+3-1| ... | @@ -5,7 +5,9 @@ export fn a() void { | ... | @@ -5,7 +5,9 @@ export fn a() void { |
| 5 | 5 | ||
| 6 | fn b() void {} | 6 | fn b() void {} |
| 7 | 7 | ||
| 8 | // unreachable code | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:3:6: error: unreachable code | 12 | // tmp.zig:3:6: error: unreachable code |
| 11 | // tmp.zig:2:5: note: control flow is diverted here | 13 | // tmp.zig:2:5: note: control flow is diverted here |
test/compile_errors/stage1/obj/unreachable_executed_at_comptime.zig+3-1| ... | @@ -8,7 +8,9 @@ export fn entry() void { | ... | @@ -8,7 +8,9 @@ export fn entry() void { |
| 8 | _ = foo(-42); | 8 | _ = foo(-42); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // unreachable executed at comptime | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 12 | // | 14 | // |
| 13 | // tmp.zig:4:9: error: reached unreachable code | 15 | // tmp.zig:4:9: error: reached unreachable code |
| 14 | // tmp.zig:8:12: note: called from here | 16 | // tmp.zig:8:12: note: called from here |
test/compile_errors/stage1/obj/unreachable_parameter.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn f(a: noreturn) void { _ = a; } | 1 | fn f(a: noreturn) void { _ = a; } |
| 2 | export fn entry() void { f(); } | 2 | export fn entry() void { f(); } |
| 3 | 3 | ||
| 4 | // unreachable parameter | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:9: error: parameter of type 'noreturn' not allowed | 8 | // tmp.zig:1:9: error: parameter of type 'noreturn' not allowed |
test/compile_errors/stage1/obj/unreachable_variable.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn f() void { | ... | @@ -3,6 +3,8 @@ export fn f() void { |
| 3 | _ = a; | 3 | _ = a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // unreachable variable | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:25: error: expected type 'noreturn', found 'void' | 10 | // tmp.zig:2:25: error: expected type 'noreturn', found 'void' |
test/compile_errors/stage1/obj/unreachable_with_return.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn a() noreturn {return;} | 1 | fn a() noreturn {return;} |
| 2 | export fn entry() void { a(); } | 2 | export fn entry() void { a(); } |
| 3 | 3 | ||
| 4 | // unreachable with return | 4 | // error |
| 5 | // backend=stage1 | ||
| 6 | // target=native | ||
| 5 | // | 7 | // |
| 6 | // tmp.zig:1:18: error: expected type 'noreturn', found 'void' | 8 | // tmp.zig:1:18: error: expected type 'noreturn', found 'void' |
test/compile_errors/stage1/obj/unsupported_modifier_at_start_of_asm_output_constraint.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | asm volatile ("" : [baz]"+r"(bar) : : ""); | 3 | asm volatile ("" : [baz]"+r"(bar) : : ""); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // unsupported modifier at start of asm output constraint | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:5: error: invalid modifier starting output constraint for 'baz': '+', only '=' is supported. Compiler TODO: see https://github.com/ziglang/zig/issues/215 | 10 | // tmp.zig:3:5: error: invalid modifier starting output constraint for 'baz': '+', only '=' is supported. Compiler TODO: see https://github.com/ziglang/zig/issues/215 |
test/compile_errors/stage1/obj/unused_variable_error_on_errdefer.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | foo() catch unreachable; | 6 | foo() catch unreachable; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // unused variable error on errdefer | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:2:15: error: unused variable: 'a' | 13 | // tmp.zig:2:15: error: unused variable: 'a' |
test/compile_errors/stage1/obj/use_anyopaque_as_return_type_of_fn_ptr.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = a; | 3 | _ = a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // use anyopaque as return type of fn ptr | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:20: error: return type cannot be opaque | 10 | // tmp.zig:2:20: error: return type cannot be opaque |
test/compile_errors/stage1/obj/use_implicit_casts_to_assign_null_to_non-nullable_pointer.zig+3-1| ... | @@ -7,6 +7,8 @@ export fn entry() void { | ... | @@ -7,6 +7,8 @@ export fn entry() void { |
| 7 | _ = y; | 7 | _ = y; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // use implicit casts to assign null to non-nullable pointer | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:4:23: error: expected type '*?*i32', found '**i32' | 14 | // tmp.zig:4:23: error: expected type '*?*i32', found '**i32' |
test/compile_errors/stage1/obj/use_invalid_number_literal_as_array_index.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | _ = arr; | 4 | _ = arr; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // use invalid number literal as array index | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:1:1: error: unable to infer variable type | 11 | // tmp.zig:1:1: error: unable to infer variable type |
test/compile_errors/stage1/obj/use_of_comptime-known_undefined_function_value.zig+3-1| ... | @@ -6,6 +6,8 @@ export fn entry() void { | ... | @@ -6,6 +6,8 @@ export fn entry() void { |
| 6 | command.exec(); | 6 | command.exec(); |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // use of comptime-known undefined function value | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:6:12: error: use of undefined value here causes undefined behavior | 13 | // tmp.zig:6:12: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/use_of_undeclared_identifier.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn f() void { | ... | @@ -2,6 +2,8 @@ export fn f() void { |
| 2 | b = 3; | 2 | b = 3; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // use of undeclared identifier | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: use of undeclared identifier 'b' | 9 | // tmp.zig:2:5: error: use of undeclared identifier 'b' |
test/compile_errors/stage1/obj/using_an_unknown_len_ptr_type_instead_of_array.zig+3-1| ... | @@ -6,6 +6,8 @@ comptime { | ... | @@ -6,6 +6,8 @@ comptime { |
| 6 | _ = resolutions; | 6 | _ = resolutions; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // using an unknown len ptr type instead of array | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 10 | // | 12 | // |
| 11 | // tmp.zig:1:21: error: expected array type or [_], found '[*][*]const u8' | 13 | // tmp.zig:1:21: error: expected array type or [_], found '[*][*]const u8' |
test/compile_errors/stage1/obj/using_invalid_types_in_function_call_raises_an_error.zig+3-1| ... | @@ -4,6 +4,8 @@ export fn entry() void { | ... | @@ -4,6 +4,8 @@ export fn entry() void { |
| 4 | func(MenuEffect.ThisDoesNotExist); | 4 | func(MenuEffect.ThisDoesNotExist); |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // using invalid types in function call raises an error | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:1:20: error: enum declarations must have at least one tag | 11 | // tmp.zig:1:20: error: enum declarations must have at least one tag |
test/compile_errors/stage1/obj/usingnamespace_with_wrong_type.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | usingnamespace void; | 1 | usingnamespace void; |
| 2 | 2 | ||
| 3 | // usingnamespace with wrong type | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // tmp.zig:1:1: error: expected struct, enum, or union; found 'void' | 7 | // tmp.zig:1:1: error: expected struct, enum, or union; found 'void' |
test/compile_errors/stage1/obj/variable_has_wrong_type.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn f() i32 { | ... | @@ -3,6 +3,8 @@ export fn f() i32 { |
| 3 | return a; | 3 | return a; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // variable has wrong type | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:12: error: expected type 'i32', found '*const [1:0]u8' | 10 | // tmp.zig:3:12: error: expected type 'i32', found '*const [1:0]u8' |
test/compile_errors/stage1/obj/variable_in_inline_assembly_template_cannot_be_found.zig created+12| ... | @@ -0,0 +1,12 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | var sp = asm volatile ("mov %[foo], sp" | ||
| 3 | : [bar] "=r" (-> usize), | ||
| 4 | ); | ||
| 5 | _ = sp; | ||
| 6 | } | ||
| 7 | |||
| 8 | // error | ||
| 9 | // backend=stage1 | ||
| 10 | // target=x86_64-linux-gnu | ||
| 11 | // | ||
| 12 | // tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs | ||
test/compile_errors/stage1/obj/variable_initialization_compile_error_then_referenced.zig+3-1| ... | @@ -12,6 +12,8 @@ export fn entry() void { | ... | @@ -12,6 +12,8 @@ export fn entry() void { |
| 12 | _ = S; | 12 | _ = S; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | // variable initialization compile error then referenced | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 16 | // | 18 | // |
| 17 | // tmp.zig:2:12: error: use of undeclared identifier 'T' | 19 | // tmp.zig:2:12: error: use of undeclared identifier 'T' |
test/compile_errors/stage1/obj/variable_with_type_noreturn.zig+3-1| ... | @@ -2,7 +2,9 @@ export fn entry9() void { | ... | @@ -2,7 +2,9 @@ export fn entry9() void { |
| 2 | var z: noreturn = return; | 2 | var z: noreturn = return; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // variable with type 'noreturn' | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:5: error: unreachable code | 9 | // tmp.zig:2:5: error: unreachable code |
| 8 | // tmp.zig:2:23: note: control flow is diverted here | 10 | // tmp.zig:2:23: note: control flow is diverted here |
test/compile_errors/stage1/obj/vector_index_out_of_bounds.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // vector index out of bounds | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:62: error: index 3 outside vector of size 3 | 10 | // tmp.zig:2:62: error: index 3 outside vector of size 3 |
test/compile_errors/stage1/obj/volatile_on_global_assembly.zig+3-1| ... | @@ -2,6 +2,8 @@ comptime { | ... | @@ -2,6 +2,8 @@ comptime { |
| 2 | asm volatile (""); | 2 | asm volatile (""); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // volatile on global assembly | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:9: error: volatile is meaningless on global assembly | 9 | // tmp.zig:2:9: error: volatile is meaningless on global assembly |
test/compile_errors/stage1/obj/wasmMemoryGrow_is_a_compile_error_in_non-Wasm_targets.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | return; | 3 | return; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // wasmMemoryGrow is a compile error in non-Wasm targets | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:9: error: @wasmMemoryGrow is a wasm32 feature only | 10 | // tmp.zig:2:9: error: @wasmMemoryGrow is a wasm32 feature only |
test/compile_errors/stage1/obj/wasmMemorySize_is_a_compile_error_in_non-Wasm_targets.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | return; | 3 | return; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // wasmMemorySize is a compile error in non-Wasm targets | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:9: error: @wasmMemorySize is a wasm32 feature only | 10 | // tmp.zig:2:9: error: @wasmMemorySize is a wasm32 feature only |
test/compile_errors/stage1/obj/while_expected_bool_got_error_union.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | } | 3 | } |
| 4 | fn bar() anyerror!i32 { return 1; } | 4 | fn bar() anyerror!i32 { return 1; } |
| 5 | 5 | ||
| 6 | // while expected bool, got error union | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: expected type 'bool', found 'anyerror!i32' | 10 | // tmp.zig:2:15: error: expected type 'bool', found 'anyerror!i32' |
test/compile_errors/stage1/obj/while_expected_bool_got_optional.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | } | 3 | } |
| 4 | fn bar() ?i32 { return 1; } | 4 | fn bar() ?i32 { return 1; } |
| 5 | 5 | ||
| 6 | // while expected bool, got optional | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: expected type 'bool', found '?i32' | 10 | // tmp.zig:2:15: error: expected type 'bool', found '?i32' |
test/compile_errors/stage1/obj/while_expected_error_union_got_bool.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | } | 3 | } |
| 4 | fn bar() bool { return true; } | 4 | fn bar() bool { return true; } |
| 5 | 5 | ||
| 6 | // while expected error union, got bool | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: expected error union type, found 'bool' | 10 | // tmp.zig:2:15: error: expected error union type, found 'bool' |
test/compile_errors/stage1/obj/while_expected_error_union_got_optional.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | } | 3 | } |
| 4 | fn bar() ?i32 { return 1; } | 4 | fn bar() ?i32 { return 1; } |
| 5 | 5 | ||
| 6 | // while expected error union, got optional | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: expected error union type, found '?i32' | 10 | // tmp.zig:2:15: error: expected error union type, found '?i32' |
test/compile_errors/stage1/obj/while_expected_optional_got_bool.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | } | 3 | } |
| 4 | fn bar() bool { return true; } | 4 | fn bar() bool { return true; } |
| 5 | 5 | ||
| 6 | // while expected optional, got bool | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: expected optional type, found 'bool' | 10 | // tmp.zig:2:15: error: expected optional type, found 'bool' |
test/compile_errors/stage1/obj/while_expected_optional_got_error_union.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn foo() void { | ... | @@ -3,6 +3,8 @@ export fn foo() void { |
| 3 | } | 3 | } |
| 4 | fn bar() anyerror!i32 { return 1; } | 4 | fn bar() anyerror!i32 { return 1; } |
| 5 | 5 | ||
| 6 | // while expected optional, got error union | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:15: error: expected optional type, found 'anyerror!i32' | 10 | // tmp.zig:2:15: error: expected optional type, found 'anyerror!i32' |
test/compile_errors/stage1/obj/while_loop_body_expression_ignored.zig+3-1| ... | @@ -13,7 +13,9 @@ export fn f3() void { | ... | @@ -13,7 +13,9 @@ export fn f3() void { |
| 13 | while (x) |_| returns() else |_| unreachable; | 13 | while (x) |_| returns() else |_| unreachable; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // while loop body expression ignored | 16 | // error |
| 17 | // backend=stage1 | ||
| 18 | // target=native | ||
| 17 | // | 19 | // |
| 18 | // tmp.zig:5:25: error: expression value is ignored | 20 | // tmp.zig:5:25: error: expression value is ignored |
| 19 | // tmp.zig:9:26: error: expression value is ignored | 21 | // tmp.zig:9:26: error: expression value is ignored |
test/compile_errors/stage1/obj/write_to_const_global_variable.zig+3-1| ... | @@ -4,6 +4,8 @@ fn f() void { | ... | @@ -4,6 +4,8 @@ fn f() void { |
| 4 | } | 4 | } |
| 5 | export fn entry() void { f(); } | 5 | export fn entry() void { f(); } |
| 6 | 6 | ||
| 7 | // write to const global variable | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:3:9: error: cannot assign to constant | 11 | // tmp.zig:3:9: error: cannot assign to constant |
test/compile_errors/stage1/obj/wrong_frame_type_used_for_async_call.zig+3-1| ... | @@ -9,6 +9,8 @@ fn bar() void { | ... | @@ -9,6 +9,8 @@ fn bar() void { |
| 9 | suspend {} | 9 | suspend {} |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // wrong frame type used for async call | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:3:13: error: expected type '*@Frame(bar)', found '*@Frame(foo)' | 16 | // tmp.zig:3:13: error: expected type '*@Frame(bar)', found '*@Frame(foo)' |
test/compile_errors/stage1/obj/wrong_function_type.zig+3-1| ... | @@ -4,6 +4,8 @@ fn b() i32 {return 1;} | ... | @@ -4,6 +4,8 @@ fn b() i32 {return 1;} |
| 4 | fn c() i32 {return 2;} | 4 | fn c() i32 {return 2;} |
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(fns)); } | 5 | export fn entry() usize { return @sizeOf(@TypeOf(fns)); } |
| 6 | 6 | ||
| 7 | // wrong function type | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // tmp.zig:1:28: error: expected type 'fn() void', found 'fn() i32' | 11 | // tmp.zig:1:28: error: expected type 'fn() void', found 'fn() i32' |
test/compile_errors/stage1/obj/wrong_initializer_for_union_payload_of_type_type.zig+3-1| ... | @@ -9,6 +9,8 @@ export fn entry() void { | ... | @@ -9,6 +9,8 @@ export fn entry() void { |
| 9 | v.u.A = U{ .A = i32 }; | 9 | v.u.A = U{ .A = i32 }; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // wrong initializer for union payload of type 'type' | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:9:8: error: use of undefined value here causes undefined behavior | 16 | // tmp.zig:9:8: error: use of undefined value here causes undefined behavior |
test/compile_errors/stage1/obj/wrong_number_of_arguments.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn a() void { | ... | @@ -3,6 +3,8 @@ export fn a() void { |
| 3 | } | 3 | } |
| 4 | fn c(d: i32, e: i32, f: i32) void { _ = d; _ = e; _ = f; } | 4 | fn c(d: i32, e: i32, f: i32) void { _ = d; _ = e; _ = f; } |
| 5 | 5 | ||
| 6 | // wrong number of arguments | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:6: error: expected 3 argument(s), found 1 | 10 | // tmp.zig:2:6: error: expected 3 argument(s), found 1 |
test/compile_errors/stage1/obj/wrong_number_of_arguments_for_method_fn_call.zig+3-1| ... | @@ -7,6 +7,8 @@ fn f(foo: *const Foo) void { | ... | @@ -7,6 +7,8 @@ fn f(foo: *const Foo) void { |
| 7 | } | 7 | } |
| 8 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 8 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } |
| 9 | 9 | ||
| 10 | // wrong number of arguments for method fn call | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:6:15: error: expected 2 argument(s), found 3 | 14 | // tmp.zig:6:15: error: expected 2 argument(s), found 3 |
test/compile_errors/stage1/obj/wrong_panic_signature_generic_function.zig+3-1| ... | @@ -4,7 +4,9 @@ pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace) | ... | @@ -4,7 +4,9 @@ pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace) |
| 4 | } | 4 | } |
| 5 | const builtin = @import("std").builtin; | 5 | const builtin = @import("std").builtin; |
| 6 | 6 | ||
| 7 | // wrong panic signature, generic function | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 8 | // | 10 | // |
| 9 | // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype' | 11 | // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype' |
| 10 | // note: only one of the functions is generic | 12 | // note: only one of the functions is generic |
test/compile_errors/stage1/obj/wrong_panic_signature_runtime_function.zig+3-1| ... | @@ -3,6 +3,8 @@ test "" {} | ... | @@ -3,6 +3,8 @@ test "" {} |
| 3 | pub fn panic() void {} | 3 | pub fn panic() void {} |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | // wrong panic signature, runtime function | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn() void' | 10 | // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn() void' |
test/compile_errors/stage1/obj/wrong_pointer_coerced_to_pointer_to_opaque_{}.zig+3-1| ... | @@ -5,6 +5,8 @@ export fn foo() void { | ... | @@ -5,6 +5,8 @@ export fn foo() void { |
| 5 | bar(@ptrCast(*anyopaque, &x)); | 5 | bar(@ptrCast(*anyopaque, &x)); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // wrong pointer coerced to pointer to opaque {} | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 9 | // | 11 | // |
| 10 | // tmp.zig:5:9: error: expected type '*Derp', found '*anyopaque' | 12 | // tmp.zig:5:9: error: expected type '*Derp', found '*anyopaque' |
test/compile_errors/stage1/obj/wrong_return_type_for_main.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | pub fn main() f32 { } | 1 | pub fn main() f32 { } |
| 2 | 2 | ||
| 3 | // wrong return type for main | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 4 | // | 6 | // |
| 5 | // error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8' | 7 | // error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8' |
test/compile_errors/stage1/obj/wrong_size_to_an_array_literal.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | _ = array; | 3 | _ = array; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // wrong size to an array literal | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:2:31: error: index 2 outside array of size 2 | 10 | // tmp.zig:2:31: error: index 2 outside array of size 2 |
test/compile_errors/stage1/obj/wrong_type_for_argument_tuple_to_asyncCall.zig+3-1| ... | @@ -7,6 +7,8 @@ fn foo() i32 { | ... | @@ -7,6 +7,8 @@ fn foo() i32 { |
| 7 | return 0; | 7 | return 0; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // wrong type for argument tuple to @asyncCall | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 11 | // | 13 | // |
| 12 | // tmp.zig:3:33: error: expected tuple or struct, found 'void' | 14 | // tmp.zig:3:33: error: expected tuple or struct, found 'void' |
test/compile_errors/stage1/obj/wrong_type_for_reify_type.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() void { | ... | @@ -2,6 +2,8 @@ export fn entry() void { |
| 2 | _ = @Type(0); | 2 | _ = @Type(0); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // wrong type for @Type | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:15: error: expected type 'std.builtin.Type', found 'comptime_int' | 9 | // tmp.zig:2:15: error: expected type 'std.builtin.Type', found 'comptime_int' |
test/compile_errors/stage1/obj/wrong_type_for_result_ptr_to_asyncCall.zig+3-1| ... | @@ -9,6 +9,8 @@ fn foo() i32 { | ... | @@ -9,6 +9,8 @@ fn foo() i32 { |
| 9 | return 1234; | 9 | return 1234; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // wrong type for result ptr to @asyncCall | 12 | // error |
| 13 | // backend=stage1 | ||
| 14 | // target=native | ||
| 13 | // | 15 | // |
| 14 | // tmp.zig:6:37: error: expected type '*i32', found 'bool' | 16 | // tmp.zig:6:37: error: expected type '*i32', found 'bool' |
test/compile_errors/stage1/obj/wrong_type_passed_to_panic.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | @panic(e); | 3 | @panic(e); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // wrong type passed to @panic | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:12: error: expected type '[]const u8', found 'error{Foo}' | 10 | // tmp.zig:3:12: error: expected type '[]const u8', found 'error{Foo}' |
test/compile_errors/stage1/obj/wrong_type_to_hasField.zig+3-1| ... | @@ -2,6 +2,8 @@ export fn entry() bool { | ... | @@ -2,6 +2,8 @@ export fn entry() bool { |
| 2 | return @hasField(i32, "hi"); | 2 | return @hasField(i32, "hi"); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // wrong type to @hasField | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 6 | // | 8 | // |
| 7 | // tmp.zig:2:22: error: type 'i32' does not support @hasField | 9 | // tmp.zig:2:22: error: type 'i32' does not support @hasField |
test/compile_errors/stage1/obj/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig+3-1| ... | @@ -3,6 +3,8 @@ export fn entry() void { | ... | @@ -3,6 +3,8 @@ export fn entry() void { |
| 3 | while (!@cmpxchgWeak(i32, &x, 1234, 5678, @as(u32, 1234), @as(u32, 1234))) {} | 3 | while (!@cmpxchgWeak(i32, &x, 1234, 5678, @as(u32, 1234), @as(u32, 1234))) {} |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // wrong types given to atomic order args in cmpxchg | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:47: error: expected type 'std.builtin.AtomicOrder', found 'u32' | 10 | // tmp.zig:3:47: error: expected type 'std.builtin.AtomicOrder', found 'u32' |
test/compile_errors/stage1/obj/wrong_types_given_to_export.zig+3-1| ... | @@ -3,6 +3,8 @@ comptime { | ... | @@ -3,6 +3,8 @@ comptime { |
| 3 | @export(entry, .{.name = "entry", .linkage = @as(u32, 1234) }); | 3 | @export(entry, .{.name = "entry", .linkage = @as(u32, 1234) }); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // wrong types given to @export | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 7 | // | 9 | // |
| 8 | // tmp.zig:3:59: error: expected type 'std.builtin.GlobalLinkage', found 'comptime_int' | 10 | // tmp.zig:3:59: error: expected type 'std.builtin.GlobalLinkage', found 'comptime_int' |
test/compile_errors/stage1/test/access_invalid_typeInfo_decl.zig+4-1| ... | @@ -3,6 +3,9 @@ test "Crash" { | ... | @@ -3,6 +3,9 @@ test "Crash" { |
| 3 | _ = @typeInfo(@This()).Struct.decls[0]; | 3 | _ = @typeInfo(@This()).Struct.decls[0]; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // access invalid @typeInfo decl | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 9 | // is_test=1 | ||
| 7 | // | 10 | // |
| 8 | // tmp.zig:1:11: error: use of undeclared identifier 'B' | 11 | // tmp.zig:1:11: error: use of undeclared identifier 'B' |
test/compile_errors/stage1/test/alignCast_of_zero_sized_types.zig+4-1| ... | @@ -17,7 +17,10 @@ export fn qux() void { | ... | @@ -17,7 +17,10 @@ export fn qux() void { |
| 17 | _ = @alignCast(2, a); | 17 | _ = @alignCast(2, a); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | // @alignCast of zero sized types | 20 | // error |
| 21 | // backend=stage1 | ||
| 22 | // target=native | ||
| 23 | // is_test=1 | ||
| 21 | // | 24 | // |
| 22 | // tmp.zig:3:23: error: cannot adjust alignment of zero sized type '*void' | 25 | // tmp.zig:3:23: error: cannot adjust alignment of zero sized type '*void' |
| 23 | // tmp.zig:7:23: error: cannot adjust alignment of zero sized type '?*void' | 26 | // tmp.zig:7:23: error: cannot adjust alignment of zero sized type '?*void' |
test/compile_errors/stage1/test/bad_splat_type.zig+4-1| ... | @@ -4,6 +4,9 @@ export fn entry() void { | ... | @@ -4,6 +4,9 @@ export fn entry() void { |
| 4 | _ = v; | 4 | _ = v; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // bad @splat type | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 10 | // is_test=1 | ||
| 8 | // | 11 | // |
| 9 | // tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; 'comptime_int' is invalid | 12 | // tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; 'comptime_int' is invalid |
test/compile_errors/stage1/test/binary_OR_operator_on_error_sets.zig+4-1| ... | @@ -5,6 +5,9 @@ export fn entry() void { | ... | @@ -5,6 +5,9 @@ export fn entry() void { |
| 5 | _ = x; | 5 | _ = x; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // binary OR operator on error sets | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 11 | // is_test=1 | ||
| 9 | // | 12 | // |
| 10 | // tmp.zig:2:18: error: invalid operands to binary expression: 'error{A}' and 'error{B}' | 13 | // tmp.zig:2:18: error: invalid operands to binary expression: 'error{A}' and 'error{B}' |
test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-always_inline.zig+4-1| ... | @@ -3,6 +3,9 @@ pub export fn entry() void { | ... | @@ -3,6 +3,9 @@ pub export fn entry() void { |
| 3 | @call(.{ .modifier = .always_inline }, call_me, .{}); | 3 | @call(.{ .modifier = .always_inline }, call_me, .{}); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @call rejects non comptime-known fn - always_inline | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 9 | // is_test=1 | ||
| 7 | // | 10 | // |
| 8 | // tmp.zig:3:5: error: the specified modifier requires a comptime-known function | 11 | // tmp.zig:3:5: error: the specified modifier requires a comptime-known function |
test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-compile_time.zig+4-1| ... | @@ -3,6 +3,9 @@ pub export fn entry() void { | ... | @@ -3,6 +3,9 @@ pub export fn entry() void { |
| 3 | @call(.{ .modifier = .compile_time }, call_me, .{}); | 3 | @call(.{ .modifier = .compile_time }, call_me, .{}); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @call rejects non comptime-known fn - compile_time | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 9 | // is_test=1 | ||
| 7 | // | 10 | // |
| 8 | // tmp.zig:3:5: error: the specified modifier requires a comptime-known function | 11 | // tmp.zig:3:5: error: the specified modifier requires a comptime-known function |
test/compile_errors/stage1/test/cast_between_optional_T_where_T_is_not_a_pointer.zig+4-1| ... | @@ -6,7 +6,10 @@ export fn entry() void { | ... | @@ -6,7 +6,10 @@ export fn entry() void { |
| 6 | a = b; | 6 | a = b; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // cast between ?T where T is not a pointer | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 12 | // is_test=1 | ||
| 10 | // | 13 | // |
| 11 | // tmp.zig:6:9: error: expected type '?fn(i8) void', found '?fn(u64) void' | 14 | // tmp.zig:6:9: error: expected type '?fn(i8) void', found '?fn(u64) void' |
| 12 | // tmp.zig:6:9: note: optional type child 'fn(u64) void' cannot cast into optional type child 'fn(i8) void' | 15 | // tmp.zig:6:9: note: optional type child 'fn(u64) void' cannot cast into optional type child 'fn(i8) void' |
test/compile_errors/stage1/test/combination_of_nosuspend_and_async.zig+4-1| ... | @@ -7,7 +7,10 @@ export fn entry() void { | ... | @@ -7,7 +7,10 @@ export fn entry() void { |
| 7 | } | 7 | } |
| 8 | fn foo() void {} | 8 | fn foo() void {} |
| 9 | 9 | ||
| 10 | // combination of nosuspend and async | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 13 | // is_test=1 | ||
| 11 | // | 14 | // |
| 12 | // tmp.zig:4:9: error: suspend inside nosuspend block | 15 | // tmp.zig:4:9: error: suspend inside nosuspend block |
| 13 | // tmp.zig:2:5: note: nosuspend block here | 16 | // tmp.zig:2:5: note: nosuspend block here |
test/compile_errors/stage1/test/comparison_of_non-tagged_union_and_enum_literal.zig+4-1| ... | @@ -5,7 +5,10 @@ export fn entry() void { | ... | @@ -5,7 +5,10 @@ export fn entry() void { |
| 5 | _ = ok; | 5 | _ = ok; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // comparison of non-tagged union and enum literal | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 11 | // is_test=1 | ||
| 9 | // | 12 | // |
| 10 | // tmp.zig:4:16: error: comparison of union and enum literal is only valid for tagged union types | 13 | // tmp.zig:4:16: error: comparison of union and enum literal is only valid for tagged union types |
| 11 | // tmp.zig:2:15: note: type U is not a tagged union | 14 | // tmp.zig:2:15: note: type U is not a tagged union |
test/compile_errors/stage1/test/comptime_vector_overflow_shows_the_index.zig+4-1| ... | @@ -5,7 +5,10 @@ comptime { | ... | @@ -5,7 +5,10 @@ comptime { |
| 5 | _ = x; | 5 | _ = x; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // comptime vector overflow shows the index | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 11 | // is_test=1 | ||
| 9 | // | 12 | // |
| 10 | // tmp.zig:4:15: error: operation caused overflow | 13 | // tmp.zig:4:15: error: operation caused overflow |
| 11 | // tmp.zig:4:15: note: when computing vector element at index 2 | 14 | // tmp.zig:4:15: note: when computing vector element at index 2 |
test/compile_errors/stage1/test/duplicate_field_in_anonymous_struct_literal.zig+4-1| ... | @@ -10,7 +10,10 @@ export fn entry() void { | ... | @@ -10,7 +10,10 @@ export fn entry() void { |
| 10 | _ = anon; | 10 | _ = anon; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // duplicate field in anonymous struct literal | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 16 | // is_test=1 | ||
| 14 | // | 17 | // |
| 15 | // tmp.zig:7:13: error: duplicate field | 18 | // tmp.zig:7:13: error: duplicate field |
| 16 | // tmp.zig:4:13: note: other field here | 19 | // tmp.zig:4:13: note: other field here |
test/compile_errors/stage1/test/error_in_struct_initializer_doesnt_crash_the_compiler.zig+4-1| ... | @@ -7,6 +7,9 @@ pub export fn entry() void { | ... | @@ -7,6 +7,9 @@ pub export fn entry() void { |
| 7 | _ = a; | 7 | _ = a; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // error in struct initializer doesn't crash the compiler | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 13 | // is_test=1 | ||
| 11 | // | 14 | // |
| 12 | // tmp.zig:4:9: error: duplicate struct field: 'e' | 15 | // tmp.zig:4:9: error: duplicate struct field: 'e' |
test/compile_errors/stage1/test/errors_in_for_loop_bodies_are_propagated.zig+4-1| ... | @@ -3,6 +3,9 @@ pub export fn entry() void { | ... | @@ -3,6 +3,9 @@ pub export fn entry() void { |
| 3 | for (arr) |bits| _ = @popCount(bits); | 3 | for (arr) |bits| _ = @popCount(bits); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // errors in for loop bodies are propagated | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 9 | // is_test=1 | ||
| 7 | // | 10 | // |
| 8 | // tmp.zig:3:26: error: expected 2 arguments, found 1 | 11 | // tmp.zig:3:26: error: expected 2 arguments, found 1 |
test/compile_errors/stage1/test/export_with_empty_name_string.zig+4-1| ... | @@ -3,6 +3,9 @@ comptime { | ... | @@ -3,6 +3,9 @@ comptime { |
| 3 | @export(entry, .{ .name = "" }); | 3 | @export(entry, .{ .name = "" }); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @export with empty name string | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 9 | // is_test=1 | ||
| 7 | // | 10 | // |
| 8 | // tmp.zig:3:5: error: exported symbol name cannot be empty | 11 | // tmp.zig:3:5: error: exported symbol name cannot be empty |
test/compile_errors/stage1/test/helpful_return_type_error_message.zig+4-1| ... | @@ -15,7 +15,10 @@ export fn quux() u32 { | ... | @@ -15,7 +15,10 @@ export fn quux() u32 { |
| 15 | buf = bar(); | 15 | buf = bar(); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | // helpful return type error message | 18 | // error |
| 19 | // backend=stage1 | ||
| 20 | // target=native | ||
| 21 | // is_test=1 | ||
| 19 | // | 22 | // |
| 20 | // tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}' | 23 | // tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}' |
| 21 | // tmp.zig:1:17: note: function cannot return an error | 24 | // tmp.zig:1:17: note: function cannot return an error |
test/compile_errors/stage1/test/int-float_conversion_to_comptime_int-float.zig+4-1| ... | @@ -7,7 +7,10 @@ export fn bar() void { | ... | @@ -7,7 +7,10 @@ export fn bar() void { |
| 7 | _ = @intToFloat(comptime_float, a); | 7 | _ = @intToFloat(comptime_float, a); |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // int/float conversion to comptime_int/float | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 13 | // is_test=1 | ||
| 11 | // | 14 | // |
| 12 | // tmp.zig:3:35: error: unable to evaluate constant expression | 15 | // tmp.zig:3:35: error: unable to evaluate constant expression |
| 13 | // tmp.zig:7:37: error: unable to evaluate constant expression | 16 | // tmp.zig:7:37: error: unable to evaluate constant expression |
test/compile_errors/stage1/test/invalid_assignments.zig+4-1| ... | @@ -10,7 +10,10 @@ export fn entry4() void { | ... | @@ -10,7 +10,10 @@ export fn entry4() void { |
| 10 | 2 + 2 = 3; | 10 | 2 + 2 = 3; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // invalid assignments | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 16 | // is_test=1 | ||
| 14 | // | 17 | // |
| 15 | // tmp.zig:3:6: error: invalid left-hand side to assignment | 18 | // tmp.zig:3:6: error: invalid left-hand side to assignment |
| 16 | // tmp.zig:7:7: error: invalid left-hand side to assignment | 19 | // tmp.zig:7:7: error: invalid left-hand side to assignment |
test/compile_errors/stage1/test/invalid_float_casts.zig+4-1| ... | @@ -15,7 +15,10 @@ export fn qux() void { | ... | @@ -15,7 +15,10 @@ export fn qux() void { |
| 15 | _ = @floatCast(f32, a); | 15 | _ = @floatCast(f32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | // invalid float casts | 18 | // error |
| 19 | // backend=stage1 | ||
| 20 | // target=native | ||
| 21 | // is_test=1 | ||
| 19 | // | 22 | // |
| 20 | // tmp.zig:3:36: error: unable to evaluate constant expression | 23 | // tmp.zig:3:36: error: unable to evaluate constant expression |
| 21 | // tmp.zig:7:21: error: expected integer type, found 'f32' | 24 | // tmp.zig:7:21: error: expected integer type, found 'f32' |
test/compile_errors/stage1/test/invalid_int_casts.zig+4-1| ... | @@ -15,7 +15,10 @@ export fn qux() void { | ... | @@ -15,7 +15,10 @@ export fn qux() void { |
| 15 | _ = @intCast(u32, a); | 15 | _ = @intCast(u32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | // invalid int casts | 18 | // error |
| 19 | // backend=stage1 | ||
| 20 | // target=native | ||
| 21 | // is_test=1 | ||
| 19 | // | 22 | // |
| 20 | // tmp.zig:3:32: error: unable to evaluate constant expression | 23 | // tmp.zig:3:32: error: unable to evaluate constant expression |
| 21 | // tmp.zig:7:21: error: expected float type, found 'u32' | 24 | // tmp.zig:7:21: error: expected float type, found 'u32' |
test/compile_errors/stage1/test/invalid_non-exhaustive_enum_to_union.zig+4-1| ... | @@ -18,7 +18,10 @@ export fn bar() void { | ... | @@ -18,7 +18,10 @@ export fn bar() void { |
| 18 | _ = u; | 18 | _ = u; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | // invalid non-exhaustive enum to union | 21 | // error |
| 22 | // backend=stage1 | ||
| 23 | // target=native | ||
| 24 | // is_test=1 | ||
| 22 | // | 25 | // |
| 23 | // tmp.zig:12:16: error: runtime cast to union 'U' from non-exhaustive enum | 26 | // tmp.zig:12:16: error: runtime cast to union 'U' from non-exhaustive enum |
| 24 | // tmp.zig:17:16: error: no tag by value 15 | 27 | // tmp.zig:17:16: error: no tag by value 15 |
test/compile_errors/stage1/test/invalid_pointer_with_reify_type.zig+4-1| ... | @@ -11,6 +11,9 @@ export fn entry() void { | ... | @@ -11,6 +11,9 @@ export fn entry() void { |
| 11 | }}); | 11 | }}); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // invalid pointer with @Type | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 17 | // is_test=1 | ||
| 15 | // | 18 | // |
| 16 | // tmp.zig:2:16: error: sentinels are only allowed on slices and unknown-length pointers | 19 | // tmp.zig:2:16: error: sentinels are only allowed on slices and unknown-length pointers |
test/compile_errors/stage1/test/nested_vectors.zig+4-1| ... | @@ -5,6 +5,9 @@ export fn entry() void { | ... | @@ -5,6 +5,9 @@ export fn entry() void { |
| 5 | _ = v; | 5 | _ = v; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // nested vectors | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 11 | // is_test=1 | ||
| 9 | // | 12 | // |
| 10 | // tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid | 13 | // tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid |
test/compile_errors/stage1/test/non-exhaustive_enum_marker_assigned_a_value.zig+4-1| ... | @@ -10,7 +10,10 @@ const B = enum { | ... | @@ -10,7 +10,10 @@ const B = enum { |
| 10 | }; | 10 | }; |
| 11 | comptime { _ = A; _ = B; } | 11 | comptime { _ = A; _ = B; } |
| 12 | 12 | ||
| 13 | // non-exhaustive enum marker assigned a value | 13 | // error |
| 14 | // backend=stage1 | ||
| 15 | // target=native | ||
| 16 | // is_test=1 | ||
| 14 | // | 17 | // |
| 15 | // tmp.zig:4:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value | 18 | // tmp.zig:4:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value |
| 16 | // tmp.zig:6:11: error: non-exhaustive enum missing integer tag type | 19 | // tmp.zig:6:11: error: non-exhaustive enum missing integer tag type |
test/compile_errors/stage1/test/non-exhaustive_enums.zig+4-1| ... | @@ -13,7 +13,10 @@ pub export fn entry() void { | ... | @@ -13,7 +13,10 @@ pub export fn entry() void { |
| 13 | _ = C; | 13 | _ = C; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // non-exhaustive enums | 16 | // error |
| 17 | // backend=stage1 | ||
| 18 | // target=native | ||
| 19 | // is_test=1 | ||
| 17 | // | 20 | // |
| 18 | // tmp.zig:3:5: error: '_' field of non-exhaustive enum must be last | 21 | // tmp.zig:3:5: error: '_' field of non-exhaustive enum must be last |
| 19 | // tmp.zig:6:11: error: non-exhaustive enum specifies every value | 22 | // tmp.zig:6:11: error: non-exhaustive enum specifies every value |
test/compile_errors/stage1/test/not_an_enum_type.zig+4-1| ... | @@ -12,6 +12,9 @@ const Error = union(enum) { | ... | @@ -12,6 +12,9 @@ const Error = union(enum) { |
| 12 | const InvalidToken = struct {}; | 12 | const InvalidToken = struct {}; |
| 13 | const ExpectedVarDeclOrFn = struct {}; | 13 | const ExpectedVarDeclOrFn = struct {}; |
| 14 | 14 | ||
| 15 | // not an enum type | 15 | // error |
| 16 | // backend=stage1 | ||
| 17 | // target=native | ||
| 18 | // is_test=1 | ||
| 16 | // | 19 | // |
| 17 | // tmp.zig:4:9: error: expected type '@typeInfo(Error).Union.tag_type.?', found 'type' | 20 | // tmp.zig:4:9: error: expected type '@typeInfo(Error).Union.tag_type.?', found 'type' |
test/compile_errors/stage1/test/packed_struct_with_fields_of_not_allowed_types.zig+4-1| ... | @@ -59,7 +59,10 @@ const Enum = enum { | ... | @@ -59,7 +59,10 @@ const Enum = enum { |
| 59 | B, | 59 | B, |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | // packed struct with fields of not allowed types | 62 | // error |
| 63 | // backend=stage1 | ||
| 64 | // target=native | ||
| 65 | // is_test=1 | ||
| 63 | // | 66 | // |
| 64 | // tmp.zig:2:5: error: type 'anyerror' not allowed in packed struct; no guaranteed in-memory representation | 67 | // tmp.zig:2:5: error: type 'anyerror' not allowed in packed struct; no guaranteed in-memory representation |
| 65 | // tmp.zig:5:5: error: array of 'u24' not allowed in packed struct due to padding bits (must be padded from 48 to 64 bits) | 68 | // tmp.zig:5:5: error: array of 'u24' not allowed in packed struct due to padding bits (must be padded from 48 to 64 bits) |
test/compile_errors/stage1/test/ptrToInt_with_pointer_to_zero-sized_type.zig+4-1| ... | @@ -4,6 +4,9 @@ export fn entry() void { | ... | @@ -4,6 +4,9 @@ export fn entry() void { |
| 4 | _ = x; | 4 | _ = x; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // @ptrToInt with pointer to zero-sized type | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 10 | // is_test=1 | ||
| 8 | // | 11 | // |
| 9 | // tmp.zig:3:23: error: pointer to size 0 type has no address | 12 | // tmp.zig:3:23: error: pointer to size 0 type has no address |
test/compile_errors/stage1/test/reassign_to_array_parameter.zig+4-1| ... | @@ -5,6 +5,9 @@ export fn entry() void { | ... | @@ -5,6 +5,9 @@ export fn entry() void { |
| 5 | reassign(.{1, 2, 3}); | 5 | reassign(.{1, 2, 3}); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // reassign to array parameter | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 11 | // is_test=1 | ||
| 9 | // | 12 | // |
| 10 | // tmp.zig:2:15: error: cannot assign to constant | 13 | // tmp.zig:2:15: error: cannot assign to constant |
test/compile_errors/stage1/test/reassign_to_slice_parameter.zig+4-1| ... | @@ -5,6 +5,9 @@ export fn entry() void { | ... | @@ -5,6 +5,9 @@ export fn entry() void { |
| 5 | reassign("foo"); | 5 | reassign("foo"); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // reassign to slice parameter | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 11 | // is_test=1 | ||
| 9 | // | 12 | // |
| 10 | // tmp.zig:2:10: error: cannot assign to constant | 13 | // tmp.zig:2:10: error: cannot assign to constant |
test/compile_errors/stage1/test/reassign_to_struct_parameter.zig+4-1| ... | @@ -8,6 +8,9 @@ export fn entry() void { | ... | @@ -8,6 +8,9 @@ export fn entry() void { |
| 8 | reassign(S{.x = 3}); | 8 | reassign(S{.x = 3}); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // reassign to struct parameter | 11 | // error |
| 12 | // backend=stage1 | ||
| 13 | // target=native | ||
| 14 | // is_test=1 | ||
| 12 | // | 15 | // |
| 13 | // tmp.zig:5:10: error: cannot assign to constant | 16 | // tmp.zig:5:10: error: cannot assign to constant |
test/compile_errors/stage1/test/reference_to_const_data.zig+4-1| ... | @@ -19,7 +19,10 @@ export fn qux() void { | ... | @@ -19,7 +19,10 @@ export fn qux() void { |
| 19 | ptr.x = 2; | 19 | ptr.x = 2; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | // reference to const data | 22 | // error |
| 23 | // backend=stage1 | ||
| 24 | // target=native | ||
| 25 | // is_test=1 | ||
| 23 | // | 26 | // |
| 24 | // tmp.zig:3:14: error: cannot assign to constant | 27 | // tmp.zig:3:14: error: cannot assign to constant |
| 25 | // tmp.zig:7:13: error: cannot assign to constant | 28 | // tmp.zig:7:13: error: cannot assign to constant |
test/compile_errors/stage1/test/reify_typeOf_with_incompatible_arguments.zig+4-1| ... | @@ -4,6 +4,9 @@ export fn entry() void { | ... | @@ -4,6 +4,9 @@ export fn entry() void { |
| 4 | _ = @TypeOf(var_1, var_2); | 4 | _ = @TypeOf(var_1, var_2); |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | // @TypeOf with incompatible arguments | 7 | // error |
| 8 | // backend=stage1 | ||
| 9 | // target=native | ||
| 10 | // is_test=1 | ||
| 8 | // | 11 | // |
| 9 | // tmp.zig:4:9: error: incompatible types: 'f32' and 'u32' | 12 | // tmp.zig:4:9: error: incompatible types: 'f32' and 'u32' |
test/compile_errors/stage1/test/reify_typeOf_with_no_arguments.zig+4-1| ... | @@ -2,6 +2,9 @@ export fn entry() void { | ... | @@ -2,6 +2,9 @@ export fn entry() void { |
| 2 | _ = @TypeOf(); | 2 | _ = @TypeOf(); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // @TypeOf with no arguments | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 8 | // is_test=1 | ||
| 6 | // | 9 | // |
| 7 | // tmp.zig:2:9: error: expected at least 1 argument, found 0 | 10 | // tmp.zig:2:9: error: expected at least 1 argument, found 0 |
test/compile_errors/stage1/test/reject_extern_function_definitions_with_body.zig+4-1| ... | @@ -2,6 +2,9 @@ extern "c" fn definitelyNotInLibC(a: i32, b: i32) i32 { | ... | @@ -2,6 +2,9 @@ extern "c" fn definitelyNotInLibC(a: i32, b: i32) i32 { |
| 2 | return a + b; | 2 | return a + b; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // reject extern function definitions with body | 5 | // error |
| 6 | // backend=stage1 | ||
| 7 | // target=native | ||
| 8 | // is_test=1 | ||
| 6 | // | 9 | // |
| 7 | // tmp.zig:1:1: error: extern functions have no body | 10 | // tmp.zig:1:1: error: extern functions have no body |
test/compile_errors/stage1/test/reject_extern_variables_with_initializers.zig+4-1| ... | @@ -1,5 +1,8 @@ | ... | @@ -1,5 +1,8 @@ |
| 1 | extern var foo: int = 2; | 1 | extern var foo: int = 2; |
| 2 | 2 | ||
| 3 | // reject extern variables with initializers | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 6 | // is_test=1 | ||
| 4 | // | 7 | // |
| 5 | // tmp.zig:1:23: error: extern variables have no initializers | 8 | // tmp.zig:1:23: error: extern variables have no initializers |
test/compile_errors/stage1/test/repeated_invalid_field_access_to_generic_function_returning_type_crashes_compiler_2655.zig+4-1| ... | @@ -6,6 +6,9 @@ test "1" { | ... | @@ -6,6 +6,9 @@ test "1" { |
| 6 | _ = A().a; | 6 | _ = A().a; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // repeated invalid field access to generic function returning type crashes compiler. #2655 | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 12 | // is_test=1 | ||
| 10 | // | 13 | // |
| 11 | // tmp.zig:2:12: error: use of undeclared identifier 'Q' | 14 | // tmp.zig:2:12: error: use of undeclared identifier 'Q' |
test/compile_errors/stage1/test/return_invalid_type_from_test.zig+4-1| ... | @@ -1,5 +1,8 @@ | ... | @@ -1,5 +1,8 @@ |
| 1 | test "example" { return 1; } | 1 | test "example" { return 1; } |
| 2 | 2 | ||
| 3 | // return invalid type from test | 3 | // error |
| 4 | // backend=stage1 | ||
| 5 | // target=native | ||
| 6 | // is_test=1 | ||
| 4 | // | 7 | // |
| 5 | // tmp.zig:1:25: error: expected type 'void', found 'comptime_int' | 8 | // tmp.zig:1:25: error: expected type 'void', found 'comptime_int' |
test/compile_errors/stage1/test/shift_on_type_with_non-power-of-two_size.zig+4-1| ... | @@ -23,7 +23,10 @@ export fn entry() void { | ... | @@ -23,7 +23,10 @@ export fn entry() void { |
| 23 | S.d(); | 23 | S.d(); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | // shift on type with non-power-of-two size | 26 | // error |
| 27 | // backend=stage1 | ||
| 28 | // target=native | ||
| 29 | // is_test=1 | ||
| 27 | // | 30 | // |
| 28 | // tmp.zig:5:19: error: RHS of shift is too large for LHS type | 31 | // tmp.zig:5:19: error: RHS of shift is too large for LHS type |
| 29 | // tmp.zig:9:19: error: RHS of shift is too large for LHS type | 32 | // tmp.zig:9:19: error: RHS of shift is too large for LHS type |
test/compile_errors/stage1/test/shuffle_with_selected_index_past_first_vector_length.zig+4-1| ... | @@ -5,7 +5,10 @@ export fn entry() void { | ... | @@ -5,7 +5,10 @@ export fn entry() void { |
| 5 | _ = z; | 5 | _ = z; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // @shuffle with selected index past first vector length | 8 | // error |
| 9 | // backend=stage1 | ||
| 10 | // target=native | ||
| 11 | // is_test=1 | ||
| 9 | // | 12 | // |
| 10 | // tmp.zig:4:39: error: mask index '4' has out-of-bounds selection | 13 | // tmp.zig:4:39: error: mask index '4' has out-of-bounds selection |
| 11 | // tmp.zig:4:27: note: selected index '7' out of bounds of @Vector(4, u32) | 14 | // tmp.zig:4:27: note: selected index '7' out of bounds of @Vector(4, u32) |
test/compile_errors/stage1/test/switch_ranges_endpoints_are_validated.zig+4-1| ... | @@ -7,7 +7,10 @@ pub export fn entry() void { | ... | @@ -7,7 +7,10 @@ pub export fn entry() void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // switch ranges endpoints are validated | 10 | // error |
| 11 | // backend=stage1 | ||
| 12 | // target=native | ||
| 13 | // is_test=1 | ||
| 11 | // | 14 | // |
| 12 | // tmp.zig:4:9: error: range start value is greater than the end value | 15 | // tmp.zig:4:9: error: range start value is greater than the end value |
| 13 | // tmp.zig:5:9: error: range start value is greater than the end value | 16 | // tmp.zig:5:9: error: range start value is greater than the end value |
test/compile_errors/stage1/test/switching_with_exhaustive_enum_has___prong_.zig+4-1| ... | @@ -11,6 +11,9 @@ pub export fn entry() void { | ... | @@ -11,6 +11,9 @@ pub export fn entry() void { |
| 11 | } | 11 | } |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // switching with exhaustive enum has '_' prong | 14 | // error |
| 15 | // backend=stage1 | ||
| 16 | // target=native | ||
| 17 | // is_test=1 | ||
| 15 | // | 18 | // |
| 16 | // tmp.zig:7:5: error: switch on exhaustive enum has `_` prong | 19 | // tmp.zig:7:5: error: switch on exhaustive enum has `_` prong |
test/compile_errors/stage1/test/switching_with_non-exhaustive_enums.zig+4-1| ... | @@ -25,7 +25,10 @@ pub export fn entry() void { | ... | @@ -25,7 +25,10 @@ pub export fn entry() void { |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | // switching with non-exhaustive enums | 28 | // error |
| 29 | // backend=stage1 | ||
| 30 | // target=native | ||
| 31 | // is_test=1 | ||
| 29 | // | 32 | // |
| 30 | // tmp.zig:12:5: error: enumeration value 'E.b' not handled in switch | 33 | // tmp.zig:12:5: error: enumeration value 'E.b' not handled in switch |
| 31 | // tmp.zig:16:5: error: switch on non-exhaustive enum must include `else` or `_` prong | 34 | // tmp.zig:16:5: error: switch on non-exhaustive enum must include `else` or `_` prong |
test/compile_errors/stage1/test/tagName_on_invalid_value_of_non-exhaustive_enum.zig+4-1| ... | @@ -3,6 +3,9 @@ test "enum" { | ... | @@ -3,6 +3,9 @@ test "enum" { |
| 3 | _ = @tagName(@intToEnum(E, 5)); | 3 | _ = @tagName(@intToEnum(E, 5)); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // @tagName on invalid value of non-exhaustive enum | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 9 | // is_test=1 | ||
| 7 | // | 10 | // |
| 8 | // tmp.zig:3:18: error: no tag by value 5 | 11 | // tmp.zig:3:18: error: no tag by value 5 |
test/compile_errors/stage1/test/type_mismatch_in_C_prototype_with_varargs.zig+4-1| ... | @@ -6,6 +6,9 @@ export fn main() void { | ... | @@ -6,6 +6,9 @@ export fn main() void { |
| 6 | _ = x; | 6 | _ = x; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // type mismatch in C prototype with varargs | 9 | // error |
| 10 | // backend=stage1 | ||
| 11 | // target=native | ||
| 12 | // is_test=1 | ||
| 10 | // | 13 | // |
| 11 | // tmp.zig:5:22: error: expected type 'fn([*c]u8, ...) callconv(.C) void', found 'fn([*:0]u8, ...) callconv(.C) void' | 14 | // tmp.zig:5:22: error: expected type 'fn([*c]u8, ...) callconv(.C) void', found 'fn([*:0]u8, ...) callconv(.C) void' |
test/compile_errors/stage1/test/type_mismatch_with_tuple_concatenation.zig+4-1| ... | @@ -3,6 +3,9 @@ export fn entry() void { | ... | @@ -3,6 +3,9 @@ export fn entry() void { |
| 3 | x = x ++ .{ 1, 2, 3 }; | 3 | x = x ++ .{ 1, 2, 3 }; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // type mismatch with tuple concatenation | 6 | // error |
| 7 | // backend=stage1 | ||
| 8 | // target=native | ||
| 9 | // is_test=1 | ||
| 7 | // | 10 | // |
| 8 | // tmp.zig:3:11: error: expected type 'struct:2:14', found 'struct:3:11' | 11 | // tmp.zig:3:11: error: expected type 'struct:2:14', found 'struct:3:11' |
test/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig+1| ... | @@ -15,6 +15,7 @@ export fn entry() void { | ... | @@ -15,6 +15,7 @@ export fn entry() void { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // error | 17 | // error |
| 18 | // target=native | ||
| 18 | // | 19 | // |
| 19 | // :4:5: error: unreachable code | 20 | // :4:5: error: unreachable code |
| 20 | // :4:25: note: control flow is diverted here | 21 | // :4:25: note: control flow is diverted here |
test/compile_errors/stage2/duplicate-unused_labels.zig+1| ... | @@ -18,6 +18,7 @@ comptime { | ... | @@ -18,6 +18,7 @@ comptime { |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | // error | 20 | // error |
| 21 | // target=native | ||
| 21 | // | 22 | // |
| 22 | // :2:12: error: redefinition of label 'blk' | 23 | // :2:12: error: redefinition of label 'blk' |
| 23 | // :2:5: note: previous definition here | 24 | // :2:5: note: previous definition here |
test/compile_errors/stage2/embed_outside_package.zig+1| ... | @@ -3,5 +3,6 @@ export fn a() usize { | ... | @@ -3,5 +3,6 @@ export fn a() usize { |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // error | 5 | // error |
| 6 | // target=native | ||
| 6 | // | 7 | // |
| 7 | //:2:23: error: embed of file outside package path: '/root/foo' | 8 | //:2:23: error: embed of file outside package path: '/root/foo' |
test/compile_errors/stage2/import_outside_package.zig+1| ... | @@ -3,5 +3,6 @@ export fn a() usize { | ... | @@ -3,5 +3,6 @@ export fn a() usize { |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // error | 5 | // error |
| 6 | // target=native | ||
| 6 | // | 7 | // |
| 7 | // :2:20: error: import of file outside package path: '../../above.zig' | 8 | // :2:20: error: import of file outside package path: '../../above.zig' |
test/compile_errors/stage2/out_of_bounds_index.zig+1| ... | @@ -21,6 +21,7 @@ comptime { | ... | @@ -21,6 +21,7 @@ comptime { |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | // error | 23 | // error |
| 24 | // target=native | ||
| 24 | // | 25 | // |
| 25 | // :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel) | 26 | // :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel) |
| 26 | // :9:22: error: end index 6 out of bounds for array of length 4 +1 (sentinel) | 27 | // :9:22: error: end index 6 out of bounds for array of length 4 +1 (sentinel) |
test/compile_errors/stage2/slice_of_null_pointer.zig+1| ... | @@ -6,5 +6,6 @@ comptime { | ... | @@ -6,5 +6,6 @@ comptime { |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // error | 8 | // error |
| 9 | // target=native | ||
| 9 | // | 10 | // |
| 10 | // :4:14: error: slice of null pointer | 11 | // :4:14: error: slice of null pointer |
test/compile_errors/stage2/struct_duplicate_field_name.zig+1| ... | @@ -9,6 +9,7 @@ export fn entry() void { | ... | @@ -9,6 +9,7 @@ export fn entry() void { |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // error | 11 | // error |
| 12 | // target=native | ||
| 12 | // | 13 | // |
| 13 | // :3:5: error: duplicate struct field: 'foo' | 14 | // :3:5: error: duplicate struct field: 'foo' |
| 14 | // :2:5: note: other field here | 15 | // :2:5: note: other field here |
test/compile_errors/stage2/union_access_of_inactive_field.zig+1| ... | @@ -9,6 +9,7 @@ comptime { | ... | @@ -9,6 +9,7 @@ comptime { |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // error | 11 | // error |
| 12 | // target=native | ||
| 12 | // | 13 | // |
| 13 | // :7:16: error: access of union field 'b' while field 'a' is active | 14 | // :7:16: error: access of union field 'b' while field 'a' is active |
| 14 | // :1:11: note: union declared here | 15 | // :1:11: note: union declared here |
test/compile_errors/stage2/union_duplicate_enum_field.zig+1| ... | @@ -10,6 +10,7 @@ export fn foo() void { | ... | @@ -10,6 +10,7 @@ export fn foo() void { |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // error | 12 | // error |
| 13 | // target=native | ||
| 13 | // | 14 | // |
| 14 | // :4:5: error: duplicate union field: 'a' | 15 | // :4:5: error: duplicate union field: 'a' |
| 15 | // :3:5: note: other field here | 16 | // :3:5: note: other field here |
test/compile_errors/stage2/union_duplicate_field_definition.zig+1| ... | @@ -9,6 +9,7 @@ export fn entry() void { | ... | @@ -9,6 +9,7 @@ export fn entry() void { |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // error | 11 | // error |
| 12 | // target=native | ||
| 12 | // | 13 | // |
| 13 | // :3:5: error: duplicate union field: 'foo' | 14 | // :3:5: error: duplicate union field: 'foo' |
| 14 | // :2:5: note: other field here | 15 | // :2:5: note: other field here |
test/compile_errors/stage2/union_enum_field_missing.zig+1| ... | @@ -14,6 +14,7 @@ export fn entry() usize { | ... | @@ -14,6 +14,7 @@ export fn entry() usize { |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // error | 16 | // error |
| 17 | // target=native | ||
| 17 | // | 18 | // |
| 18 | // :7:1: error: enum field(s) missing in union | 19 | // :7:1: error: enum field(s) missing in union |
| 19 | // :4:5: note: field 'c' missing, declared here | 20 | // :4:5: note: field 'c' missing, declared here |
test/compile_errors/stage2/union_extra_field.zig+1| ... | @@ -14,6 +14,7 @@ export fn entry() usize { | ... | @@ -14,6 +14,7 @@ export fn entry() usize { |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // error | 16 | // error |
| 17 | // target=native | ||
| 17 | // | 18 | // |
| 18 | // :6:1: error: enum 'tmp.E' has no field named 'd' | 19 | // :6:1: error: enum 'tmp.E' has no field named 'd' |
| 19 | // :1:11: note: enum declared here | 20 | // :1:11: note: enum declared here |
test/compile_errors/stage2/union_runtime_coercion_from_enum.zig+1| ... | @@ -15,6 +15,7 @@ export fn doTheTest() u64 { | ... | @@ -15,6 +15,7 @@ export fn doTheTest() u64 { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // error | 17 | // error |
| 18 | // target=native | ||
| 18 | // | 19 | // |
| 19 | // :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields | 20 | // :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields |
| 20 | // :6:5: note: field 'a' has type 'u32' | 21 | // :6:5: note: field 'a' has type 'u32' |