diff --git a/ci/zinc/linux_test.sh b/ci/zinc/linux_test.sh index b0f65aefd30f12fa79a21326f11d5be4effd3b1f..ec999a483a062e3c741fc57a0c8ed537d1ba59c2 100755 --- a/ci/zinc/linux_test.sh +++ b/ci/zinc/linux_test.sh @@ -45,7 +45,7 @@ cd $WORKSPACE # Look for non-conforming code formatting. # Formatting errors can be fixed by running `zig fmt` on the files printed here. -$ZIG fmt --check . --exclude test/compile_errors/ +$ZIG fmt --check . --exclude test/compile_errors/ --exclude test/incremental/ # Build stage2 standalone so that we can test stage2 against stage2 compiler-rt. $ZIG build -p stage2 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL" diff --git a/src/test.zig b/src/test.zig index 8c2a15e8442e1da652203d699ba30383f9f41bb4..758347ac18b039bf738431c5cfc86129f2bbbb11 100644 --- a/src/test.zig +++ b/src/test.zig @@ -34,42 +34,28 @@ test { var ctx = TestContext.init(std.testing.allocator, arena); defer ctx.deinit(); - const compile_errors_dir_path = try std.fs.path.join(arena, &.{ - std.fs.path.dirname(@src().file).?, "..", "test", "compile_errors", - }); - - var compile_errors_dir = try std.fs.cwd().openDir(compile_errors_dir_path, .{}); - defer compile_errors_dir.close(); - { - var stage2_dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true }); - defer stage2_dir.close(); + const dir_path = try std.fs.path.join(arena, &.{ + std.fs.path.dirname(@src().file).?, "..", "test", "compile_errors", + }); + + var dir = try std.fs.cwd().openDir(dir_path, .{ .iterate = true }); + defer dir.close(); // TODO make this incremental once the bug is solved that it triggers // See: https://github.com/ziglang/zig/issues/11344 - ctx.addErrorCasesFromDir("stage2", stage2_dir, .stage2, .Obj, false, .independent); + ctx.addTestCasesFromDir(dir, .independent); } - if (!skip_stage1) { - var stage1_dir = try compile_errors_dir.openDir("stage1", .{}); - defer stage1_dir.close(); + { + const dir_path = try std.fs.path.join(arena, &.{ + std.fs.path.dirname(@src().file).?, "..", "test", "incremental", + }); - const Config = struct { - name: []const u8, - is_test: bool, - output_mode: std.builtin.OutputMode, - }; + var dir = try std.fs.cwd().openDir(dir_path, .{ .iterate = true }); + defer dir.close(); - for ([_]Config{ - .{ .name = "obj", .is_test = false, .output_mode = .Obj }, - .{ .name = "exe", .is_test = false, .output_mode = .Exe }, - .{ .name = "test", .is_test = true, .output_mode = .Exe }, - }) |config| { - var dir = try stage1_dir.openDir(config.name, .{ .iterate = true }); - defer dir.close(); - - ctx.addErrorCasesFromDir("stage1", dir, .stage1, config.output_mode, config.is_test, .independent); - } + ctx.addTestCasesFromDir(dir, .incremental); } try @import("test_cases").addCases(&ctx); @@ -154,6 +140,261 @@ const ErrorMsg = union(enum) { } }; +/// Default config values for known test manifest key-value pairings. +/// Currently handled defaults are: +/// * backend +/// * target +/// * output_mode +/// * is_test +const TestManifestConfigDefaults = struct { + /// Asserts if the key doesn't exist - yep, it's an oversight alright. + fn get(@"type": TestManifest.Type, key: []const u8) []const u8 { + if (std.mem.eql(u8, key, "backend")) { + return "stage2"; + } else if (std.mem.eql(u8, key, "target")) { + comptime { + var defaults: []const u8 = ""; + // TODO should we only return "mainstream" targets by default here? + // TODO we should also specify ABIs explicitly as the backends are + // getting more and more complete + // Linux + inline for (&[_][]const u8{ "x86_64", "arm", "aarch64" }) |arch| { + defaults = defaults ++ arch ++ "-linux" ++ ","; + } + // macOS + inline for (&[_][]const u8{ "x86_64", "aarch64" }) |arch| { + defaults = defaults ++ arch ++ "-macos" ++ ","; + } + // Wasm + defaults = defaults ++ "wasm32-wasi"; + return defaults; + } + } else if (std.mem.eql(u8, key, "output_mode")) { + return switch (@"type") { + .@"error" => "Obj", + .run => "Exe", + .cli => @panic("TODO test harness for CLI tests"), + }; + } else if (std.mem.eql(u8, key, "is_test")) { + return "0"; + } else unreachable; + } +}; + +/// Manifest syntax example: +/// (see https://github.com/ziglang/zig/issues/11288) +/// +/// error +/// backend=stage1,stage2 +/// output_mode=exe +/// +/// :3:19: error: foo +/// +/// run +/// target=x86_64-linux,aarch64-macos +/// +/// I am expected stdout! Hello! +/// +/// cli +/// +/// build test +const TestManifest = struct { + @"type": Type, + config_map: std.StringHashMap([]const u8), + trailing_bytes: []const u8 = "", + + const Type = enum { + @"error", + run, + cli, + }; + + const TrailingIterator = struct { + inner: std.mem.TokenIterator(u8), + + fn next(self: *TrailingIterator) ?[]const u8 { + const next_inner = self.inner.next() orelse return null; + return std.mem.trim(u8, next_inner[2..], " \t"); + } + }; + + fn ConfigValueIterator(comptime T: type) type { + return struct { + inner: std.mem.SplitIterator(u8), + parse_fn: ParseFn(T), + + fn next(self: *@This()) ?T { + const next_raw = self.inner.next() orelse return null; + return self.parse_fn(next_raw); + } + }; + } + + fn parse(arena: Allocator, bytes: []const u8) !TestManifest { + // The manifest is the last contiguous block of comments in the file + // We scan for the beginning by searching backward for the first non-empty line that does not start with "//" + var start: ?usize = null; + var end: usize = bytes.len; + if (bytes.len > 0) { + var cursor: usize = bytes.len - 1; + while (true) { + // Move to beginning of line + while (cursor > 0 and bytes[cursor - 1] != '\n') cursor -= 1; + + if (std.mem.startsWith(u8, bytes[cursor..], "//")) { + start = cursor; // Contiguous comment line, include in manifest + } else { + if (start != null) break; // Encountered non-comment line, end of manifest + + // We ignore all-whitespace lines following the comment block, but anything else + // means that there is no manifest present. + if (std.mem.trim(u8, bytes[cursor..end], " \r\n\t").len == 0) { + end = cursor; + } else break; // If it's not whitespace, there is no manifest + } + + // Move to previous line + if (cursor != 0) cursor -= 1 else break; + } + } + + const actual_start = start orelse return error.MissingTestManifest; + const manifest_bytes = bytes[actual_start..end]; + + var it = std.mem.tokenize(u8, manifest_bytes, "\r\n"); + + // First line is the test type + const tt: Type = blk: { + const line = it.next() orelse return error.MissingTestCaseType; + const raw = std.mem.trim(u8, line[2..], " \t"); + if (std.mem.eql(u8, raw, "error")) { + break :blk .@"error"; + } else if (std.mem.eql(u8, raw, "run")) { + break :blk .run; + } else if (std.mem.eql(u8, raw, "cli")) { + break :blk .cli; + } else { + std.log.warn("unknown test case type requested: {s}", .{raw}); + return error.UnknownTestCaseType; + } + }; + + var manifest: TestManifest = .{ + .@"type" = tt, + .config_map = std.StringHashMap([]const u8).init(arena), + }; + + // Any subsequent line until a blank comment line is key=value(s) pair + while (it.next()) |line| { + const trimmed = std.mem.trim(u8, line[2..], " \t"); + if (trimmed.len == 0) break; + + // Parse key=value(s) + var kv_it = std.mem.split(u8, trimmed, "="); + const key = kv_it.next() orelse return error.MissingKeyForConfig; + try manifest.config_map.putNoClobber(key, kv_it.next() orelse return error.MissingValuesForConfig); + } + + // Finally, trailing is expected output + manifest.trailing_bytes = manifest_bytes[it.index..]; + + return manifest; + } + + fn getConfigForKeyCustomParser( + self: TestManifest, + key: []const u8, + comptime T: type, + parse_fn: ParseFn(T), + ) ConfigValueIterator(T) { + const bytes = self.config_map.get(key) orelse TestManifestConfigDefaults.get(self.@"type", key); + return ConfigValueIterator(T){ + .inner = std.mem.split(u8, bytes, ","), + .parse_fn = parse_fn, + }; + } + + fn getConfigForKey( + self: TestManifest, + key: []const u8, + comptime T: type, + ) ConfigValueIterator(T) { + return self.getConfigForKeyCustomParser(key, T, getDefaultParser(T)); + } + + fn getConfigForKeyAlloc( + self: TestManifest, + allocator: Allocator, + key: []const u8, + comptime T: type, + ) error{OutOfMemory}![]const T { + var out = std.ArrayList(T).init(allocator); + defer out.deinit(); + var it = self.getConfigForKey(key, T); + while (it.next()) |item| { + try out.append(item); + } + return out.toOwnedSlice(); + } + + fn getConfigForKeyAssertSingle(self: TestManifest, key: []const u8, comptime T: type) T { + var it = self.getConfigForKey(key, T); + const res = it.next().?; + assert(it.next() == null); + return res; + } + + fn trailing(self: TestManifest) TrailingIterator { + return .{ + .inner = std.mem.tokenize(u8, self.trailing_bytes, "\r\n"), + }; + } + + fn trailingAlloc(self: TestManifest, allocator: Allocator) error{OutOfMemory}![]const []const u8 { + var out = std.ArrayList([]const u8).init(allocator); + defer out.deinit(); + var it = self.trailing(); + while (it.next()) |line| { + try out.append(line); + } + return out.toOwnedSlice(); + } + + fn ParseFn(comptime T: type) type { + return fn ([]const u8) ?T; + } + + fn getDefaultParser(comptime T: type) ParseFn(T) { + switch (@typeInfo(T)) { + .Int => return struct { + fn parse(str: []const u8) ?T { + return std.fmt.parseInt(T, str, 0) catch null; + } + }.parse, + .Bool => return struct { + fn parse(str: []const u8) ?T { + const as_int = std.fmt.parseInt(u1, str, 0) catch return null; + return as_int > 0; + } + }.parse, + .Enum => return struct { + fn parse(str: []const u8) ?T { + return std.meta.stringToEnum(T, str); + } + }.parse, + .Struct => if (comptime std.mem.eql(u8, @typeName(T), "CrossTarget")) return struct { + fn parse(str: []const u8) ?T { + var opts = CrossTarget.ParseOptions{ + .arch_os_abi = str, + }; + return CrossTarget.parse(opts) catch null; + } + }.parse else @compileError("no default parser for " ++ @typeName(T)), + else => @compileError("no default parser for " ++ @typeName(T)), + } + } +}; + pub const TestContext = struct { arena: Allocator, cases: std.ArrayList(Case), @@ -663,26 +904,15 @@ pub const TestContext = struct { incremental, }; - /// Adds a compile-error test for each file in the provided directory, using the - /// selected backend and output mode. If `one_test_case_per_file` is true, a new - /// test case is created for each file. Otherwise, a single test case is used for - /// all tests. + /// Adds a test for each file in the provided directory, using the selected strategy. + /// Recurses nested directories. /// /// Each file should include a test manifest as a contiguous block of comments at - /// the end of the file. The first line should be the test case name, followed by - /// a blank line, then one expected errors on each line in the form - /// `:line:column: error: message` - pub fn addErrorCasesFromDir( - ctx: *TestContext, - name: []const u8, - dir: std.fs.Dir, - backend: Backend, - output_mode: std.builtin.OutputMode, - is_test: bool, - strategy: Strategy, - ) void { + /// the end of the file. The first line should be the test type, followed by a set of + /// key-value config values, followed by a blank line, then the expected output. + pub fn addTestCasesFromDir(ctx: *TestContext, dir: std.fs.Dir, strategy: Strategy) void { var current_file: []const u8 = "none"; - addErrorCasesFromDirInner(ctx, name, dir, backend, output_mode, is_test, strategy, ¤t_file) catch |err| { + ctx.addTestCasesFromDirInner(dir, strategy, ¤t_file) catch |err| { std.debug.panic("test harness failed to process file '{s}': {s}\n", .{ current_file, @errorName(err), }); @@ -749,33 +979,28 @@ pub const TestContext = struct { std.sort.sort([]const u8, filenames, Context{}, Context.lessThan); } - fn addErrorCasesFromDirInner( + fn addTestCasesFromDirInner( ctx: *TestContext, - name: []const u8, dir: std.fs.Dir, - backend: Backend, - output_mode: std.builtin.OutputMode, - is_test: bool, strategy: Strategy, /// This is kept up to date with the currently being processed file so /// that if any errors occur the caller knows it happened during this file. current_file: *[]const u8, ) !void { - var opt_case: ?*Case = null; + var cases = std.ArrayList(usize).init(ctx.arena); - var it = dir.iterate(); + var it = try dir.walk(ctx.arena); var filenames = std.ArrayList([]const u8).init(ctx.arena); - defer filenames.deinit(); while (try it.next()) |entry| { if (entry.kind != .File) continue; // Ignore stuff such as .swp files - switch (Compilation.classifyFileExt(entry.name)) { + switch (Compilation.classifyFileExt(entry.basename)) { .unknown => continue, else => {}, } - try filenames.append(try ctx.arena.dupe(u8, entry.name)); + try filenames.append(try ctx.arena.dupe(u8, entry.path)); } // Sort filenames, so that incremental tests are contiguous and in-order @@ -785,108 +1010,99 @@ pub const TestContext = struct { for (filenames.items) |filename| { current_file.* = filename; - { // First, check if this file is part of an incremental update sequence + // First, check if this file is part of an incremental update sequence + // Split filename into ".." + const prev_parts = getTestFileNameParts(prev_filename); + const new_parts = getTestFileNameParts(filename); - // Split filename into ".." - const prev_parts = getTestFileNameParts(prev_filename); - const new_parts = getTestFileNameParts(filename); - - // If base_name and file_ext match, these files are in the same test sequence - // and the new one should be the incremented version of the previous test - if (std.mem.eql(u8, prev_parts.base_name, new_parts.base_name) and - std.mem.eql(u8, prev_parts.file_ext, new_parts.file_ext)) - { - - // This is "foo.X.zig" followed by "foo.Y.zig". Make sure that X = Y + 1 - if (prev_parts.test_index == null) return error.InvalidIncrementalTestIndex; - if (new_parts.test_index == null) return error.InvalidIncrementalTestIndex; - if (new_parts.test_index.? != prev_parts.test_index.? + 1) return error.InvalidIncrementalTestIndex; - } else { - - // This is not the same test sequence, so the new file must be the first file - // in a new sequence ("*.0.zig") or an independent test file ("*.zig") - if (new_parts.test_index != null and new_parts.test_index.? != 0) return error.InvalidIncrementalTestIndex; - - if (strategy == .independent) - opt_case = null; // Generate a new independent test case for this update - } + // If base_name and file_ext match, these files are in the same test sequence + // and the new one should be the incremented version of the previous test + if (std.mem.eql(u8, prev_parts.base_name, new_parts.base_name) and + std.mem.eql(u8, prev_parts.file_ext, new_parts.file_ext)) + { + // This is "foo.X.zig" followed by "foo.Y.zig". Make sure that X = Y + 1 + if (prev_parts.test_index == null) return error.InvalidIncrementalTestIndex; + if (new_parts.test_index == null) return error.InvalidIncrementalTestIndex; + if (new_parts.test_index.? != prev_parts.test_index.? + 1) return error.InvalidIncrementalTestIndex; + } else { + // This is not the same test sequence, so the new file must be the first file + // in a new sequence ("*.0.zig") or an independent test file ("*.zig") + if (new_parts.test_index != null and new_parts.test_index.? != 0) return error.InvalidIncrementalTestIndex; + cases.clearRetainingCapacity(); } prev_filename = filename; const max_file_size = 10 * 1024 * 1024; const src = try dir.readFileAllocOptions(ctx.arena, filename, max_file_size, null, 1, 0); - // The manifest is the last contiguous block of comments in the file - // We scan for the beginning by searching backward for the first non-empty line that does not start with "//" - var manifest_start: ?usize = null; - var manifest_end: usize = src.len; - if (src.len > 0) { - var cursor: usize = src.len - 1; - while (true) { - // Move to beginning of line - while (cursor > 0 and src[cursor - 1] != '\n') cursor -= 1; + // Parse the manifest + var manifest = try TestManifest.parse(ctx.arena, src); - if (std.mem.startsWith(u8, src[cursor..], "//")) { - manifest_start = cursor; // Contiguous comment line, include in manifest - } else { - if (manifest_start != null) break; // Encountered non-comment line, end of manifest + if (cases.items.len == 0) { + const backends = try manifest.getConfigForKeyAlloc(ctx.arena, "backend", Backend); + const targets = try manifest.getConfigForKeyAlloc(ctx.arena, "target", CrossTarget); + const is_test = manifest.getConfigForKeyAssertSingle("is_test", bool); + const output_mode = manifest.getConfigForKeyAssertSingle("output_mode", std.builtin.OutputMode); - // We ignore all-whitespace lines following the comment block, but anything else - // means that there is no manifest present. - if (std.mem.trim(u8, src[cursor..manifest_end], " \r\n\t").len == 0) { - manifest_end = cursor; - } else break; // If it's not whitespace, there is no manifest + const name_prefix = blk: { + const ext_index = std.mem.lastIndexOfScalar(u8, current_file.*, '.') orelse + return error.InvalidFilename; + const index = std.mem.lastIndexOfScalar(u8, current_file.*[0..ext_index], '.') orelse ext_index; + break :blk current_file.*[0..index]; + }; + + // Cross-product to get all possible test combinations + for (backends) |backend| { + for (targets) |target| { + const name = try std.fmt.allocPrint(ctx.arena, "{s} ({s}, {s})", .{ + name_prefix, + @tagName(backend), + try target.zigTriple(ctx.arena), + }); + const next = ctx.cases.items.len; + try ctx.cases.append(.{ + .name = name, + .target = target, + .backend = backend, + .updates = std.ArrayList(TestContext.Update).init(ctx.cases.allocator), + .is_test = is_test, + .output_mode = output_mode, + .link_libc = backend == .llvm, + .files = std.ArrayList(TestContext.File).init(ctx.cases.allocator), + }); + try cases.append(next); } - - // Move to previous line - if (cursor != 0) cursor -= 1 else break; } } - var errors = std.ArrayList([]const u8).init(ctx.arena); - - if (manifest_start) |start| { - // Due to the above processing, we know that this is a contiguous block of comments - // and do not need to re-validate the leading "//" on each line - var manifest_it = std.mem.tokenize(u8, src[start..manifest_end], "\r\n"); - - // First line is the test case name - const first_line = manifest_it.next() orelse return error.MissingTestCaseName; - const case_name = try std.mem.concat(ctx.arena, u8, &.{ name, ": ", std.mem.trim(u8, first_line[2..], " \t") }); - - // If the second line is present, it should be blank - if (manifest_it.next()) |second_line| { - if (std.mem.trim(u8, second_line[2..], " \t").len != 0) return error.SecondLineNotBlank; - } - - // All following lines are expected error messages - while (manifest_it.next()) |line| try errors.append(try ctx.arena.dupe(u8, std.mem.trim(u8, line[2..], " \t"))); - - const case = opt_case orelse case: { - ctx.cases.append(TestContext.Case{ - .name = name, - .target = .{}, - .backend = backend, - .updates = std.ArrayList(TestContext.Update).init(ctx.cases.allocator), - .is_test = is_test, - .output_mode = output_mode, - .files = std.ArrayList(TestContext.File).init(ctx.cases.allocator), - }) catch @panic("out of memory"); - const case = &ctx.cases.items[ctx.cases.items.len - 1]; - opt_case = case; - break :case case; - }; - switch (strategy) { - .independent => { - case.name = case_name; - case.addError(src, errors.items); + for (cases.items) |case_index| { + const case = &ctx.cases.items[case_index]; + switch (manifest.@"type") { + .@"error" => { + const errors = try manifest.trailingAlloc(ctx.arena); + switch (strategy) { + .independent => { + case.addError(src, errors); + }, + .incremental => { + case.addErrorNamed("update", src, errors); + }, + } }, - .incremental => { - case.addErrorNamed(case_name, src, errors.items); + .run => { + var output = std.ArrayList(u8).init(ctx.arena); + var trailing_it = manifest.trailing(); + while (trailing_it.next()) |line| { + try output.appendSlice(line); + try output.append('\n'); + } + if (output.items.len > 0) { + try output.resize(output.items.len - 1); + } + case.addCompareOutput(src, output.toOwnedSlice()); }, + .cli => @panic("TODO cli tests"), } - } else { - return error.MissingManifest; } } } diff --git a/test/behavior.zig b/test/behavior.zig index 828a56a81f563215c22272173c7cfc84c86869ff..4d8b3587bc96df162541c97f535505618da233eb 100644 --- a/test/behavior.zig +++ b/test/behavior.zig @@ -69,8 +69,10 @@ test { _ = @import("behavior/bugs/7003.zig"); _ = @import("behavior/bugs/7027.zig"); _ = @import("behavior/bugs/7047.zig"); + _ = @import("behavior/bugs/7187.zig"); _ = @import("behavior/bugs/7250.zig"); _ = @import("behavior/bugs/9584.zig"); + _ = @import("behavior/bugs/10138.zig"); _ = @import("behavior/bugs/10147.zig"); _ = @import("behavior/bugs/10970.zig"); _ = @import("behavior/bugs/11046.zig"); diff --git a/test/behavior/bugs/10138.zig b/test/behavior/bugs/10138.zig new file mode 100644 index 0000000000000000000000000000000000000000..88dc5acde74fe2863011a3de993b24221da0e0eb --- /dev/null +++ b/test/behavior/bugs/10138.zig @@ -0,0 +1,34 @@ +const std = @import("std"); +const builtin = @import("builtin"); + +test "registers get overwritten when ignoring return" { + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; + if (builtin.cpu.arch != .x86_64 or builtin.os.tag != .linux) return error.SkipZigTest; + + const fd = open(); + _ = write(fd, "a", 1); + _ = close(fd); +} + +fn open() usize { + return 42; +} + +fn write(fd: usize, a: [*]const u8, len: usize) usize { + return syscall4(.WRITE, fd, @ptrToInt(a), len); +} + +fn syscall4(n: enum { WRITE }, a: usize, b: usize, c: usize) usize { + _ = n; + _ = a; + _ = b; + _ = c; + return 23; +} + +fn close(fd: usize) usize { + if (fd != 42) + unreachable; + return 0; +} diff --git a/test/behavior/bugs/7187.zig b/test/behavior/bugs/7187.zig new file mode 100644 index 0000000000000000000000000000000000000000..86f5aa670643897c44738d43952697429c8e680a --- /dev/null +++ b/test/behavior/bugs/7187.zig @@ -0,0 +1,18 @@ +const std = @import("std"); +const builtin = @import("builtin"); +const expect = std.testing.expect; + +test "miscompilation with bool return type" { + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; + + var x: usize = 1; + var y: bool = getFalse(); + _ = y; + + try expect(x == 1); +} + +fn getFalse() bool { + return false; +} diff --git a/test/cases.zig b/test/cases.zig index 0fb6f381dde7b1406ce2e39361a5343a03cc82f1..65eec90f1bdfea1a6a1ddc196d02a712ca74d211 100644 --- a/test/cases.zig +++ b/test/cases.zig @@ -1,22 +1,9 @@ const std = @import("std"); const TestContext = @import("../src/test.zig").TestContext; -// Self-hosted has differing levels of support for various architectures. For now we pass explicit -// target parameters to each test case. At some point we will take this to the next level and have -// a set of targets that all test cases run on unless specifically overridden. For now, each test -// case applies to only the specified target. - pub fn addCases(ctx: *TestContext) !void { try @import("compile_errors.zig").addCases(ctx); try @import("stage2/cbe.zig").addCases(ctx); - try @import("stage2/arm.zig").addCases(ctx); - try @import("stage2/aarch64.zig").addCases(ctx); - try @import("stage2/llvm.zig").addCases(ctx); - try @import("stage2/wasm.zig").addCases(ctx); - try @import("stage2/riscv64.zig").addCases(ctx); - try @import("stage2/plan9.zig").addCases(ctx); - try @import("stage2/x86_64.zig").addCases(ctx); - try @import("stage2/sparcv9.zig").addCases(ctx); // https://github.com/ziglang/zig/issues/10968 //try @import("stage2/nvptx.zig").addCases(ctx); } diff --git a/test/compile_errors.zig b/test/compile_errors.zig index d0e4156f18dde037c54d0c43d7115dc070f91553..f79d2b8e92a4c277e8c3080fefb8c3f33ca13c53 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -3,207 +3,6 @@ const builtin = @import("builtin"); const TestContext = @import("../src/test.zig").TestContext; pub fn addCases(ctx: *TestContext) !void { - { - const case = ctx.obj("callconv(.Interrupt) on unsupported platform", .{ - .cpu_arch = .aarch64, - .os_tag = .linux, - .abi = .none, - }); - case.backend = .stage1; - case.addError( - \\export fn entry() callconv(.Interrupt) void {} - , &[_][]const u8{ - "tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64", - }); - } - { - var case = ctx.obj("callconv(.Signal) on unsupported platform", .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .none, - }); - case.backend = .stage1; - case.addError( - \\export fn entry() callconv(.Signal) void {} - , &[_][]const u8{ - "tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64", - }); - } - { - const case = ctx.obj("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .none, - }); - case.backend = .stage1; - case.addError( - \\const F1 = fn () callconv(.Stdcall) void; - \\const F2 = fn () callconv(.Fastcall) void; - \\const F3 = fn () callconv(.Thiscall) void; - \\export fn entry1() void { var a: F1 = undefined; _ = a; } - \\export fn entry2() void { var a: F2 = undefined; _ = a; } - \\export fn entry3() void { var a: F3 = undefined; _ = a; } - , &[_][]const u8{ - "tmp.zig:1:27: error: callconv 'Stdcall' is only available on x86, not x86_64", - "tmp.zig:2:27: error: callconv 'Fastcall' is only available on x86, not x86_64", - "tmp.zig:3:27: error: callconv 'Thiscall' is only available on x86, not x86_64", - }); - } - { - const case = ctx.obj("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .none, - }); - case.backend = .stage1; - case.addError( - \\export fn entry1() callconv(.Stdcall) void {} - \\export fn entry2() callconv(.Fastcall) void {} - \\export fn entry3() callconv(.Thiscall) void {} - , &[_][]const u8{ - "tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64", - "tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64", - "tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64", - }); - } - { - const case = ctx.obj("callconv(.Vectorcall) on unsupported platform", .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .none, - }); - case.backend = .stage1; - case.addError( - \\export fn entry() callconv(.Vectorcall) void {} - , &[_][]const u8{ - "tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64", - }); - } - { - const case = ctx.obj("callconv(.APCS, .AAPCS, .AAPCSVFP) on unsupported platform", .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .none, - }); - case.backend = .stage1; - case.addError( - \\export fn entry1() callconv(.APCS) void {} - \\export fn entry2() callconv(.AAPCS) void {} - \\export fn entry3() callconv(.AAPCSVFP) void {} - , &[_][]const u8{ - "tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64", - "tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64", - "tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64", - }); - } - - { - const case = ctx.obj("call with new stack on unsupported target", .{ - .cpu_arch = .wasm32, - .os_tag = .wasi, - .abi = .none, - }); - case.backend = .stage1; - case.addError( - \\var buf: [10]u8 align(16) = undefined; - \\export fn entry() void { - \\ @call(.{.stack = &buf}, foo, .{}); - \\} - \\fn foo() void {} - , &[_][]const u8{ - "tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack", - }); - } - - // Note: One of the error messages here is backwards. It would be nice to fix, but that's not - // going to stop me from merging this branch which fixes a bunch of other stuff. - ctx.objErrStage1("incompatible sentinels", - \\export fn entry1(ptr: [*:255]u8) [*:0]u8 { - \\ return ptr; - \\} - \\export fn entry2(ptr: [*]u8) [*:0]u8 { - \\ return ptr; - \\} - \\export fn entry3() void { - \\ var array: [2:0]u8 = [_:255]u8{1, 2}; - \\ _ = array; - \\} - \\export fn entry4() void { - \\ var array: [2:0]u8 = [_]u8{1, 2}; - \\ _ = array; - \\} - , &[_][]const u8{ - "tmp.zig:2:12: error: expected type '[*:0]u8', found '[*:255]u8'", - "tmp.zig:2:12: note: destination pointer requires a terminating '0' sentinel, but source pointer has a terminating '255' sentinel", - "tmp.zig:5:12: error: expected type '[*:0]u8', found '[*]u8'", - "tmp.zig:5:12: note: destination pointer requires a terminating '0' sentinel", - - "tmp.zig:8:35: error: expected type '[2:255]u8', found '[2:0]u8'", - "tmp.zig:8:35: note: destination array requires a terminating '255' sentinel, but source array has a terminating '0' sentinel", - "tmp.zig:12:31: error: expected type '[2:0]u8', found '[2]u8'", - "tmp.zig:12:31: note: destination array requires a terminating '0' sentinel", - }); - - { - const case = ctx.obj("variable in inline assembly template cannot be found", .{ - .cpu_arch = .x86_64, - .os_tag = .linux, - .abi = .gnu, - }); - case.backend = .stage1; - case.addError( - \\export fn entry() void { - \\ var sp = asm volatile ( - \\ "mov %[foo], sp" - \\ : [bar] "=r" (-> usize) - \\ ); - \\ _ = sp; - \\} - , &[_][]const u8{ - "tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs", - }); - } - - { - const case = ctx.obj("bad alignment in @asyncCall", .{ - .cpu_arch = .aarch64, - .os_tag = .linux, - .abi = .none, - }); - case.backend = .stage1; - case.addError( - \\export fn entry() void { - \\ var ptr: fn () callconv(.Async) void = func; - \\ var bytes: [64]u8 = undefined; - \\ _ = @asyncCall(&bytes, {}, ptr, .{}); - \\} - \\fn func() callconv(.Async) void {} - , &[_][]const u8{ - "tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8'", - }); - } - - if (builtin.os.tag == .linux) { - ctx.testErrStage1("implicit dependency on libc", - \\extern "c" fn exit(u8) void; - \\export fn entry() void { - \\ exit(0); - \\} - , &[_][]const u8{ - "tmp.zig:3:5: error: dependency on libc must be explicitly specified in the build command", - }); - - ctx.testErrStage1("libc headers note", - \\const c = @cImport(@cInclude("stdio.h")); - \\export fn entry() void { - \\ _ = c.printf("hello, world!\n"); - \\} - , &[_][]const u8{ - "tmp.zig:1:11: error: C import failed", - "tmp.zig:1:11: note: libc headers not available; compilation does not link against libc", - }); - } - { const case = ctx.obj("wrong same named struct", .{}); case.backend = .stage1; @@ -366,21 +165,4 @@ pub fn addCases(ctx: *TestContext) !void { //, &[_][]const u8{ // "tmp.zig:4:1: error: unable to inline function", //}); - - { - const case = ctx.obj("align(N) expr function pointers is a compile error", .{ - .cpu_arch = .wasm32, - .os_tag = .freestanding, - .abi = .none, - }); - case.backend = .stage1; - - case.addError( - \\export fn foo() align(1) void { - \\ return; - \\} - , &[_][]const u8{ - "tmp.zig:1:23: error: align(N) expr is not allowed on function prototypes in wasm32/wasm64", - }); - } } diff --git a/test/compile_errors/stage1/exe/main_missing_name.zig b/test/compile_errors/stage1/exe/main_missing_name.zig index c029665367f5e7d6c4c4ee222f362fedcdff83b8..1a53e43cfba2967b5cda0210b92a51714634339d 100644 --- a/test/compile_errors/stage1/exe/main_missing_name.zig +++ b/test/compile_errors/stage1/exe/main_missing_name.zig @@ -1,5 +1,8 @@ pub fn (main) void {} -// main missing name +// error +// backend=stage1 +// target=native +// output_mode=Exe // // tmp.zig:1:5: error: missing function name diff --git a/test/compile_errors/stage1/exe/missing_main_fn_in_executable.zig b/test/compile_errors/stage1/exe/missing_main_fn_in_executable.zig index eb9ab469fd7205f969eacdb5d4014bac6d142312..65813abac32cf8541b18e12235a16a7cac85f6f0 100644 --- a/test/compile_errors/stage1/exe/missing_main_fn_in_executable.zig +++ b/test/compile_errors/stage1/exe/missing_main_fn_in_executable.zig @@ -1,5 +1,8 @@ -// missing main fn in executable +// error +// backend=stage1 +// target=native +// output_mode=Exe // // error: root source file has no member called 'main' diff --git a/test/compile_errors/stage1/exe/private_main_fn.zig b/test/compile_errors/stage1/exe/private_main_fn.zig index da617899a50f80acdc792e22733a3721e84edaf8..5a178389e8905d908a3b35a79fa872d9db20940e 100644 --- a/test/compile_errors/stage1/exe/private_main_fn.zig +++ b/test/compile_errors/stage1/exe/private_main_fn.zig @@ -1,6 +1,9 @@ fn main() void {} -// private main fn +// error +// backend=stage1 +// target=native +// output_mode=Exe // // error: 'main' is private // tmp.zig:1:1: note: declared here diff --git a/test/compile_errors/stage1/obj/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig b/test/compile_errors/stage1/obj/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig index 24fd0d1b9ffa2efaab1881a04cd6f39543ba1a36..72c58adbd61cc3a505f7b6f69966e60d63095820 100644 --- a/test/compile_errors/stage1/obj/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig +++ b/test/compile_errors/stage1/obj/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig @@ -5,6 +5,8 @@ export fn a() void { _ = t; } -// C pointer pointing to non C ABI compatible type or has align attr +// error +// backend=stage1 +// target=native // // tmp.zig:3:19: error: C pointers cannot point to non-C-ABI-compatible type 'Foo' diff --git a/test/compile_errors/stage1/obj/C_pointer_to_anyopaque.zig b/test/compile_errors/stage1/obj/C_pointer_to_anyopaque.zig index 301299614545d30e5337d4f215d5e125ea946669..36c9789d20f263caa9a96eb2a1fc46fc2fba496c 100644 --- a/test/compile_errors/stage1/obj/C_pointer_to_anyopaque.zig +++ b/test/compile_errors/stage1/obj/C_pointer_to_anyopaque.zig @@ -4,6 +4,8 @@ export fn a() void { _ = y; } -// C pointer to anyopaque +// error +// backend=stage1 +// target=native // // tmp.zig:3:16: error: C pointers cannot point to opaque types diff --git a/test/compile_errors/stage1/obj/Frame_of_generic_function.zig b/test/compile_errors/stage1/obj/Frame_of_generic_function.zig index b9b2280dd7df878abfe44cb469b0d11134f3677e..d90e53eb4683dba5f55a8e99388d04f47aa91390 100644 --- a/test/compile_errors/stage1/obj/Frame_of_generic_function.zig +++ b/test/compile_errors/stage1/obj/Frame_of_generic_function.zig @@ -7,6 +7,8 @@ fn func(comptime T: type) void { _ = x; } -// @Frame() of generic function +// error +// backend=stage1 +// target=native // // tmp.zig:2:16: error: @Frame() of generic function diff --git a/test/compile_errors/stage1/obj/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig b/test/compile_errors/stage1/obj/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig index d01e68e4eb8051456ab847723eaf92fb2df0acf6..e1d498e65f40a2e2583e684186d0f6921cf974ef 100644 --- a/test/compile_errors/stage1/obj/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig +++ b/test/compile_errors/stage1/obj/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig @@ -8,7 +8,9 @@ export fn f2(x: V(4, u32)) V(4, u32) { return -y; } -// Issue #5586: Make unary minus for unsigned types a compile error +// error +// backend=stage1 +// target=native // // tmp.zig:3:12: error: negation of type 'u32' // tmp.zig:8:12: error: negation of type 'u32' diff --git a/test/compile_errors/stage1/obj/Issue_6823_dont_allow_._to_be_followed_by_.zig b/test/compile_errors/stage1/obj/Issue_6823_dont_allow_._to_be_followed_by_.zig index c21df43362be681dcb239ca9cb13dacb5c34db2c..1aa0996ba4d7abacfb09a0aff758cd3bca61424c 100644 --- a/test/compile_errors/stage1/obj/Issue_6823_dont_allow_._to_be_followed_by_.zig +++ b/test/compile_errors/stage1/obj/Issue_6823_dont_allow_._to_be_followed_by_.zig @@ -3,6 +3,8 @@ fn foo() void { _ = sequence; } -// Issue #6823: don't allow .* to be followed by ** +// error +// backend=stage1 +// target=native // // tmp.zig:2:28: error: '.*' cannot be followed by '*'. Are you missing a space? diff --git a/test/compile_errors/stage1/obj/Issue_9165_windows_tcp_server_compilation_error.zig b/test/compile_errors/stage1/obj/Issue_9165_windows_tcp_server_compilation_error.zig index e3b9d4b009ca59e6fe544e5fcf2cd56fad06ad6b..3d150693f556edec171b11cc9f0f851c57336fb2 100644 --- a/test/compile_errors/stage1/obj/Issue_9165_windows_tcp_server_compilation_error.zig +++ b/test/compile_errors/stage1/obj/Issue_9165_windows_tcp_server_compilation_error.zig @@ -9,6 +9,8 @@ pub fn main() !void { } } -// Issue #9165: windows tcp server compilation error +// error +// backend=stage1 +// target=native // // error: Unsupported OS diff --git a/test/compile_errors/stage1/obj/access_non-existent_member_of_error_set.zig b/test/compile_errors/stage1/obj/access_non-existent_member_of_error_set.zig index 42a54b08cd03e459f89f96a55298e858128ee06c..caddf36a8436cd538c181efc3974f34f7812b7a4 100644 --- a/test/compile_errors/stage1/obj/access_non-existent_member_of_error_set.zig +++ b/test/compile_errors/stage1/obj/access_non-existent_member_of_error_set.zig @@ -4,6 +4,8 @@ comptime { _ = z; } -// access non-existent member of error set +// error +// backend=stage1 +// target=native // // tmp.zig:3:18: error: no error named 'Bar' in 'Foo' diff --git a/test/compile_errors/stage1/obj/accessing_runtime_parameter_from_outer_function.zig b/test/compile_errors/stage1/obj/accessing_runtime_parameter_from_outer_function.zig index 68b23c6a43dcbaab1a97a3b05167d440f8ae9626..73a9e94d4428df5a3de41ef013bf99abe4d5b882 100644 --- a/test/compile_errors/stage1/obj/accessing_runtime_parameter_from_outer_function.zig +++ b/test/compile_errors/stage1/obj/accessing_runtime_parameter_from_outer_function.zig @@ -12,7 +12,9 @@ export fn entry() void { _ = x; } -// accessing runtime parameter from outer function +// error +// backend=stage1 +// target=native // // tmp.zig:4:24: error: 'y' not accessible from inner function // tmp.zig:3:28: note: crossed function definition here diff --git a/test/compile_errors/stage1/obj/add_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/add_assign_on_undefined_value.zig index 0076cf1bab658acc1e0643b51988e59fe0e6f1f0..38e4fef81bc124e03c07c0b029c2b2f7e1d6ede0 100644 --- a/test/compile_errors/stage1/obj/add_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/add_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a += a; } -// add assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/add_on_undefined_value.zig b/test/compile_errors/stage1/obj/add_on_undefined_value.zig index 5f64c6999b230dff39b512e262f68ec05e09f866..4a66f9c102ba452512e78a9320bb008b77179a02 100644 --- a/test/compile_errors/stage1/obj/add_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/add_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a + a; } -// add on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/add_overflow_in_function_evaluation.zig b/test/compile_errors/stage1/obj/add_overflow_in_function_evaluation.zig index b01e005a045064d91fe3e3b0070f7d11daf0841e..d4fa312482d942eb5d787956a072635cb674bf26 100644 --- a/test/compile_errors/stage1/obj/add_overflow_in_function_evaluation.zig +++ b/test/compile_errors/stage1/obj/add_overflow_in_function_evaluation.zig @@ -5,6 +5,8 @@ fn add(a: u16, b: u16) u16 { export fn entry() usize { return @sizeOf(@TypeOf(y)); } -// add overflow in function evaluation +// error +// backend=stage1 +// target=native // // tmp.zig:3:14: error: operation caused overflow diff --git a/test/compile_errors/stage1/obj/add_wrap_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/add_wrap_assign_on_undefined_value.zig index 37dbf9106f818d0dc09d55b69f3ceda18ac6d2fd..5f9a4c61fc34d83790db326f1cc925c70c70fe85 100644 --- a/test/compile_errors/stage1/obj/add_wrap_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/add_wrap_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a +%= a; } -// add wrap assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/add_wrap_on_undefined_value.zig b/test/compile_errors/stage1/obj/add_wrap_on_undefined_value.zig index 3ba9bd11c6fdc4927d15812a8e70243b1c052f24..582b8ec1cfc85ff91224f11799f78631c75a2951 100644 --- a/test/compile_errors/stage1/obj/add_wrap_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/add_wrap_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a +% a; } -// add wrap on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/addition_with_non_numbers.zig b/test/compile_errors/stage1/obj/addition_with_non_numbers.zig index 296b9f41039aaead3f06ec95ca2db40d22e198b9..8f343926f281ffa3efb54881f03a5f4bd4b4f87f 100644 --- a/test/compile_errors/stage1/obj/addition_with_non_numbers.zig +++ b/test/compile_errors/stage1/obj/addition_with_non_numbers.zig @@ -5,6 +5,8 @@ const x = Foo {.field = 1} + Foo {.field = 2}; export fn entry() usize { return @sizeOf(@TypeOf(x)); } -// addition with non numbers +// error +// backend=stage1 +// target=native // // tmp.zig:4:28: error: invalid operands to binary expression: 'Foo' and 'Foo' diff --git a/test/compile_errors/stage1/obj/address_of_number_literal.zig b/test/compile_errors/stage1/obj/address_of_number_literal.zig index ee61f2180fb3afd3031cc7df897636befb08955e..76d321929d9863e9d2ac1a8fece85e4d12ad2d72 100644 --- a/test/compile_errors/stage1/obj/address_of_number_literal.zig +++ b/test/compile_errors/stage1/obj/address_of_number_literal.zig @@ -3,6 +3,8 @@ const y = &x; fn foo() *const i32 { return y; } export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// address of number literal +// error +// backend=stage1 +// target=native // // tmp.zig:3:30: error: expected type '*const i32', found '*const comptime_int' diff --git a/test/compile_errors/stage1/obj/alignCast_expects_pointer_or_slice.zig b/test/compile_errors/stage1/obj/alignCast_expects_pointer_or_slice.zig index 91b269cef42fcf5a8ebb754e927989cf71cc8828..9f76d3ca4fff45a35b9c12c30ba95260f50a9702 100644 --- a/test/compile_errors/stage1/obj/alignCast_expects_pointer_or_slice.zig +++ b/test/compile_errors/stage1/obj/alignCast_expects_pointer_or_slice.zig @@ -2,6 +2,8 @@ export fn entry() void { @alignCast(4, @as(u32, 3)); } -// @alignCast expects pointer or slice +// error +// backend=stage1 +// target=native // // tmp.zig:2:19: error: expected pointer or slice, found 'u32' diff --git a/test/compile_errors/stage1/obj/align_n_expr_function_pointers_is_a_compile_error.zig b/test/compile_errors/stage1/obj/align_n_expr_function_pointers_is_a_compile_error.zig new file mode 100644 index 0000000000000000000000000000000000000000..bd41b3e6574b317af3c5e0c1554b8bf39533f7bd --- /dev/null +++ b/test/compile_errors/stage1/obj/align_n_expr_function_pointers_is_a_compile_error.zig @@ -0,0 +1,9 @@ +export fn foo() align(1) void { + return; +} + +// error +// backend=stage1 +// target=wasm32-freestanding-none +// +// tmp.zig:1:23: error: align(N) expr is not allowed on function prototypes in wasm32/wasm64 diff --git a/test/compile_errors/stage1/obj/aligned_variable_of_zero-bit_type.zig b/test/compile_errors/stage1/obj/aligned_variable_of_zero-bit_type.zig index 90e690056d6ad5f855107a4dc3db5e1d9e5fe9e4..f09f92aca782d98925abbe67f50ae573cbce32e0 100644 --- a/test/compile_errors/stage1/obj/aligned_variable_of_zero-bit_type.zig +++ b/test/compile_errors/stage1/obj/aligned_variable_of_zero-bit_type.zig @@ -3,6 +3,8 @@ export fn f() void { _ = s; } -// aligned variable of zero-bit type +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned diff --git a/test/compile_errors/stage1/obj/alignment_of_enum_field_specified.zig b/test/compile_errors/stage1/obj/alignment_of_enum_field_specified.zig index cf5cdfd2134ea31230024a2c557de5410d4f51b9..9b6f1e452d2dd76f36ecf750d232ae9a07ec0e3f 100644 --- a/test/compile_errors/stage1/obj/alignment_of_enum_field_specified.zig +++ b/test/compile_errors/stage1/obj/alignment_of_enum_field_specified.zig @@ -7,6 +7,8 @@ export fn entry1() void { _ = x; } -// alignment of enum field specified +// error +// backend=stage1 +// target=native // // tmp.zig:3:7: error: expected ',' after field diff --git a/test/compile_errors/stage1/obj/ambiguous_decl_reference.zig b/test/compile_errors/stage1/obj/ambiguous_decl_reference.zig index 421c41d2c23eb67601c04e716f00b627ac16e772..82e6a0a24cadfc2539c66dcc54f07691d6c9815d 100644 --- a/test/compile_errors/stage1/obj/ambiguous_decl_reference.zig +++ b/test/compile_errors/stage1/obj/ambiguous_decl_reference.zig @@ -12,7 +12,9 @@ export fn entry() void { bar(); } -// ambiguous decl reference +// error +// backend=stage1 +// target=native // // tmp.zig:5:13: error: ambiguous reference // tmp.zig:7:9: note: declared here diff --git a/test/compile_errors/stage1/obj/and_on_undefined_value.zig b/test/compile_errors/stage1/obj/and_on_undefined_value.zig index 82363848f3f9917f4849a8117e7eb029c318450c..6071d81062fcc32291a7673bcb6e2877ea7d3358 100644 --- a/test/compile_errors/stage1/obj/and_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/and_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a and a; } -// and on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/array_access_of_non_array.zig b/test/compile_errors/stage1/obj/array_access_of_non_array.zig index e4420debcd044ab6792e183977f77742bd94083a..7045f2fdbd304867e7e52ce889c7f69212923e74 100644 --- a/test/compile_errors/stage1/obj/array_access_of_non_array.zig +++ b/test/compile_errors/stage1/obj/array_access_of_non_array.zig @@ -7,7 +7,9 @@ export fn g() void { _ = bad[0]; } -// array access of non array +// error +// backend=stage1 +// target=native // // tmp.zig:3:8: error: array access of non-array type 'bool' // tmp.zig:7:12: error: array access of non-array type 'bool' diff --git a/test/compile_errors/stage1/obj/array_access_of_type.zig b/test/compile_errors/stage1/obj/array_access_of_type.zig index 82708eed6c1c168bd18762162274733b04168a2c..c0029f24924ee24368470c500f05d2b66e26d233 100644 --- a/test/compile_errors/stage1/obj/array_access_of_type.zig +++ b/test/compile_errors/stage1/obj/array_access_of_type.zig @@ -3,6 +3,8 @@ export fn foo() void { _ = b; } -// array access of type +// error +// backend=stage1 +// target=native // // tmp.zig:2:14: error: array access of non-array type 'type' diff --git a/test/compile_errors/stage1/obj/array_access_of_undeclared_identifier.zig b/test/compile_errors/stage1/obj/array_access_of_undeclared_identifier.zig index 193a7bf5de00b9da5aa6abd3899b4a3f606fc660..7d16a0d60e6d9465bba265454034a66a67e2dac0 100644 --- a/test/compile_errors/stage1/obj/array_access_of_undeclared_identifier.zig +++ b/test/compile_errors/stage1/obj/array_access_of_undeclared_identifier.zig @@ -2,6 +2,8 @@ export fn f() void { i[i] = i[i]; } -// array access of undeclared identifier +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: use of undeclared identifier 'i' diff --git a/test/compile_errors/stage1/obj/array_access_with_non_integer_index.zig b/test/compile_errors/stage1/obj/array_access_with_non_integer_index.zig index 1a3e17d8964005e9d3a481fd9d7c4d9d749ce19d..de0a58656c5789a4f3689cf0a9a7eeed41a6fd26 100644 --- a/test/compile_errors/stage1/obj/array_access_with_non_integer_index.zig +++ b/test/compile_errors/stage1/obj/array_access_with_non_integer_index.zig @@ -9,7 +9,9 @@ export fn g() void { _ = array[bad]; } -// array access with non integer index +// error +// backend=stage1 +// target=native // // tmp.zig:4:11: error: expected type 'usize', found 'bool' // tmp.zig:9:15: error: expected type 'usize', found 'bool' diff --git a/test/compile_errors/stage1/obj/array_concatenation_with_wrong_type.zig b/test/compile_errors/stage1/obj/array_concatenation_with_wrong_type.zig index 91036e5f254b97cf0a5596f042e582a861ed3d64..ccddc7efbd5b2b37ba81375cad57fda646d78988 100644 --- a/test/compile_errors/stage1/obj/array_concatenation_with_wrong_type.zig +++ b/test/compile_errors/stage1/obj/array_concatenation_with_wrong_type.zig @@ -4,6 +4,8 @@ const a = derp ++ "foo"; export fn entry() usize { return @sizeOf(@TypeOf(a)); } -// array concatenation with wrong type +// error +// backend=stage1 +// target=native // // tmp.zig:3:11: error: expected array, found 'usize' diff --git a/test/compile_errors/stage1/obj/array_in_c_exported_function.zig b/test/compile_errors/stage1/obj/array_in_c_exported_function.zig index fe03d220b1771bce73a2ac82a9635f9c4835d381..5137755474a6ed7bcfa530a6463232db78a9142f 100644 --- a/test/compile_errors/stage1/obj/array_in_c_exported_function.zig +++ b/test/compile_errors/stage1/obj/array_in_c_exported_function.zig @@ -6,7 +6,9 @@ export fn zig_return_array() [10]u8 { return "1234567890".*; } -// array in c exported function +// error +// backend=stage1 +// target=native // // tmp.zig:1:24: error: parameter of type '[10]u8' not allowed in function with calling convention 'C' // tmp.zig:5:30: error: return type '[10]u8' not allowed in function with calling convention 'C' diff --git a/test/compile_errors/stage1/obj/asm_at_compile_time.zig b/test/compile_errors/stage1/obj/asm_at_compile_time.zig index e08b500c6e07515caee4c27d451b02e9bf41f1f2..fcfd5e7da6b1df490029c1f9e6213d3dc90ab6d1 100644 --- a/test/compile_errors/stage1/obj/asm_at_compile_time.zig +++ b/test/compile_errors/stage1/obj/asm_at_compile_time.zig @@ -10,6 +10,8 @@ fn doSomeAsm() void { ); } -// asm at compile time +// error +// backend=stage1 +// target=native // // tmp.zig:6:5: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/assign_inline_fn_to_non-comptime_var.zig b/test/compile_errors/stage1/obj/assign_inline_fn_to_non-comptime_var.zig index aa7bb91d1b0c42e72c48ee179a8664350dc751b8..7714bb728293133efdcad1c65208995d8d81b8a1 100644 --- a/test/compile_errors/stage1/obj/assign_inline_fn_to_non-comptime_var.zig +++ b/test/compile_errors/stage1/obj/assign_inline_fn_to_non-comptime_var.zig @@ -4,7 +4,9 @@ export fn entry() void { } fn b() callconv(.Inline) void { } -// assign inline fn to non-comptime var +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var // tmp.zig:5:1: note: declared here diff --git a/test/compile_errors/stage1/obj/assign_null_to_non-optional_pointer.zig b/test/compile_errors/stage1/obj/assign_null_to_non-optional_pointer.zig index 9c1aaf5031a30ef09476ac3e1c42286ffb615f34..110d6c26299e260fc40c5e5d329e34f5048a0eb3 100644 --- a/test/compile_errors/stage1/obj/assign_null_to_non-optional_pointer.zig +++ b/test/compile_errors/stage1/obj/assign_null_to_non-optional_pointer.zig @@ -2,6 +2,8 @@ const a: *u8 = null; export fn entry() usize { return @sizeOf(@TypeOf(a)); } -// assign null to non-optional pointer +// error +// backend=stage1 +// target=native // // tmp.zig:1:16: error: expected type '*u8', found '@Type(.Null)' diff --git a/test/compile_errors/stage1/obj/assign_through_constant_pointer.zig b/test/compile_errors/stage1/obj/assign_through_constant_pointer.zig index 452e3ea617ea2b753edcbac8896bc385a8923269..69ba383843554e341ea9ec8263217d351cf38c5d 100644 --- a/test/compile_errors/stage1/obj/assign_through_constant_pointer.zig +++ b/test/compile_errors/stage1/obj/assign_through_constant_pointer.zig @@ -3,6 +3,8 @@ export fn f() void { cstr[0] = 'W'; } -// assign through constant pointer +// error +// backend=stage1 +// target=native // // tmp.zig:3:13: error: cannot assign to constant diff --git a/test/compile_errors/stage1/obj/assign_through_constant_slice.zig b/test/compile_errors/stage1/obj/assign_through_constant_slice.zig index e36991897bce00ddd20c6f6847bc67324044be8b..55d2e7e7c7f6dd134a93d02a8a13f96e8db8e68a 100644 --- a/test/compile_errors/stage1/obj/assign_through_constant_slice.zig +++ b/test/compile_errors/stage1/obj/assign_through_constant_slice.zig @@ -3,6 +3,8 @@ export fn f() void { cstr[0] = 'W'; } -// assign through constant slice +// error +// backend=stage1 +// target=native // // tmp.zig:3:13: error: cannot assign to constant diff --git a/test/compile_errors/stage1/obj/assign_to_constant_field.zig b/test/compile_errors/stage1/obj/assign_to_constant_field.zig index f371655fb5f4eced27e6805bbdd899842a8e8d52..610818118ae0c203106f0c41232525a70d9ca70b 100644 --- a/test/compile_errors/stage1/obj/assign_to_constant_field.zig +++ b/test/compile_errors/stage1/obj/assign_to_constant_field.zig @@ -6,6 +6,8 @@ export fn derp() void { f.field = 0; } -// assign to constant field +// error +// backend=stage1 +// target=native // // tmp.zig:6:15: error: cannot assign to constant diff --git a/test/compile_errors/stage1/obj/assign_to_constant_variable.zig b/test/compile_errors/stage1/obj/assign_to_constant_variable.zig index 1e8dd6c06fd48632443a889adbea552c56e1e555..531f669c1aa4af7b066b112aef22547d104c0698 100644 --- a/test/compile_errors/stage1/obj/assign_to_constant_variable.zig +++ b/test/compile_errors/stage1/obj/assign_to_constant_variable.zig @@ -3,6 +3,8 @@ export fn f() void { a = 4; } -// assign to constant variable +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: cannot assign to constant diff --git a/test/compile_errors/stage1/obj/assign_to_invalid_dereference.zig b/test/compile_errors/stage1/obj/assign_to_invalid_dereference.zig index 6466f7afc85daabea743b43db9246c9fd8c2d7de..7fef5db83c33e930d40686158e122b081a9c9121 100644 --- a/test/compile_errors/stage1/obj/assign_to_invalid_dereference.zig +++ b/test/compile_errors/stage1/obj/assign_to_invalid_dereference.zig @@ -2,6 +2,8 @@ export fn entry() void { 'a'.* = 1; } -// assign to invalid dereference +// error +// backend=stage1 +// target=native // // tmp.zig:2:8: error: attempt to dereference non-pointer type 'comptime_int' diff --git a/test/compile_errors/stage1/obj/assign_too_big_number_to_u16.zig b/test/compile_errors/stage1/obj/assign_too_big_number_to_u16.zig index 13b5280588374fb749c09bfb24e1ee19aa43c791..3138ed5faf7169849afeee1fb37ec6543aad39c2 100644 --- a/test/compile_errors/stage1/obj/assign_too_big_number_to_u16.zig +++ b/test/compile_errors/stage1/obj/assign_too_big_number_to_u16.zig @@ -3,6 +3,8 @@ export fn foo() void { _ = vga_mem; } -// assign too big number to u16 +// error +// backend=stage1 +// target=native // // tmp.zig:2:24: error: integer value 753664 cannot be coerced to type 'u16' diff --git a/test/compile_errors/stage1/obj/assign_unreachable.zig b/test/compile_errors/stage1/obj/assign_unreachable.zig index 78e2305abcc6f6af1f32d898c46392447caf3d57..f87adcd9942298fa9130ce2f91be392d92db90b2 100644 --- a/test/compile_errors/stage1/obj/assign_unreachable.zig +++ b/test/compile_errors/stage1/obj/assign_unreachable.zig @@ -2,7 +2,9 @@ export fn f() void { const a = return; } -// assign unreachable +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: unreachable code // tmp.zig:2:15: note: control flow is diverted here diff --git a/test/compile_errors/stage1/obj/assigning_to_struct_or_union_fields_that_are_not_optionals_with_a_function_that_returns_an_optional.zig b/test/compile_errors/stage1/obj/assigning_to_struct_or_union_fields_that_are_not_optionals_with_a_function_that_returns_an_optional.zig index f93650821b8ff9563ec0f301512aabaa3022402c..8285991c05e042fd12132177640690ca176f8d6f 100644 --- a/test/compile_errors/stage1/obj/assigning_to_struct_or_union_fields_that_are_not_optionals_with_a_function_that_returns_an_optional.zig +++ b/test/compile_errors/stage1/obj/assigning_to_struct_or_union_fields_that_are_not_optionals_with_a_function_that_returns_an_optional.zig @@ -14,6 +14,8 @@ export fn entry() void { _ = s; } -// assigning to struct or union fields that are not optionals with a function that returns an optional +// error +// backend=stage1 +// target=native // // tmp.zig:11:27: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'u8', found '?u8' diff --git a/test/compile_errors/stage1/obj/async_function_depends_on_its_own_frame.zig b/test/compile_errors/stage1/obj/async_function_depends_on_its_own_frame.zig index 0d1cd7f77ef06d5234777358ba97557e4fd5ba1c..4dde5860bafc4709d376e1703df95b14ce58420f 100644 --- a/test/compile_errors/stage1/obj/async_function_depends_on_its_own_frame.zig +++ b/test/compile_errors/stage1/obj/async_function_depends_on_its_own_frame.zig @@ -6,6 +6,8 @@ fn amain() callconv(.Async) void { _ = x; } -// async function depends on its own frame +// error +// backend=stage1 +// target=native // // tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet diff --git a/test/compile_errors/stage1/obj/async_function_indirectly_depends_on_its_own_frame.zig b/test/compile_errors/stage1/obj/async_function_indirectly_depends_on_its_own_frame.zig index 809409f524eee657da7193740ec3253817d7b845..4dac0d4fa33fbc45db20184af0c0734552b9df81 100644 --- a/test/compile_errors/stage1/obj/async_function_indirectly_depends_on_its_own_frame.zig +++ b/test/compile_errors/stage1/obj/async_function_indirectly_depends_on_its_own_frame.zig @@ -9,7 +9,9 @@ fn other() void { _ = x; } -// async function indirectly depends on its own frame +// error +// backend=stage1 +// target=native // // tmp.zig:4:1: error: unable to determine async function frame of 'amain' // tmp.zig:5:10: note: analysis of function 'other' depends on the frame diff --git a/test/compile_errors/stage1/obj/atomic_orderings_of_atomicStore_Acquire_or_AcqRel.zig b/test/compile_errors/stage1/obj/atomic_orderings_of_atomicStore_Acquire_or_AcqRel.zig index 7d97c2813e5e78e0bb66a641033dcc96bd4340f7..dfc7ff5036871218e35687d4ee5c4e9d54282aed 100644 --- a/test/compile_errors/stage1/obj/atomic_orderings_of_atomicStore_Acquire_or_AcqRel.zig +++ b/test/compile_errors/stage1/obj/atomic_orderings_of_atomicStore_Acquire_or_AcqRel.zig @@ -3,6 +3,8 @@ export fn entry() void { @atomicStore(u32, &x, 1, .Acquire); } -// atomic orderings of atomicStore Acquire or AcqRel +// error +// backend=stage1 +// target=native // // tmp.zig:3:30: error: @atomicStore atomic ordering must not be Acquire or AcqRel diff --git a/test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-failure_stricter_than_success.zig b/test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-failure_stricter_than_success.zig index d6d9ab478b72da757866c4c686c0601f8f51b882..929950e754ed419589dc91c2056c684a8f5c5c07 100644 --- a/test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-failure_stricter_than_success.zig +++ b/test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-failure_stricter_than_success.zig @@ -4,6 +4,8 @@ export fn f() void { while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {} } -// atomic orderings of cmpxchg - failure stricter than success +// error +// backend=stage1 +// target=native // // tmp.zig:4:81: error: failure atomic ordering must be no stricter than success diff --git a/test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-success_Monotonic_or_stricter.zig b/test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-success_Monotonic_or_stricter.zig index 770c08f3fe0089245469ff284207c477ca7ff528..fe3344e53664537243ba930ca72069af4011bc14 100644 --- a/test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-success_Monotonic_or_stricter.zig +++ b/test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-success_Monotonic_or_stricter.zig @@ -4,6 +4,8 @@ export fn f() void { while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {} } -// atomic orderings of cmpxchg - success Monotonic or stricter +// error +// backend=stage1 +// target=native // // tmp.zig:4:58: error: success atomic ordering must be Monotonic or stricter diff --git a/test/compile_errors/stage1/obj/atomic_orderings_of_fence_Acquire_or_stricter.zig b/test/compile_errors/stage1/obj/atomic_orderings_of_fence_Acquire_or_stricter.zig index 34ee200eeb2aeb1dcffa4da556c8d7028387300d..8a01871a80ce34c31d290bea280ff8f98fc0f33e 100644 --- a/test/compile_errors/stage1/obj/atomic_orderings_of_fence_Acquire_or_stricter.zig +++ b/test/compile_errors/stage1/obj/atomic_orderings_of_fence_Acquire_or_stricter.zig @@ -2,6 +2,8 @@ export fn entry() void { @fence(.Monotonic); } -// atomic orderings of fence Acquire or stricter +// error +// backend=stage1 +// target=native // // tmp.zig:2:12: error: atomic ordering must be Acquire or stricter diff --git a/test/compile_errors/stage1/obj/atomicrmw_with_bool_op_not_.Xchg.zig b/test/compile_errors/stage1/obj/atomicrmw_with_bool_op_not_.Xchg.zig index 03309737cff565887bc869d64d80a01b44b15389..0b5b0cd3c1ecfa6a7250928ff8291dcfc70fd734 100644 --- a/test/compile_errors/stage1/obj/atomicrmw_with_bool_op_not_.Xchg.zig +++ b/test/compile_errors/stage1/obj/atomicrmw_with_bool_op_not_.Xchg.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = @atomicRmw(bool, &x, .Add, true, .SeqCst); } -// atomicrmw with bool op not .Xchg +// error +// backend=stage1 +// target=native // // tmp.zig:3:30: error: @atomicRmw with bool only allowed with .Xchg diff --git a/test/compile_errors/stage1/obj/atomicrmw_with_enum_op_not_.Xchg.zig b/test/compile_errors/stage1/obj/atomicrmw_with_enum_op_not_.Xchg.zig index 95e6a7d95d7f16f7787d745ce00197f6d122ac39..adbf4ca45e8d073fa381f8e3f32243b57da5ba03 100644 --- a/test/compile_errors/stage1/obj/atomicrmw_with_enum_op_not_.Xchg.zig +++ b/test/compile_errors/stage1/obj/atomicrmw_with_enum_op_not_.Xchg.zig @@ -9,6 +9,8 @@ export fn entry() void { _ = @atomicRmw(E, &x, .Add, .b, .SeqCst); } -// atomicrmw with enum op not .Xchg +// error +// backend=stage1 +// target=native // // tmp.zig:9:27: error: @atomicRmw with enum only allowed with .Xchg diff --git a/test/compile_errors/stage1/obj/atomicrmw_with_float_op_not_.Xchg_.Add_or_.Sub.zig b/test/compile_errors/stage1/obj/atomicrmw_with_float_op_not_.Xchg_.Add_or_.Sub.zig index a7359dbf32494be1574276704e67b74190073c2d..4f3ebfcef6af9293418aa92edb8290127f5b3726 100644 --- a/test/compile_errors/stage1/obj/atomicrmw_with_float_op_not_.Xchg_.Add_or_.Sub.zig +++ b/test/compile_errors/stage1/obj/atomicrmw_with_float_op_not_.Xchg_.Add_or_.Sub.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = @atomicRmw(f32, &x, .And, 2, .SeqCst); } -// atomicrmw with float op not .Xchg, .Add or .Sub +// error +// backend=stage1 +// target=native // // tmp.zig:3:29: error: @atomicRmw with float only allowed with .Xchg, .Add and .Sub diff --git a/test/compile_errors/stage1/obj/attempt_to_cast_enum_literal_to_error.zig b/test/compile_errors/stage1/obj/attempt_to_cast_enum_literal_to_error.zig index fd120af3eb74b6841515715d899acac57d699dee..f1c30815fca0dfce8bea8128e6a15bfbf983a243 100644 --- a/test/compile_errors/stage1/obj/attempt_to_cast_enum_literal_to_error.zig +++ b/test/compile_errors/stage1/obj/attempt_to_cast_enum_literal_to_error.zig @@ -4,6 +4,8 @@ export fn entry() void { } } -// attempt to cast enum literal to error +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: expected type 'error{Hi}', found '@Type(.EnumLiteral)' diff --git a/test/compile_errors/stage1/obj/attempt_to_close_over_comptime_variable_from_outer_scope.zig b/test/compile_errors/stage1/obj/attempt_to_close_over_comptime_variable_from_outer_scope.zig index 5eb5db3dc8826a503c61cc2c158beed6d89e06ad..58eb9d19d20f03b16a30f252c953b818bfa6e77b 100644 --- a/test/compile_errors/stage1/obj/attempt_to_close_over_comptime_variable_from_outer_scope.zig +++ b/test/compile_errors/stage1/obj/attempt_to_close_over_comptime_variable_from_outer_scope.zig @@ -5,7 +5,9 @@ fn SimpleList(comptime L: usize) type { }; } -// attempt to close over comptime variable from outer scope +// error +// backend=stage1 +// target=native // // tmp.zig:4:19: error: mutable 'T' not accessible from here // tmp.zig:2:9: note: declared mutable here diff --git a/test/compile_errors/stage1/obj/attempt_to_create_17_bit_float_type.zig b/test/compile_errors/stage1/obj/attempt_to_create_17_bit_float_type.zig index bdea578696fd794481727c764631278770ed4678..ba7393fcb76d8f003bc81feb2348b94290dc58e8 100644 --- a/test/compile_errors/stage1/obj/attempt_to_create_17_bit_float_type.zig +++ b/test/compile_errors/stage1/obj/attempt_to_create_17_bit_float_type.zig @@ -3,6 +3,8 @@ comptime { _ = @Type(.{ .Float = .{ .bits = 17 } }); } -// attempt to create 17 bit float type +// error +// backend=stage1 +// target=native // // tmp.zig:3:16: error: 17-bit float unsupported diff --git a/test/compile_errors/stage1/obj/attempt_to_negate_a_non-integer_non-float_or_non-vector_type.zig b/test/compile_errors/stage1/obj/attempt_to_negate_a_non-integer_non-float_or_non-vector_type.zig index 00ee26033d9058ac3181483086f6a5c72a09dfa6..e9bbf921aba193bbdb74c01d65ecd6bd57f8a858 100644 --- a/test/compile_errors/stage1/obj/attempt_to_negate_a_non-integer_non-float_or_non-vector_type.zig +++ b/test/compile_errors/stage1/obj/attempt_to_negate_a_non-integer_non-float_or_non-vector_type.zig @@ -7,6 +7,8 @@ export fn entry() void { _ = x; } -// attempt to negate a non-integer, non-float or non-vector type +// error +// backend=stage1 +// target=native // // tmp.zig:6:15: error: negation of type 'anyerror!u32' diff --git a/test/compile_errors/stage1/obj/attempt_to_use_0_bit_type_in_extern_fn.zig b/test/compile_errors/stage1/obj/attempt_to_use_0_bit_type_in_extern_fn.zig index d7767e25e973b82e866bf7598d591aa888ca7e4e..021cd97f190493043b72f1aa12338e5c4b5b2cc2 100644 --- a/test/compile_errors/stage1/obj/attempt_to_use_0_bit_type_in_extern_fn.zig +++ b/test/compile_errors/stage1/obj/attempt_to_use_0_bit_type_in_extern_fn.zig @@ -9,7 +9,9 @@ export fn entry2() void { bar(&{}); } -// attempt to use 0 bit type in extern fn +// error +// backend=stage1 +// target=native // // tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C' // tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C' diff --git a/test/compile_errors/stage1/obj/attempted_double_ampersand.zig b/test/compile_errors/stage1/obj/attempted_double_ampersand.zig index cc92bc2fae4b27dbcd3efabfec0e301e30130c32..c749b172c6541a3db255aebc0d2f26f1dd62c70a 100644 --- a/test/compile_errors/stage1/obj/attempted_double_ampersand.zig +++ b/test/compile_errors/stage1/obj/attempted_double_ampersand.zig @@ -5,6 +5,8 @@ export fn entry(a: bool, b: bool) i32 { return 5678; } -// attempted `&&` +// error +// backend=stage1 +// target=native // // tmp.zig:2:11: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND diff --git a/test/compile_errors/stage1/obj/attempted_double_pipe_on_boolean_values.zig b/test/compile_errors/stage1/obj/attempted_double_pipe_on_boolean_values.zig index 8e67b4950dd1a924d4ded33f6e24caa763f4e26d..b991b1b61b5c603779d53d63c0b9afabd6006b8e 100644 --- a/test/compile_errors/stage1/obj/attempted_double_pipe_on_boolean_values.zig +++ b/test/compile_errors/stage1/obj/attempted_double_pipe_on_boolean_values.zig @@ -5,7 +5,9 @@ export fn entry(a: bool, b: bool) i32 { return 5678; } -// attempted `||` on boolean values +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: expected error set type, found 'bool' // tmp.zig:2:11: note: `||` merges error sets; `or` performs boolean OR diff --git a/test/compile_errors/stage1/obj/attempted_implicit_cast_from_T_to_slice_const_T.zig b/test/compile_errors/stage1/obj/attempted_implicit_cast_from_T_to_slice_const_T.zig index 4776104928b648d18c12a780e64cb11e08170b6a..c3b0847129cdd4de1f4525e676ffb0fce2b40d9d 100644 --- a/test/compile_errors/stage1/obj/attempted_implicit_cast_from_T_to_slice_const_T.zig +++ b/test/compile_errors/stage1/obj/attempted_implicit_cast_from_T_to_slice_const_T.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// attempted implicit cast from T to [*]const T +// error +// backend=stage1 +// target=native // // tmp.zig:2:30: error: expected type '[*]const bool', found 'bool' diff --git a/test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_array_len_1_T.zig b/test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_array_len_1_T.zig index d389c572ca100700d6d2569c3bd8155fe8948ec4..760866dd651acbf6c48e91bfe5665825e01c1634 100644 --- a/test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_array_len_1_T.zig +++ b/test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_array_len_1_T.zig @@ -6,7 +6,9 @@ export fn entry(byte: u8) void { _ = byte; } -// attempted implicit cast from *const T to *[1]T +// error +// backend=stage1 +// target=native // // tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32' // tmp.zig:4:22: note: cast discards const qualifier diff --git a/test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_sliceT.zig b/test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_sliceT.zig index 70d1cbece21b376d0a67f4a811b5ed49b1b8c331..3ff9937983279a8a54947cea711bd3afcea56a84 100644 --- a/test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_sliceT.zig +++ b/test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_sliceT.zig @@ -4,6 +4,8 @@ export fn entry() void { _ = x; } -// attempted implicit cast from *const T to []T +// error +// backend=stage1 +// target=native // // tmp.zig:3:23: error: expected type '[]u32', found '*const u32' diff --git a/test/compile_errors/stage1/obj/bad_alignCast_at_comptime.zig b/test/compile_errors/stage1/obj/bad_alignCast_at_comptime.zig index 7396dfc4dd4658c351df5384bdf96e7b15817545..f1ed25e19168d8e4c890e806ef5b6d30d2995494 100644 --- a/test/compile_errors/stage1/obj/bad_alignCast_at_comptime.zig +++ b/test/compile_errors/stage1/obj/bad_alignCast_at_comptime.zig @@ -4,6 +4,8 @@ comptime { _ = aligned; } -// bad @alignCast at comptime +// error +// backend=stage1 +// target=native // // tmp.zig:3:35: error: pointer address 0x1 is not aligned to 4 bytes diff --git a/test/compile_errors/stage1/obj/bad_alignment_in_asynccall.zig b/test/compile_errors/stage1/obj/bad_alignment_in_asynccall.zig new file mode 100644 index 0000000000000000000000000000000000000000..399914000994b76b44c91e8200b74dafcd7aa1be --- /dev/null +++ b/test/compile_errors/stage1/obj/bad_alignment_in_asynccall.zig @@ -0,0 +1,12 @@ +export fn entry() void { + var ptr: fn () callconv(.Async) void = func; + var bytes: [64]u8 = undefined; + _ = @asyncCall(&bytes, {}, ptr, .{}); +} +fn func() callconv(.Async) void {} + +// error +// backend=stage1 +// target=aarch64-linux-none +// +// tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8' diff --git a/test/compile_errors/stage1/obj/bad_alignment_in_implicit_cast_from_array_pointer_to_slice.zig b/test/compile_errors/stage1/obj/bad_alignment_in_implicit_cast_from_array_pointer_to_slice.zig index ecfc5523d0431a58c5a2119c72e01cefa33ec8c5..12064bd9ab0b6b4e8c3f6789bf091d5f12721463 100644 --- a/test/compile_errors/stage1/obj/bad_alignment_in_implicit_cast_from_array_pointer_to_slice.zig +++ b/test/compile_errors/stage1/obj/bad_alignment_in_implicit_cast_from_array_pointer_to_slice.zig @@ -4,6 +4,8 @@ export fn a() void { _ = y; } -// bad alignment in implicit cast from array pointer to slice +// error +// backend=stage1 +// target=native // // tmp.zig:3:30: error: expected type '[]align(16) u8', found '*[10]u8' diff --git a/test/compile_errors/stage1/obj/bad_alignment_type.zig b/test/compile_errors/stage1/obj/bad_alignment_type.zig index 902ffc79d694620045c571d25be6c25cce4d3010..a4d8b7d68f6cceca709cb5b93d3b7677e4cb7d7d 100644 --- a/test/compile_errors/stage1/obj/bad_alignment_type.zig +++ b/test/compile_errors/stage1/obj/bad_alignment_type.zig @@ -7,7 +7,9 @@ export fn entry2() void { _ = x; } -// bad alignment type +// error +// backend=stage1 +// target=native // // tmp.zig:2:20: error: expected type 'u29', found 'bool' // tmp.zig:6:19: error: fractional component prevents float value 12.340000 from being casted to type 'u29' diff --git a/test/compile_errors/stage1/obj/bad_identifier_in_function_with_struct_defined_inside_function_which_references_local_const.zig b/test/compile_errors/stage1/obj/bad_identifier_in_function_with_struct_defined_inside_function_which_references_local_const.zig index f32301f9ff4e18a48a15a43ed49974e66ce927e9..7e44ad5057cc67a71b976c538150574f42cb177f 100644 --- a/test/compile_errors/stage1/obj/bad_identifier_in_function_with_struct_defined_inside_function_which_references_local_const.zig +++ b/test/compile_errors/stage1/obj/bad_identifier_in_function_with_struct_defined_inside_function_which_references_local_const.zig @@ -10,6 +10,8 @@ export fn entry() void { _ = Block; } -// bad identifier in function with struct defined inside function which references local const +// error +// backend=stage1 +// target=native // // tmp.zig:8:5: error: use of undeclared identifier 'bogus' diff --git a/test/compile_errors/stage1/obj/bad_import.zig b/test/compile_errors/stage1/obj/bad_import.zig index f6e93559b2446ffe3de8a82fc746c42a20fddb58..1a7ab5f00b78f479da870f6009dbdea06dc2a4b3 100644 --- a/test/compile_errors/stage1/obj/bad_import.zig +++ b/test/compile_errors/stage1/obj/bad_import.zig @@ -1,5 +1,7 @@ const bogus = @import("bogus-does-not-exist.zig",); -// bad import +// error +// backend=stage1 +// target=native // // tmp.zig:1:23: error: unable to load '${DIR}bogus-does-not-exist.zig': FileNotFound diff --git a/test/compile_errors/stage1/obj/bad_usage_of_call.zig b/test/compile_errors/stage1/obj/bad_usage_of_call.zig index 928c39b5a80d6d811f081713ee4f1dd5bbb7e042..c77ccf1a525ca5144581da98903e60aa74f19b7b 100644 --- a/test/compile_errors/stage1/obj/bad_usage_of_call.zig +++ b/test/compile_errors/stage1/obj/bad_usage_of_call.zig @@ -19,7 +19,9 @@ fn bar() callconv(.Inline) void {} fn baz1() void {} fn baz2() void {} -// bad usage of @call +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected tuple or struct, found 'void' // tmp.zig:5:14: error: unable to perform 'never_inline' call at compile-time diff --git a/test/compile_errors/stage1/obj/bin_and_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/bin_and_assign_on_undefined_value.zig index d9dbdea7412b4f52eceb889e53c49d43cfcf9f76..1076f9abdb6c170e84f0770f5ec33d04e0c572f1 100644 --- a/test/compile_errors/stage1/obj/bin_and_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/bin_and_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a &= a; } -// bin and assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/bin_and_on_undefined_value.zig b/test/compile_errors/stage1/obj/bin_and_on_undefined_value.zig index 6775cd56eaef2766dcb80b7e9d45d8854bb0c168..a53d9a10ac66b5ba7f107648fea3f18fb7c0c37d 100644 --- a/test/compile_errors/stage1/obj/bin_and_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/bin_and_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a & a; } -// bin and on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/bin_not_on_undefined_value.zig b/test/compile_errors/stage1/obj/bin_not_on_undefined_value.zig index 0e543c4f0007aeb92883aa4979d353ea23cecacc..7e0f554f0b1a718848f4b551f5ae51556cb17e4a 100644 --- a/test/compile_errors/stage1/obj/bin_not_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/bin_not_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = ~a; } -// bin not on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:10: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/bin_or_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/bin_or_assign_on_undefined_value.zig index bfbeb7ce3e3ce11b46d360f7184a18436ea060d5..cc61fc03e168cb211ced6b390c2f2923fb719615 100644 --- a/test/compile_errors/stage1/obj/bin_or_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/bin_or_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a |= a; } -// bin or assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/bin_or_on_undefined_value.zig b/test/compile_errors/stage1/obj/bin_or_on_undefined_value.zig index 7a62ace9dddb184ccb6b82fb923e0d3a99b03f80..7ac30bcb4e69471e3e317cc559dca17520d26776 100644 --- a/test/compile_errors/stage1/obj/bin_or_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/bin_or_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a | a; } -// bin or on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/bin_xor_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/bin_xor_assign_on_undefined_value.zig index bea5e1e08936bf08dea5312341d392b27bee73af..37e3eae321bc7246cd8f1ccce419300891497d04 100644 --- a/test/compile_errors/stage1/obj/bin_xor_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/bin_xor_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a ^= a; } -// bin xor assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/bin_xor_on_undefined_value.zig b/test/compile_errors/stage1/obj/bin_xor_on_undefined_value.zig index f6ddb2452123a087333f108e614c0eb9df9ccec6..f1656b60131df144286c32a984458cf33dc9793e 100644 --- a/test/compile_errors/stage1/obj/bin_xor_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/bin_xor_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a ^ a; } -// bin xor on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/binary_not_on_number_literal.zig b/test/compile_errors/stage1/obj/binary_not_on_number_literal.zig index 12f5953f16d9521fbcaa948ff433d90d0bc9dc42..34ddf9adfa0c44c3180917e53927313ab69f04ed 100644 --- a/test/compile_errors/stage1/obj/binary_not_on_number_literal.zig +++ b/test/compile_errors/stage1/obj/binary_not_on_number_literal.zig @@ -4,6 +4,8 @@ var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE - export fn entry() usize { return @sizeOf(@TypeOf(block_aligned_stuff)); } -// binary not on number literal +// error +// backend=stage1 +// target=native // // tmp.zig:3:60: error: unable to perform binary not operation on type 'comptime_int' diff --git a/test/compile_errors/stage1/obj/bitCast_same_size_but_bit_count_mismatch.zig b/test/compile_errors/stage1/obj/bitCast_same_size_but_bit_count_mismatch.zig index e4945a1194c44e630b9af0a5b2d22af9a9980df3..9150dc32853c9ff6c5bd3d9f6553bd4aa2ceee3f 100644 --- a/test/compile_errors/stage1/obj/bitCast_same_size_but_bit_count_mismatch.zig +++ b/test/compile_errors/stage1/obj/bitCast_same_size_but_bit_count_mismatch.zig @@ -3,6 +3,8 @@ export fn entry(byte: u8) void { _ = oops; } -// @bitCast same size but bit count mismatch +// error +// backend=stage1 +// target=native // // tmp.zig:2:25: error: destination type 'u7' has 7 bits but source type 'u8' has 8 bits diff --git a/test/compile_errors/stage1/obj/bitCast_to_enum_type.zig b/test/compile_errors/stage1/obj/bitCast_to_enum_type.zig index dbb73eba187bf8842aa1d771f0afb6479b28e89c..4d63ab9e019a540760e3d3196e66dbd3b999bc2f 100644 --- a/test/compile_errors/stage1/obj/bitCast_to_enum_type.zig +++ b/test/compile_errors/stage1/obj/bitCast_to_enum_type.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = y; } -// bitCast to enum type +// error +// backend=stage1 +// target=native // // tmp.zig:2:24: error: cannot cast a value of type 'y' diff --git a/test/compile_errors/stage1/obj/bitCast_with_different_sizes_inside_an_expression.zig b/test/compile_errors/stage1/obj/bitCast_with_different_sizes_inside_an_expression.zig index bb5c0c593658a6c7c35ba6ac7e232ea6b97153d5..64caef7cd0cdf99997a8a228d4a70c9abe33fa53 100644 --- a/test/compile_errors/stage1/obj/bitCast_with_different_sizes_inside_an_expression.zig +++ b/test/compile_errors/stage1/obj/bitCast_with_different_sizes_inside_an_expression.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = foo; } -// @bitCast with different sizes inside an expression +// error +// backend=stage1 +// target=native // // tmp.zig:2:25: error: destination type 'u8' has size 1 but source type 'f32' has size 4 diff --git a/test/compile_errors/stage1/obj/bit_shifting_only_works_on_integer_types.zig b/test/compile_errors/stage1/obj/bit_shifting_only_works_on_integer_types.zig index 98fa3128aa1649a0c0fc5cd9e62c31a1dfa79efa..7d1c5873a1fe3242af429f7492719d1b53b7dc55 100644 --- a/test/compile_errors/stage1/obj/bit_shifting_only_works_on_integer_types.zig +++ b/test/compile_errors/stage1/obj/bit_shifting_only_works_on_integer_types.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// bit shifting only works on integer types +// error +// backend=stage1 +// target=native // // tmp.zig:2:16: error: bit shifting operation expected integer type, found '*const u8' diff --git a/test/compile_errors/stage1/obj/bogus_compile_var.zig b/test/compile_errors/stage1/obj/bogus_compile_var.zig index 05777b9ecd291190e8a3296fce7018831c3fe1ef..845d943c7ddc973769b2db96407f611f6c2bb43e 100644 --- a/test/compile_errors/stage1/obj/bogus_compile_var.zig +++ b/test/compile_errors/stage1/obj/bogus_compile_var.zig @@ -1,6 +1,8 @@ const x = @import("builtin").bogus; export fn entry() usize { return @sizeOf(@TypeOf(x)); } -// bogus compile var +// error +// backend=stage1 +// target=native // // tmp.zig:1:29: error: container 'builtin' has no member called 'bogus' diff --git a/test/compile_errors/stage1/obj/bogus_method_call_on_slice.zig b/test/compile_errors/stage1/obj/bogus_method_call_on_slice.zig index 8d34a098171a0c5890cb9ae8f9f81a11f3674fc3..3ede578b34e57005baa67405fb3bf406a78ab276 100644 --- a/test/compile_errors/stage1/obj/bogus_method_call_on_slice.zig +++ b/test/compile_errors/stage1/obj/bogus_method_call_on_slice.zig @@ -4,6 +4,8 @@ fn f(m: []const u8) void { } export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// bogus method call on slice +// error +// backend=stage1 +// target=native // // tmp.zig:3:6: error: no member named 'copy' in '[]const u8' diff --git a/test/compile_errors/stage1/obj/bool_not_on_undefined_value.zig b/test/compile_errors/stage1/obj/bool_not_on_undefined_value.zig index 71ea7d5e9664d408bff3ab460b3d110b96115c16..5c99a9739b5941044e38593009ac0636adceef54 100644 --- a/test/compile_errors/stage1/obj/bool_not_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/bool_not_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = !a; } -// bool not on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:10: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/branch_on_undefined_value.zig b/test/compile_errors/stage1/obj/branch_on_undefined_value.zig index d02ac22a2a62b1af7d21c47587c62557f656c98b..f4b922a3328af9c42082a5e461eb84f6569020da 100644 --- a/test/compile_errors/stage1/obj/branch_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/branch_on_undefined_value.zig @@ -2,6 +2,8 @@ const x = if (undefined) true else false; export fn entry() usize { return @sizeOf(@TypeOf(x)); } -// branch on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:1:15: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/cImport_with_bogus_include.zig b/test/compile_errors/stage1/obj/cImport_with_bogus_include.zig index 89627b354fa780e53bc8f3f99d28ff3cf1b38ceb..141f21cb9a7ef9a9534a15cd6d0955b6ddef4a5c 100644 --- a/test/compile_errors/stage1/obj/cImport_with_bogus_include.zig +++ b/test/compile_errors/stage1/obj/cImport_with_bogus_include.zig @@ -1,7 +1,9 @@ const c = @cImport(@cInclude("bogus.h")); export fn entry() usize { return @sizeOf(@TypeOf(c.bogo)); } -// @cImport with bogus include +// error +// backend=stage1 +// target=native // // tmp.zig:1:11: error: C import failed // .h:1:10: note: 'bogus.h' file not found diff --git a/test/compile_errors/stage1/obj/call_assigned_to_constant.zig b/test/compile_errors/stage1/obj/call_assigned_to_constant.zig index fb2febadb294cb8a08b5f9442db00126b682198f..ca4e8b67cd02ece3a12191a4cb66b2cbb6b89055 100644 --- a/test/compile_errors/stage1/obj/call_assigned_to_constant.zig +++ b/test/compile_errors/stage1/obj/call_assigned_to_constant.zig @@ -16,7 +16,9 @@ export fn entry1() void { baz = bar(42); } -// call assigned to constant +// error +// backend=stage1 +// target=native // // tmp.zig:12:14: error: cannot assign to constant // tmp.zig:16:14: error: cannot assign to constant diff --git a/test/compile_errors/stage1/obj/call_with_new_stack_on_unsupported_target.zig b/test/compile_errors/stage1/obj/call_with_new_stack_on_unsupported_target.zig new file mode 100644 index 0000000000000000000000000000000000000000..7cb504a3f9d645c58bfbfe3fbb1b5d10ba9a9d7f --- /dev/null +++ b/test/compile_errors/stage1/obj/call_with_new_stack_on_unsupported_target.zig @@ -0,0 +1,11 @@ +var buf: [10]u8 align(16) = undefined; +export fn entry() void { + @call(.{ .stack = &buf }, foo, .{}); +} +fn foo() void {} + +// error +// backend=stage1 +// target=wasm32-wasi-none +// +// tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack diff --git a/test/compile_errors/stage1/obj/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig b/test/compile_errors/stage1/obj/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig new file mode 100644 index 0000000000000000000000000000000000000000..fa062878036cc6a321068c9b1489a809367fde59 --- /dev/null +++ b/test/compile_errors/stage1/obj/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig @@ -0,0 +1,11 @@ +export fn entry1() callconv(.APCS) void {} +export fn entry2() callconv(.AAPCS) void {} +export fn entry3() callconv(.AAPCSVFP) void {} + +// error +// backend=stage1 +// target=x86_64-linux-none +// +// tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64 +// tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64 +// tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64 diff --git a/test/compile_errors/stage1/obj/callconv_interrupt_on_unsupported_platform.zig b/test/compile_errors/stage1/obj/callconv_interrupt_on_unsupported_platform.zig new file mode 100644 index 0000000000000000000000000000000000000000..8304fb90c1edc167edec2f9ca142bd6675c3116d --- /dev/null +++ b/test/compile_errors/stage1/obj/callconv_interrupt_on_unsupported_platform.zig @@ -0,0 +1,7 @@ +export fn entry() callconv(.Interrupt) void {} + +// error +// backend=stage1 +// target=aarch64-linux-none +// +// tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64 diff --git a/test/compile_errors/stage1/obj/callconv_signal_on_unsupported_platform.zig b/test/compile_errors/stage1/obj/callconv_signal_on_unsupported_platform.zig new file mode 100644 index 0000000000000000000000000000000000000000..4b19b188fdd8c8b6d03c54886f97e5e75614e83c --- /dev/null +++ b/test/compile_errors/stage1/obj/callconv_signal_on_unsupported_platform.zig @@ -0,0 +1,7 @@ +export fn entry() callconv(.Signal) void {} + +// error +// backend=stage1 +// target=x86_64-linux-none +// +// tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64 diff --git a/test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-0.zig b/test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-0.zig new file mode 100644 index 0000000000000000000000000000000000000000..f4994107cd13bae21514393ebcce71f88f36b785 --- /dev/null +++ b/test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-0.zig @@ -0,0 +1,23 @@ +const F1 = fn () callconv(.Stdcall) void; +const F2 = fn () callconv(.Fastcall) void; +const F3 = fn () callconv(.Thiscall) void; +export fn entry1() void { + var a: F1 = undefined; + _ = a; +} +export fn entry2() void { + var a: F2 = undefined; + _ = a; +} +export fn entry3() void { + var a: F3 = undefined; + _ = a; +} + +// error +// backend=stage1 +// target=x86_64-linux-none +// +// tmp.zig:1:27: error: callconv 'Stdcall' is only available on x86, not x86_64 +// tmp.zig:2:27: error: callconv 'Fastcall' is only available on x86, not x86_64 +// tmp.zig:3:27: error: callconv 'Thiscall' is only available on x86, not x86_64 diff --git a/test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-1.zig b/test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-1.zig new file mode 100644 index 0000000000000000000000000000000000000000..aa23f9ae51714129903e57ab42655c3656eada31 --- /dev/null +++ b/test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-1.zig @@ -0,0 +1,11 @@ +export fn entry1() callconv(.Stdcall) void {} +export fn entry2() callconv(.Fastcall) void {} +export fn entry3() callconv(.Thiscall) void {} + +// error +// backend=stage1 +// target=x86_64-linux-none +// +// tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64 +// tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64 +// tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64 diff --git a/test/compile_errors/stage1/obj/callconv_vectorcall_on_unsupported_platform.zig b/test/compile_errors/stage1/obj/callconv_vectorcall_on_unsupported_platform.zig new file mode 100644 index 0000000000000000000000000000000000000000..e60e6ab42c0b9ab8bc756af0ec979502ad9a3dc8 --- /dev/null +++ b/test/compile_errors/stage1/obj/callconv_vectorcall_on_unsupported_platform.zig @@ -0,0 +1,7 @@ +export fn entry() callconv(.Vectorcall) void {} + +// error +// backend=stage1 +// target=x86_64-linux-none +// +// tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64 diff --git a/test/compile_errors/stage1/obj/calling_a_generic_function_only_known_at_runtime.zig b/test/compile_errors/stage1/obj/calling_a_generic_function_only_known_at_runtime.zig index c31b18bb6faf5bf33d0528fe872a7370b978ea65..3081f0f1e184573eccf3625c0373233f8d4494b5 100644 --- a/test/compile_errors/stage1/obj/calling_a_generic_function_only_known_at_runtime.zig +++ b/test/compile_errors/stage1/obj/calling_a_generic_function_only_known_at_runtime.zig @@ -7,6 +7,8 @@ pub fn main() !void { foos[0](true); } -// calling a generic function only known at runtime +// error +// backend=stage1 +// target=native // // tmp.zig:7:9: error: calling a generic function requires compile-time known function value diff --git a/test/compile_errors/stage1/obj/calling_function_with_naked_calling_convention.zig b/test/compile_errors/stage1/obj/calling_function_with_naked_calling_convention.zig index c99e5b783182ba4a015b2c98c69823c1964ca62d..401f84e687da591d8ea817f5f1c27f4bfd02a563 100644 --- a/test/compile_errors/stage1/obj/calling_function_with_naked_calling_convention.zig +++ b/test/compile_errors/stage1/obj/calling_function_with_naked_calling_convention.zig @@ -3,7 +3,9 @@ export fn entry() void { } fn foo() callconv(.Naked) void { } -// calling function with naked calling convention +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: unable to call function with naked calling convention // tmp.zig:4:1: note: declared here diff --git a/test/compile_errors/stage1/obj/calling_var_args_extern_function_passing_array_instead_of_pointer.zig b/test/compile_errors/stage1/obj/calling_var_args_extern_function_passing_array_instead_of_pointer.zig index e3cc4425db750395046da0424e11e229ffb76fda..a71ab051f280967e4af951c8d35d672523a5b9ae 100644 --- a/test/compile_errors/stage1/obj/calling_var_args_extern_function_passing_array_instead_of_pointer.zig +++ b/test/compile_errors/stage1/obj/calling_var_args_extern_function_passing_array_instead_of_pointer.zig @@ -3,6 +3,8 @@ export fn entry() void { } pub extern fn foo(format: *const u8, ...) void; -// calling var args extern function, passing array instead of pointer +// error +// backend=stage1 +// target=native // // tmp.zig:2:16: error: expected type '*const u8', found '[5:0]u8' diff --git a/test/compile_errors/stage1/obj/cannot_break_out_of_defer_expression.zig b/test/compile_errors/stage1/obj/cannot_break_out_of_defer_expression.zig index 002a7717d3fb1b72445379233f3ebf0ca3c27643..3c7ae4fa2f0669ab158e410357191c0fde58523f 100644 --- a/test/compile_errors/stage1/obj/cannot_break_out_of_defer_expression.zig +++ b/test/compile_errors/stage1/obj/cannot_break_out_of_defer_expression.zig @@ -6,6 +6,8 @@ export fn foo() void { } } -// cannot break out of defer expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:13: error: cannot break out of defer expression diff --git a/test/compile_errors/stage1/obj/cannot_continue_out_of_defer_expression.zig b/test/compile_errors/stage1/obj/cannot_continue_out_of_defer_expression.zig index 8adb7eafd6bead2344220a6dd188bf7dda1e4fed..56b8ced05be00935793775af365f84ef919ef950 100644 --- a/test/compile_errors/stage1/obj/cannot_continue_out_of_defer_expression.zig +++ b/test/compile_errors/stage1/obj/cannot_continue_out_of_defer_expression.zig @@ -6,6 +6,8 @@ export fn foo() void { } } -// cannot continue out of defer expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:13: error: cannot continue out of defer expression diff --git a/test/compile_errors/stage1/obj/capture_group_on_switch_prong_with_incompatible_payload_types.zig b/test/compile_errors/stage1/obj/capture_group_on_switch_prong_with_incompatible_payload_types.zig index 8a4c94f50376e92132afaf08133935717f6dff51..ce2068d6c701421af71d3e6a738070889511c9a9 100644 --- a/test/compile_errors/stage1/obj/capture_group_on_switch_prong_with_incompatible_payload_types.zig +++ b/test/compile_errors/stage1/obj/capture_group_on_switch_prong_with_incompatible_payload_types.zig @@ -12,7 +12,9 @@ comptime { } } -// capture group on switch prong with incompatible payload types +// error +// backend=stage1 +// target=native // // tmp.zig:8:20: error: capture group with incompatible types // tmp.zig:8:9: note: type 'usize' here diff --git a/test/compile_errors/stage1/obj/cast_enum_literal_to_enum_but_it_doesnt_match.zig b/test/compile_errors/stage1/obj/cast_enum_literal_to_enum_but_it_doesnt_match.zig index 10717ff392ae0698e03e765cf8cd048d73b00195..ba53646efcc8c700484eaa330c17083dd822ca68 100644 --- a/test/compile_errors/stage1/obj/cast_enum_literal_to_enum_but_it_doesnt_match.zig +++ b/test/compile_errors/stage1/obj/cast_enum_literal_to_enum_but_it_doesnt_match.zig @@ -7,7 +7,9 @@ export fn entry() void { _ = x; } -// cast enum literal to enum but it doesn't match +// error +// backend=stage1 +// target=native // // tmp.zig:6:20: error: enum 'Foo' has no field named 'c' // tmp.zig:1:13: note: 'Foo' declared here diff --git a/test/compile_errors/stage1/obj/cast_error_union_of_global_error_set_to_error_union_of_smaller_error_set.zig b/test/compile_errors/stage1/obj/cast_error_union_of_global_error_set_to_error_union_of_smaller_error_set.zig index fbb68c30c8e82ccca38e34fab5414d645a1ac5d0..08962afc855f31095613daa866f17448e16e5f9e 100644 --- a/test/compile_errors/stage1/obj/cast_error_union_of_global_error_set_to_error_union_of_smaller_error_set.zig +++ b/test/compile_errors/stage1/obj/cast_error_union_of_global_error_set_to_error_union_of_smaller_error_set.zig @@ -7,7 +7,9 @@ fn foo() anyerror!i32 { return error.B; } -// cast error union of global error set to error union of smaller error set +// error +// backend=stage1 +// target=native // // tmp.zig:3:35: error: expected type 'SmallErrorSet!i32', found 'anyerror!i32' // tmp.zig:3:35: note: error set 'anyerror' cannot cast into error set 'SmallErrorSet' diff --git a/test/compile_errors/stage1/obj/cast_global_error_set_to_error_set.zig b/test/compile_errors/stage1/obj/cast_global_error_set_to_error_set.zig index f37ffce22996f90f08ec2ab686d89fbc7bd37aa3..be9487cc5a9486cc766828d6675e56fe1f02157c 100644 --- a/test/compile_errors/stage1/obj/cast_global_error_set_to_error_set.zig +++ b/test/compile_errors/stage1/obj/cast_global_error_set_to_error_set.zig @@ -7,7 +7,9 @@ fn foo() anyerror { return error.B; } -// cast global error set to error set +// error +// backend=stage1 +// target=native // // tmp.zig:3:31: error: expected type 'SmallErrorSet', found 'anyerror' // tmp.zig:3:31: note: cannot cast global error set into smaller set diff --git a/test/compile_errors/stage1/obj/cast_negative_integer_literal_to_usize.zig b/test/compile_errors/stage1/obj/cast_negative_integer_literal_to_usize.zig index 37e42c062c2b85b9d096a610bb952a9ea1a54d85..763e0c8a238ecf83aaa354f2652088fd819360cd 100644 --- a/test/compile_errors/stage1/obj/cast_negative_integer_literal_to_usize.zig +++ b/test/compile_errors/stage1/obj/cast_negative_integer_literal_to_usize.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// cast negative integer literal to usize +// error +// backend=stage1 +// target=native // // tmp.zig:2:26: error: cannot cast negative value -10 to unsigned integer type 'usize' diff --git a/test/compile_errors/stage1/obj/cast_negative_value_to_unsigned_integer.zig b/test/compile_errors/stage1/obj/cast_negative_value_to_unsigned_integer.zig index e740d406f6e54a4dac0de4e98816cb81c0e6360e..d2e318714054f8265defd34dad989ac64baac418 100644 --- a/test/compile_errors/stage1/obj/cast_negative_value_to_unsigned_integer.zig +++ b/test/compile_errors/stage1/obj/cast_negative_value_to_unsigned_integer.zig @@ -9,7 +9,9 @@ export fn entry1() void { _ = unsigned; } -// cast negative value to unsigned integer +// error +// backend=stage1 +// target=native // // tmp.zig:3:22: error: attempt to cast negative value to unsigned integer // tmp.zig:8:27: error: cannot cast negative value -1 to unsigned integer type 'u32' diff --git a/test/compile_errors/stage1/obj/cast_unreachable.zig b/test/compile_errors/stage1/obj/cast_unreachable.zig index 94fa1217702207b27b2e8db17bb83b14dfb8c84b..b043108737805b841e274e1787145796448b94c7 100644 --- a/test/compile_errors/stage1/obj/cast_unreachable.zig +++ b/test/compile_errors/stage1/obj/cast_unreachable.zig @@ -3,7 +3,9 @@ fn f() i32 { } export fn entry() void { _ = f(); } -// cast unreachable +// error +// backend=stage1 +// target=native // // tmp.zig:2:12: error: unreachable code // tmp.zig:2:21: note: control flow is diverted here diff --git a/test/compile_errors/stage1/obj/casting_bit_offset_pointer_to_regular_pointer.zig b/test/compile_errors/stage1/obj/casting_bit_offset_pointer_to_regular_pointer.zig index 9b6c5ea0e658de209d710553fca13e5415548ddd..f109cdf2955bf947976dd16b1f5de07bec3d4216 100644 --- a/test/compile_errors/stage1/obj/casting_bit_offset_pointer_to_regular_pointer.zig +++ b/test/compile_errors/stage1/obj/casting_bit_offset_pointer_to_regular_pointer.zig @@ -14,6 +14,8 @@ fn bar(x: *const u3) u3 { export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// casting bit offset pointer to regular pointer +// error +// backend=stage1 +// target=native // // tmp.zig:8:26: error: expected type '*const u3', found '*align(:3:1) const u3' diff --git a/test/compile_errors/stage1/obj/catch_on_undefined_value.zig b/test/compile_errors/stage1/obj/catch_on_undefined_value.zig index 9d22d07219593dfcba7f74c279330617819bbeb6..53a5f1c2a958df64ecd574fd082b91ec9439fada 100644 --- a/test/compile_errors/stage1/obj/catch_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/catch_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a catch false; } -// catch on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:11: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/chained_comparison_operators.zig b/test/compile_errors/stage1/obj/chained_comparison_operators.zig index 89e1ea1e75819318fd6e3db298f4ec217cef48da..1e4ed8d82e1b7dcb925f05ac6f5ec443f94cfb45 100644 --- a/test/compile_errors/stage1/obj/chained_comparison_operators.zig +++ b/test/compile_errors/stage1/obj/chained_comparison_operators.zig @@ -2,6 +2,8 @@ export fn a(value: u32) bool { return 1 < value < 1000; } -// chained comparison operators +// error +// backend=stage1 +// target=native // // tmp.zig:2:22: error: comparison operators cannot be chained diff --git a/test/compile_errors/stage1/obj/cmpxchg_with_float.zig b/test/compile_errors/stage1/obj/cmpxchg_with_float.zig index 8926ffc36b5dc9e9d41e9bac774c921e2a40f744..11f2dc21c31bf50b88373242f696da9c903ddd08 100644 --- a/test/compile_errors/stage1/obj/cmpxchg_with_float.zig +++ b/test/compile_errors/stage1/obj/cmpxchg_with_float.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst); } -// cmpxchg with float +// error +// backend=stage1 +// target=native // // tmp.zig:3:22: error: expected bool, integer, enum or pointer type, found 'f32' diff --git a/test/compile_errors/stage1/obj/colliding_invalid_top_level_functions.zig b/test/compile_errors/stage1/obj/colliding_invalid_top_level_functions.zig index f4e5d24c467f3b336ce7ce46ea0673291ace4ba7..344edbaa9fa2fbd73a93f00e9a8a067b4e61a00f 100644 --- a/test/compile_errors/stage1/obj/colliding_invalid_top_level_functions.zig +++ b/test/compile_errors/stage1/obj/colliding_invalid_top_level_functions.zig @@ -2,7 +2,9 @@ fn func() bogus {} fn func() bogus {} export fn entry() usize { return @sizeOf(@TypeOf(func)); } -// colliding invalid top level functions +// error +// backend=stage1 +// target=native // // tmp.zig:2:1: error: redeclaration of 'func' // tmp.zig:1:1: note: other declaration here diff --git a/test/compile_errors/stage1/obj/compare_optional_to_non-optional_with_invalid_types.zig b/test/compile_errors/stage1/obj/compare_optional_to_non-optional_with_invalid_types.zig index 8713cf4501cc081f7048876aca564e94c193ad54..32e1fe9b246381a8b09016ac565d9ac36655b298 100644 --- a/test/compile_errors/stage1/obj/compare_optional_to_non-optional_with_invalid_types.zig +++ b/test/compile_errors/stage1/obj/compare_optional_to_non-optional_with_invalid_types.zig @@ -22,7 +22,9 @@ export fn invalidChildType() void { _ = (x == y); } -// compare optional to non-optional with invalid types +// error +// backend=stage1 +// target=native // // :4:12: error: cannot compare types '?i32' and 'comptime_int' // :4:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int' diff --git a/test/compile_errors/stage1/obj/comparing_a_non-optional_pointer_against_null.zig b/test/compile_errors/stage1/obj/comparing_a_non-optional_pointer_against_null.zig index 69a512013514fbbd0a48a0c887f20fb8c6af0a8a..62b570803494ef8c4cb2ec15a8388b762e4960b8 100644 --- a/test/compile_errors/stage1/obj/comparing_a_non-optional_pointer_against_null.zig +++ b/test/compile_errors/stage1/obj/comparing_a_non-optional_pointer_against_null.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = &x == null; } -// comparing a non-optional pointer against null +// error +// backend=stage1 +// target=native // // tmp.zig:3:12: error: comparison of '*i32' with null diff --git a/test/compile_errors/stage1/obj/comparing_against_undefined_produces_undefined_value.zig b/test/compile_errors/stage1/obj/comparing_against_undefined_produces_undefined_value.zig index c329f51ef776366d3d3cc4726659368790ef36b2..8bad61e6d1d6321166386d17fe4c60db4800c623 100644 --- a/test/compile_errors/stage1/obj/comparing_against_undefined_produces_undefined_value.zig +++ b/test/compile_errors/stage1/obj/comparing_against_undefined_produces_undefined_value.zig @@ -2,6 +2,8 @@ export fn entry() void { if (2 == undefined) {} } -// comparing against undefined produces undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:2:11: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/comparison_operators_with_undefined_value.zig b/test/compile_errors/stage1/obj/comparison_operators_with_undefined_value.zig index 6021382fd4bb3dbb3ff7b4abe7ffe550d045376a..818a575fc8b30cfd26929eb61b6923f9a5cd85bb 100644 --- a/test/compile_errors/stage1/obj/comparison_operators_with_undefined_value.zig +++ b/test/compile_errors/stage1/obj/comparison_operators_with_undefined_value.zig @@ -35,7 +35,9 @@ comptime { if (a <= a) x += 1; } -// comparison operators with undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:5:11: error: use of undefined value here causes undefined behavior // tmp.zig:11:11: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/comparison_with_error_union_and_error_value.zig b/test/compile_errors/stage1/obj/comparison_with_error_union_and_error_value.zig index 260ccc6f017645b07cae015362de106ce4032245..16f3b21c3d39a539fb324f9f62e4874eb028ba79 100644 --- a/test/compile_errors/stage1/obj/comparison_with_error_union_and_error_value.zig +++ b/test/compile_errors/stage1/obj/comparison_with_error_union_and_error_value.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = number_or_error == error.SomethingAwful; } -// comparison with error union and error value +// error +// backend=stage1 +// target=native // // tmp.zig:3:25: error: operator not allowed for type 'anyerror!i32' diff --git a/test/compile_errors/stage1/obj/compile-time_division_by_zero.zig b/test/compile_errors/stage1/obj/compile-time_division_by_zero.zig index 578dbc7b4a793a925624500deb741dfed49c2260..e16f5f8cf40daa97aa8da6e62898055520129cc3 100644 --- a/test/compile_errors/stage1/obj/compile-time_division_by_zero.zig +++ b/test/compile_errors/stage1/obj/compile-time_division_by_zero.zig @@ -5,6 +5,8 @@ comptime { _ = c; } -// compile-time division by zero +// error +// backend=stage1 +// target=native // // tmp.zig:4:17: error: division by zero diff --git a/test/compile_errors/stage1/obj/compile-time_remainder_division_by_zero.zig b/test/compile_errors/stage1/obj/compile-time_remainder_division_by_zero.zig index 015d22911063ec6dfcd1714d431e4e83d26d2bfc..63f0def52c1e50e85118461ba84a00e30559ce31 100644 --- a/test/compile_errors/stage1/obj/compile-time_remainder_division_by_zero.zig +++ b/test/compile_errors/stage1/obj/compile-time_remainder_division_by_zero.zig @@ -5,6 +5,8 @@ comptime { _ = c; } -// compile-time remainder division by zero +// error +// backend=stage1 +// target=native // // tmp.zig:4:17: error: division by zero diff --git a/test/compile_errors/stage1/obj/compileError_shows_traceback_of_references_that_caused_it.zig b/test/compile_errors/stage1/obj/compileError_shows_traceback_of_references_that_caused_it.zig index 4273741ad2b7f623c0a484eeff548430573de33d..c58e9b77680998a77442bc2900d396b5337df346 100644 --- a/test/compile_errors/stage1/obj/compileError_shows_traceback_of_references_that_caused_it.zig +++ b/test/compile_errors/stage1/obj/compileError_shows_traceback_of_references_that_caused_it.zig @@ -7,6 +7,8 @@ export fn entry() i32 { return bar; } -// @compileError shows traceback of references that caused it +// error +// backend=stage1 +// target=native // // tmp.zig:1:13: error: aoeu diff --git a/test/compile_errors/stage1/obj/compileLog_of_tagged_enum_doesnt_crash_the_compiler.zig b/test/compile_errors/stage1/obj/compileLog_of_tagged_enum_doesnt_crash_the_compiler.zig index 0770b3b6a4aa9366daec4bd07aab0d801c228522..36e1ee111850e05b7be54c3017c49bbc61d94205 100644 --- a/test/compile_errors/stage1/obj/compileLog_of_tagged_enum_doesnt_crash_the_compiler.zig +++ b/test/compile_errors/stage1/obj/compileLog_of_tagged_enum_doesnt_crash_the_compiler.zig @@ -10,6 +10,8 @@ pub fn main () void { comptime testCompileLog(Bar{.X = 123}); } -// compileLog of tagged enum doesn't crash the compiler +// error +// backend=stage1 +// target=native // // tmp.zig:6:5: error: found compile log statement diff --git a/test/compile_errors/stage1/obj/compile_error_in_struct_init_expression.zig b/test/compile_errors/stage1/obj/compile_error_in_struct_init_expression.zig index 6215c9ad76d7f444b6edf4bddef20a7087b02bfc..041d09b0026eff658af85697258f1bfcd6abcfdb 100644 --- a/test/compile_errors/stage1/obj/compile_error_in_struct_init_expression.zig +++ b/test/compile_errors/stage1/obj/compile_error_in_struct_init_expression.zig @@ -9,6 +9,8 @@ export fn entry() void { _ = x; } -// compile error in struct init expression +// error +// backend=stage1 +// target=native // // tmp.zig:2:14: error: use of undeclared identifier 'crap' diff --git a/test/compile_errors/stage1/obj/compile_error_when_evaluating_return_type_of_inferred_error_set.zig b/test/compile_errors/stage1/obj/compile_error_when_evaluating_return_type_of_inferred_error_set.zig index 44d5b6a389878d0e6d6d751b0404756cf31c7cf1..7b1d11b0a43962a9af927bd4e6b719142cc8e8b3 100644 --- a/test/compile_errors/stage1/obj/compile_error_when_evaluating_return_type_of_inferred_error_set.zig +++ b/test/compile_errors/stage1/obj/compile_error_when_evaluating_return_type_of_inferred_error_set.zig @@ -7,6 +7,8 @@ export fn entry() void { _ = car; } -// compile error when evaluating return type of inferred error set +// error +// backend=stage1 +// target=native // // tmp.zig:2:11: error: use of undeclared identifier 'SymbolThatDoesNotExist' diff --git a/test/compile_errors/stage1/obj/compile_log.zig b/test/compile_errors/stage1/obj/compile_log.zig index ef1cba4502d9639296bd37c8b806be85ea7283ca..7f5d52240769afe7e61eb9f70ed52ef8f9c6f6fb 100644 --- a/test/compile_errors/stage1/obj/compile_log.zig +++ b/test/compile_errors/stage1/obj/compile_log.zig @@ -7,7 +7,9 @@ fn bar(a: i32, b: []const u8) void { @compileLog("end",); } -// compile log +// error +// backend=stage1 +// target=native // // tmp.zig:5:5: error: found compile log statement // tmp.zig:6:5: error: found compile log statement diff --git a/test/compile_errors/stage1/obj/compile_log_a_pointer_to_an_opaque_value.zig b/test/compile_errors/stage1/obj/compile_log_a_pointer_to_an_opaque_value.zig index 15b7825a9164a7a48f3291ad50c8f299826c96bd..d585712b8ac4752808d6ade84a270bb917b250fd 100644 --- a/test/compile_errors/stage1/obj/compile_log_a_pointer_to_an_opaque_value.zig +++ b/test/compile_errors/stage1/obj/compile_log_a_pointer_to_an_opaque_value.zig @@ -2,6 +2,8 @@ export fn entry() void { @compileLog(@ptrCast(*const anyopaque, &entry)); } -// compile log a pointer to an opaque value +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: found compile log statement diff --git a/test/compile_errors/stage1/obj/compile_log_statement_inside_function_which_must_be_comptime_evaluated.zig b/test/compile_errors/stage1/obj/compile_log_statement_inside_function_which_must_be_comptime_evaluated.zig index f848ed7c7cdd0404e77c69d97605c046612d3ef7..19b96048cb90dd9857a26f57ee8a77e8d757edf7 100644 --- a/test/compile_errors/stage1/obj/compile_log_statement_inside_function_which_must_be_comptime_evaluated.zig +++ b/test/compile_errors/stage1/obj/compile_log_statement_inside_function_which_must_be_comptime_evaluated.zig @@ -7,6 +7,8 @@ export fn entry() void { _ = @typeName(Foo(i32)); } -// compile log statement inside function which must be comptime evaluated +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: found compile log statement diff --git a/test/compile_errors/stage1/obj/compile_log_statement_warning_deduplication_in_generic_fn.zig b/test/compile_errors/stage1/obj/compile_log_statement_warning_deduplication_in_generic_fn.zig index 05ac76724cdeef94f7d1cea3510df7d51d532e01..991021932de33be551079056aae4ee8060183a7d 100644 --- a/test/compile_errors/stage1/obj/compile_log_statement_warning_deduplication_in_generic_fn.zig +++ b/test/compile_errors/stage1/obj/compile_log_statement_warning_deduplication_in_generic_fn.zig @@ -7,6 +7,8 @@ fn inner(comptime n: usize) void { inline while (i < n) : (i += 1) { @compileLog("!@#$"); } } -// compile log statement warning deduplication in generic fn +// error +// backend=stage1 +// target=native // // tmp.zig:7:39: error: found compile log statement diff --git a/test/compile_errors/stage1/obj/compile_time_division_by_zero.zig b/test/compile_errors/stage1/obj/compile_time_division_by_zero.zig index 17187c47bf7419c0fc3cb77a63fda519a4b0fd65..7f7e168f027cc4221584ed770602b8a86b937c7a 100644 --- a/test/compile_errors/stage1/obj/compile_time_division_by_zero.zig +++ b/test/compile_errors/stage1/obj/compile_time_division_by_zero.zig @@ -5,6 +5,8 @@ fn foo(x: u32) u32 { export fn entry() usize { return @sizeOf(@TypeOf(y)); } -// compile time division by zero +// error +// backend=stage1 +// target=native // // tmp.zig:3:14: error: division by zero diff --git a/test/compile_errors/stage1/obj/comptime_cast_enum_to_union_but_field_has_payload.zig b/test/compile_errors/stage1/obj/comptime_cast_enum_to_union_but_field_has_payload.zig index 36a2079a014da873dd2279da22a1ecb2832bb20d..c3cf9e76e5029a8d274d43ddfecfc2e12dd40b70 100644 --- a/test/compile_errors/stage1/obj/comptime_cast_enum_to_union_but_field_has_payload.zig +++ b/test/compile_errors/stage1/obj/comptime_cast_enum_to_union_but_field_has_payload.zig @@ -9,7 +9,9 @@ export fn entry() void { _ = x; } -// comptime cast enum to union but field has payload +// error +// backend=stage1 +// target=native // // tmp.zig:8:26: error: cast to union 'Value' must initialize 'i32' field 'A' // tmp.zig:3:5: note: field 'A' declared here diff --git a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_catch.zig b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_catch.zig index 18c78c858cd1f631a015ba3fd195d7987c3a4dc2..7eefeb80b4a1f31c3855d85811752a4e970ee104 100644 --- a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_catch.zig +++ b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_catch.zig @@ -8,7 +8,9 @@ fn bad() !void { return error.Bad; } -// comptime continue inside runtime catch +// error +// backend=stage1 +// target=native // // tmp.zig:4:21: error: comptime control flow inside runtime block // tmp.zig:4:15: note: runtime block created here diff --git a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_bool.zig b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_bool.zig index f6ec1b98b1d21449365fab337d933a44bf634909..9ace5ddceb6513056031aa183fdcff5070c31245 100644 --- a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_bool.zig +++ b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_bool.zig @@ -7,7 +7,9 @@ export fn entry() void { } } -// comptime continue inside runtime if bool +// error +// backend=stage1 +// target=native // // tmp.zig:5:22: error: comptime control flow inside runtime block // tmp.zig:5:9: note: runtime block created here diff --git a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_error.zig b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_error.zig index 556a8769a5b2c0e6126338f569a704d33c075e24..554ba3c43e5ab55e5855acaf1a24269d87b85d77 100644 --- a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_error.zig +++ b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_error.zig @@ -7,7 +7,9 @@ export fn entry() void { } } -// comptime continue inside runtime if error +// error +// backend=stage1 +// target=native // // tmp.zig:5:20: error: comptime control flow inside runtime block // tmp.zig:5:9: note: runtime block created here diff --git a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_optional.zig b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_optional.zig index 4f35398a2b8a9136207618d90d9e4274246ced84..32c71e5c7751725196a0e809f43e369ff24dec41 100644 --- a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_optional.zig +++ b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_optional.zig @@ -7,7 +7,9 @@ export fn entry() void { } } -// comptime continue inside runtime if optional +// error +// backend=stage1 +// target=native // // tmp.zig:5:20: error: comptime control flow inside runtime block // tmp.zig:5:9: note: runtime block created here diff --git a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_switch.zig b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_switch.zig index 259cbd602ef891a63921b40453b68073ea7f5e6d..d145897b4167ff3892fcd35e0e87100759bbdcc2 100644 --- a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_switch.zig +++ b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_switch.zig @@ -10,7 +10,9 @@ export fn entry() void { } } -// comptime continue inside runtime switch +// error +// backend=stage1 +// target=native // // tmp.zig:6:19: error: comptime control flow inside runtime block // tmp.zig:5:9: note: runtime block created here diff --git a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_bool.zig b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_bool.zig index 5d86394815582be1413d420735c485d770788091..8e57854728208344098e268d501647199e51106c 100644 --- a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_bool.zig +++ b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_bool.zig @@ -7,7 +7,9 @@ export fn entry() void { } } -// comptime continue inside runtime while bool +// error +// backend=stage1 +// target=native // // tmp.zig:5:25: error: comptime control flow inside runtime block // tmp.zig:5:9: note: runtime block created here diff --git a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_error.zig b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_error.zig index 0ba49cb3ca0fe71481b40de1ab3d1f4176f1eb2f..818455c3540bb7ae27e552703411a5ce023540d2 100644 --- a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_error.zig +++ b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_error.zig @@ -9,7 +9,9 @@ export fn entry() void { } } -// comptime continue inside runtime while error +// error +// backend=stage1 +// target=native // // tmp.zig:6:13: error: comptime control flow inside runtime block // tmp.zig:5:9: note: runtime block created here diff --git a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_optional.zig b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_optional.zig index b2cfd2f69d9a3a8f7261ebf885f89d6acebd0517..ed22cc2cacc6573104293ab240be3e39413303ed 100644 --- a/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_optional.zig +++ b/test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_optional.zig @@ -7,7 +7,9 @@ export fn entry() void { } } -// comptime continue inside runtime while optional +// error +// backend=stage1 +// target=native // // tmp.zig:5:23: error: comptime control flow inside runtime block // tmp.zig:5:9: note: runtime block created here diff --git a/test/compile_errors/stage1/obj/comptime_float_in_asm_input.zig b/test/compile_errors/stage1/obj/comptime_float_in_asm_input.zig index c2333586b43653f9efe252a210e93d05213a92a4..92ffadc4f7b6431ae6985ae0e6ae45932c2be649 100644 --- a/test/compile_errors/stage1/obj/comptime_float_in_asm_input.zig +++ b/test/compile_errors/stage1/obj/comptime_float_in_asm_input.zig @@ -2,6 +2,8 @@ export fn foo() void { asm volatile ("" : : [bar]"r"(3.17) : ""); } -// comptime_float in asm input +// error +// backend=stage1 +// target=native // // tmp.zig:2:35: error: expected sized integer or sized float, found comptime_float diff --git a/test/compile_errors/stage1/obj/comptime_implicit_cast_f64_to_f32.zig b/test/compile_errors/stage1/obj/comptime_implicit_cast_f64_to_f32.zig index f98c45a3488e058b7f87ed12b770eefdd0c76f97..af5d49c7cbf4a139206d2493864621b4dea3edd8 100644 --- a/test/compile_errors/stage1/obj/comptime_implicit_cast_f64_to_f32.zig +++ b/test/compile_errors/stage1/obj/comptime_implicit_cast_f64_to_f32.zig @@ -4,6 +4,8 @@ export fn entry() void { _ = y; } -// comptime implicit cast f64 to f32 +// error +// backend=stage1 +// target=native // // tmp.zig:3:20: error: cast of value 16777217.000000 to type 'f32' loses information diff --git a/test/compile_errors/stage1/obj/comptime_int_in_asm_input.zig b/test/compile_errors/stage1/obj/comptime_int_in_asm_input.zig index 5a587e5a7706048a98c2a72c8c4548f1f6052214..3e3ccf8c2738073424d8e735b2f9ed14edc0a6dc 100644 --- a/test/compile_errors/stage1/obj/comptime_int_in_asm_input.zig +++ b/test/compile_errors/stage1/obj/comptime_int_in_asm_input.zig @@ -2,6 +2,8 @@ export fn foo() void { asm volatile ("" : : [bar]"r"(3) : ""); } -// comptime_int in asm input +// error +// backend=stage1 +// target=native // // tmp.zig:2:35: error: expected sized integer or sized float, found comptime_int diff --git a/test/compile_errors/stage1/obj/comptime_ptrcast_of_zero-sized_type.zig b/test/compile_errors/stage1/obj/comptime_ptrcast_of_zero-sized_type.zig index 1d3f91fe91075715b2b23ec461e7eb24ac35d029..231e735cfa4d58e356123505bb6c8f7134146963 100644 --- a/test/compile_errors/stage1/obj/comptime_ptrcast_of_zero-sized_type.zig +++ b/test/compile_errors/stage1/obj/comptime_ptrcast_of_zero-sized_type.zig @@ -5,6 +5,8 @@ fn foo() void { } comptime { foo(); } -// comptime ptrcast of zero-sized type +// error +// backend=stage1 +// target=native // // tmp.zig:3:21: error: '*const struct:2:17' and '[*]const u8' do not have the same in-memory representation diff --git a/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig b/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig index 622e0cf76bc92698f57db5e8d7b5e8bba514ec1f..598d23a305ba1c9e28f9f1e8fd2379ebbc5a3863 100644 --- a/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig +++ b/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig @@ -54,7 +54,9 @@ export fn foo_slice() void { } } -// comptime slice-sentinel does not match memory at target index (terminated) +// error +// backend=stage1 +// target=native // // :4:29: error: slice-sentinel does not match memory at target index // :12:29: error: slice-sentinel does not match memory at target index diff --git a/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig b/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig index e9451cf9aa64ff3aea1ee6d80ac99aa5044e9652..d6b469aaf164d55a85c886799aff7cb033866391 100644 --- a/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig +++ b/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig @@ -54,7 +54,9 @@ export fn foo_slice() void { } } -// comptime slice-sentinel does not match memory at target index (unterminated) +// error +// backend=stage1 +// target=native // // :4:29: error: slice-sentinel does not match memory at target index // :12:29: error: slice-sentinel does not match memory at target index diff --git a/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_target-sentinel.zig b/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_target-sentinel.zig index 597a493705bf93750ce5e9414e1534583891bde3..b204cfc6840d6bc557585665348883f063e63730 100644 --- a/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_target-sentinel.zig +++ b/test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_target-sentinel.zig @@ -54,7 +54,9 @@ export fn foo_slice() void { } } -// comptime slice-sentinel does not match target-sentinel +// error +// backend=stage1 +// target=native // // :4:29: error: slice-sentinel does not match target-sentinel // :12:29: error: slice-sentinel does not match target-sentinel diff --git a/test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_terminated.zig b/test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_terminated.zig index d5fc64ea847eff6dd390e92265e592a1ccdc262f..82c19126c0bc97729cde29149e6fa79e0c099e44 100644 --- a/test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_terminated.zig +++ b/test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_terminated.zig @@ -54,7 +54,9 @@ export fn foo_slice() void { } } -// comptime slice-sentinel is out of bounds (terminated) +// error +// backend=stage1 +// target=native // // :4:29: error: out of bounds slice // :12:29: error: out of bounds slice diff --git a/test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig b/test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig index 05a499ca8a8697aa388d6f949b7ffe6b9c64e807..952b17600a80e7b4503152802cb5a930ddc05634 100644 --- a/test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig +++ b/test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig @@ -54,7 +54,9 @@ export fn foo_slice() void { } } -// comptime slice-sentinel is out of bounds (unterminated) +// error +// backend=stage1 +// target=native // // :4:29: error: slice-sentinel is out of bounds // :12:29: error: slice-sentinel is out of bounds diff --git a/test/compile_errors/stage1/obj/comptime_slice_of_an_undefined_slice.zig b/test/compile_errors/stage1/obj/comptime_slice_of_an_undefined_slice.zig index b56feddc02144d5d77b89940589e1a503aa07121..4aa519f41ee031d2f7a103ab5505cfde1a887599 100644 --- a/test/compile_errors/stage1/obj/comptime_slice_of_an_undefined_slice.zig +++ b/test/compile_errors/stage1/obj/comptime_slice_of_an_undefined_slice.zig @@ -4,6 +4,8 @@ comptime { _ = b; } -// comptime slice of an undefined slice +// error +// backend=stage1 +// target=native // // tmp.zig:3:14: error: slice of undefined diff --git a/test/compile_errors/stage1/obj/comptime_slice_of_undefined_pointer_non-zero_len.zig b/test/compile_errors/stage1/obj/comptime_slice_of_undefined_pointer_non-zero_len.zig index bcddd1d8662ef9ed2ad9b36cb2fde499e76754b1..ec7fbdc6e2d7f8badd0fbae6c4ee71d245cbef64 100644 --- a/test/compile_errors/stage1/obj/comptime_slice_of_undefined_pointer_non-zero_len.zig +++ b/test/compile_errors/stage1/obj/comptime_slice_of_undefined_pointer_non-zero_len.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = slice; } -// comptime slice of undefined pointer non-zero len +// error +// backend=stage1 +// target=native // // tmp.zig:2:41: error: non-zero length slice of undefined pointer diff --git a/test/compile_errors/stage1/obj/comptime_struct_field_no_init_value.zig b/test/compile_errors/stage1/obj/comptime_struct_field_no_init_value.zig index c3de76a7948c7e3649cbe572d4207269657accf9..b889911a4dcf253ec2e00941ef50e47494a93717 100644 --- a/test/compile_errors/stage1/obj/comptime_struct_field_no_init_value.zig +++ b/test/compile_errors/stage1/obj/comptime_struct_field_no_init_value.zig @@ -6,6 +6,8 @@ export fn entry() void { _ = f; } -// comptime struct field, no init value +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: comptime field without default initialization value diff --git a/test/compile_errors/stage1/obj/const_frame_cast_to_anyframe.zig b/test/compile_errors/stage1/obj/const_frame_cast_to_anyframe.zig index 1e6cdba50727e1660ca75cbf599e5f870a8841de..affdb953d72f317ea094a806b6c08aa05c135256 100644 --- a/test/compile_errors/stage1/obj/const_frame_cast_to_anyframe.zig +++ b/test/compile_errors/stage1/obj/const_frame_cast_to_anyframe.zig @@ -11,7 +11,9 @@ fn func() void { suspend {} } -// const frame cast to anyframe +// error +// backend=stage1 +// target=native // // tmp.zig:3:12: error: expected type 'anyframe', found '*const @Frame(func)' // tmp.zig:7:24: error: expected type 'anyframe', found '*const @Frame(func)' diff --git a/test/compile_errors/stage1/obj/const_is_a_statement_not_an_expression.zig b/test/compile_errors/stage1/obj/const_is_a_statement_not_an_expression.zig index 4396407dd174791bf2f92d796095cd50f1d9bd01..b90878abeb653a690cc8e018f9c6fd5f8a13d9f2 100644 --- a/test/compile_errors/stage1/obj/const_is_a_statement_not_an_expression.zig +++ b/test/compile_errors/stage1/obj/const_is_a_statement_not_an_expression.zig @@ -2,6 +2,8 @@ export fn f() void { (const a = 0); } -// const is a statement, not an expression +// error +// backend=stage1 +// target=native // // tmp.zig:2:6: error: expected expression, found 'const' diff --git a/test/compile_errors/stage1/obj/container_init_with_non-type.zig b/test/compile_errors/stage1/obj/container_init_with_non-type.zig index 6464555df5f3335b0884f24133ce6fa09b5b518e..3364b2f5b61e1f08e1ca3e0b28b2355a069eaba5 100644 --- a/test/compile_errors/stage1/obj/container_init_with_non-type.zig +++ b/test/compile_errors/stage1/obj/container_init_with_non-type.zig @@ -3,6 +3,8 @@ const a = zero{1}; export fn entry() usize { return @sizeOf(@TypeOf(a)); } -// container init with non-type +// error +// backend=stage1 +// target=native // // tmp.zig:2:11: error: expected type 'type', found 'i32' diff --git a/test/compile_errors/stage1/obj/control_flow_uses_comptime_var_at_runtime.zig b/test/compile_errors/stage1/obj/control_flow_uses_comptime_var_at_runtime.zig index ee2c0234c346d12df7c19182ce0fd7b7d550d669..cb2c3e9f6eed4abb8a31959366ff92c7bbc6d6b8 100644 --- a/test/compile_errors/stage1/obj/control_flow_uses_comptime_var_at_runtime.zig +++ b/test/compile_errors/stage1/obj/control_flow_uses_comptime_var_at_runtime.zig @@ -7,7 +7,9 @@ export fn foo() void { fn bar() void { } -// control flow uses comptime var at runtime +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: control flow attempts to use compile-time variable at runtime // tmp.zig:3:24: note: compile-time variable assigned here diff --git a/test/compile_errors/stage1/obj/control_reaches_end_of_non-void_function.zig b/test/compile_errors/stage1/obj/control_reaches_end_of_non-void_function.zig index 13d2876823ed19d35f49393c2473477cacf237d9..e15c1bd40bcb827a1d99c629de9f9ecc381cccde 100644 --- a/test/compile_errors/stage1/obj/control_reaches_end_of_non-void_function.zig +++ b/test/compile_errors/stage1/obj/control_reaches_end_of_non-void_function.zig @@ -1,6 +1,8 @@ fn a() i32 {} export fn entry() void { _ = a(); } -// control reaches end of non-void function +// error +// backend=stage1 +// target=native // // tmp.zig:1:12: error: expected type 'i32', found 'void' diff --git a/test/compile_errors/stage1/obj/declaration_between_fields.zig b/test/compile_errors/stage1/obj/declaration_between_fields.zig index 6e6b60f2e4746e22e762898106054feb5c3cad11..25a1ff5abc7450a896cdd73605b2b6d523f12d78 100644 --- a/test/compile_errors/stage1/obj/declaration_between_fields.zig +++ b/test/compile_errors/stage1/obj/declaration_between_fields.zig @@ -15,7 +15,9 @@ comptime { _ = S; } -// declaration between fields +// error +// backend=stage1 +// target=native // // tmp.zig:9:5: error: declarations are not allowed between container fields // tmp.zig:5:5: note: field before declarations here diff --git a/test/compile_errors/stage1/obj/declaration_with_same_name_as_primitive_must_use_special_syntax.zig b/test/compile_errors/stage1/obj/declaration_with_same_name_as_primitive_must_use_special_syntax.zig index c10f397da4db8706a3af1a6af70ab7a61c583e28..46b0257ed5673fa2e417dd0ac159ad736f33ec7d 100644 --- a/test/compile_errors/stage1/obj/declaration_with_same_name_as_primitive_must_use_special_syntax.zig +++ b/test/compile_errors/stage1/obj/declaration_with_same_name_as_primitive_must_use_special_syntax.zig @@ -4,7 +4,9 @@ export fn entry() void { _ = a; } -// declaration with same name as primitive must use special syntax +// error +// backend=stage1 +// target=native // // tmp.zig:1:7: error: name shadows primitive 'u8' // tmp.zig:1:7: note: consider using @"u8" to disambiguate diff --git a/test/compile_errors/stage1/obj/deduplicate_undeclared_identifier.zig b/test/compile_errors/stage1/obj/deduplicate_undeclared_identifier.zig index 1c9d6c3d316e27d871dbb3cfe864decddc75dca8..1e3b3bf6db35bab027549f97f8d93b781541eee6 100644 --- a/test/compile_errors/stage1/obj/deduplicate_undeclared_identifier.zig +++ b/test/compile_errors/stage1/obj/deduplicate_undeclared_identifier.zig @@ -5,6 +5,8 @@ export fn b() void { x += 1; } -// deduplicate undeclared identifier +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: use of undeclared identifier 'x' diff --git a/test/compile_errors/stage1/obj/deref_on_undefined_value.zig b/test/compile_errors/stage1/obj/deref_on_undefined_value.zig index 607f6ea5e0b92c87b4e0ff0c67b117c2476cc436..f64d567a26c242685a23f91fb3752134f97b4940 100644 --- a/test/compile_errors/stage1/obj/deref_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/deref_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a.*; } -// deref on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: attempt to dereference undefined value diff --git a/test/compile_errors/stage1/obj/deref_slice_and_get_len_field.zig b/test/compile_errors/stage1/obj/deref_slice_and_get_len_field.zig index 2fa5ff6133b2428c48e5cd430585a403d0f82521..98097597cc8f4db61359dd8b2751a63edd4c3dd0 100644 --- a/test/compile_errors/stage1/obj/deref_slice_and_get_len_field.zig +++ b/test/compile_errors/stage1/obj/deref_slice_and_get_len_field.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = a.*.len; } -// deref slice and get len field +// error +// backend=stage1 +// target=native // // tmp.zig:3:10: error: attempt to dereference non-pointer type '[]u8' diff --git a/test/compile_errors/stage1/obj/dereference_an_array.zig b/test/compile_errors/stage1/obj/dereference_an_array.zig index 713c65578491047ef03f11d01f28e411ff93ee27..0dd91f70e53aa347ea69ddd58c570dc119e0aa65 100644 --- a/test/compile_errors/stage1/obj/dereference_an_array.zig +++ b/test/compile_errors/stage1/obj/dereference_an_array.zig @@ -7,6 +7,8 @@ pub fn pass(in: []u8) []u8 { export fn entry() usize { return @sizeOf(@TypeOf(pass)); } -// dereference an array +// error +// backend=stage1 +// target=native // // tmp.zig:4:10: error: attempt to dereference non-pointer type '[10]u8' diff --git a/test/compile_errors/stage1/obj/dereference_unknown_length_pointer.zig b/test/compile_errors/stage1/obj/dereference_unknown_length_pointer.zig index 22ad181fb221afcfe7fb0fe59f1c7ead214835aa..c305e4bc98abcae6029bd64f708e8ecf2b022a5b 100644 --- a/test/compile_errors/stage1/obj/dereference_unknown_length_pointer.zig +++ b/test/compile_errors/stage1/obj/dereference_unknown_length_pointer.zig @@ -2,6 +2,8 @@ export fn entry(x: [*]i32) i32 { return x.*; } -// dereference unknown length pointer +// error +// backend=stage1 +// target=native // // tmp.zig:2:13: error: index syntax required for unknown-length pointer type '[*]i32' diff --git a/test/compile_errors/stage1/obj/direct_struct_loop.zig b/test/compile_errors/stage1/obj/direct_struct_loop.zig index 25b3c724c3bc144bd1f5922dfdbe40407dcffdb7..3062e617d68ab393aa0238d4575a3c48667fba59 100644 --- a/test/compile_errors/stage1/obj/direct_struct_loop.zig +++ b/test/compile_errors/stage1/obj/direct_struct_loop.zig @@ -1,6 +1,8 @@ const A = struct { a : A, }; export fn entry() usize { return @sizeOf(A); } -// direct struct loop +// error +// backend=stage1 +// target=native // // tmp.zig:1:11: error: struct 'A' depends on itself diff --git a/test/compile_errors/stage1/obj/directly_embedding_opaque_type_in_struct_and_union.zig b/test/compile_errors/stage1/obj/directly_embedding_opaque_type_in_struct_and_union.zig index 811fc00f50c7b13533d756df7bbd398b9904d88e..8b8d84ad2a649ca8977b02a04a50fa88d0fa38d9 100644 --- a/test/compile_errors/stage1/obj/directly_embedding_opaque_type_in_struct_and_union.zig +++ b/test/compile_errors/stage1/obj/directly_embedding_opaque_type_in_struct_and_union.zig @@ -20,7 +20,9 @@ export fn c() void { _ = qux; } -// directly embedding opaque type in struct and union +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: opaque types have unknown size and therefore cannot be directly embedded in structs // tmp.zig:7:5: error: opaque types have unknown size and therefore cannot be directly embedded in unions diff --git a/test/compile_errors/stage1/obj/disallow_coercion_from_non-null-terminated_pointer_to_null-terminated_pointer.zig b/test/compile_errors/stage1/obj/disallow_coercion_from_non-null-terminated_pointer_to_null-terminated_pointer.zig index a8467ddc871f829f4f7f323ac1b7ad5e3a13fa5f..1d0a6216dde20f319ede3315fbd986f4ccd01aa0 100644 --- a/test/compile_errors/stage1/obj/disallow_coercion_from_non-null-terminated_pointer_to_null-terminated_pointer.zig +++ b/test/compile_errors/stage1/obj/disallow_coercion_from_non-null-terminated_pointer_to_null-terminated_pointer.zig @@ -5,6 +5,8 @@ pub fn main() void { _ = puts(no_zero_ptr); } -// disallow coercion from non-null-terminated pointer to null-terminated pointer +// error +// backend=stage1 +// target=native // // tmp.zig:5:14: error: expected type '[*:0]const u8', found '[*]const u8' diff --git a/test/compile_errors/stage1/obj/discarding_error_value.zig b/test/compile_errors/stage1/obj/discarding_error_value.zig index 966a43a47c9f7e842d9b29d7e6cff15c762d3111..dcfa22e8cb3412e1b2741267973eca6d9e3c3884 100644 --- a/test/compile_errors/stage1/obj/discarding_error_value.zig +++ b/test/compile_errors/stage1/obj/discarding_error_value.zig @@ -5,6 +5,8 @@ fn foo() !void { return error.OutOfMemory; } -// discarding error value +// error +// backend=stage1 +// target=native // // tmp.zig:2:12: error: error is discarded. consider using `try`, `catch`, or `if` diff --git a/test/compile_errors/stage1/obj/div_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/div_assign_on_undefined_value.zig index 40c31649fbdd29c916cd64a1db68804bd0ed4812..5f18e6286a27390aa974a1c493dd55ccf5de63a6 100644 --- a/test/compile_errors/stage1/obj/div_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/div_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a /= a; } -// div assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/div_on_undefined_value.zig b/test/compile_errors/stage1/obj/div_on_undefined_value.zig index 17af3fa2217a39e22c85bf662bd3f1d8e04ce740..9857b1c77981d947f731c13c8411d215a8a84f80 100644 --- a/test/compile_errors/stage1/obj/div_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/div_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a / a; } -// div on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/division_by_zero.zig b/test/compile_errors/stage1/obj/division_by_zero.zig index 178d1d935be69ed11795bd21a1dd6f0f2e78a746..3023f0c6f3f729891880630b31d43754fc1957ed 100644 --- a/test/compile_errors/stage1/obj/division_by_zero.zig +++ b/test/compile_errors/stage1/obj/division_by_zero.zig @@ -8,7 +8,9 @@ export fn entry2() usize { return @sizeOf(@TypeOf(lit_float_x)); } export fn entry3() usize { return @sizeOf(@TypeOf(int_x)); } export fn entry4() usize { return @sizeOf(@TypeOf(float_x)); } -// division by zero +// error +// backend=stage1 +// target=native // // tmp.zig:1:21: error: division by zero // tmp.zig:2:25: error: division by zero diff --git a/test/compile_errors/stage1/obj/dont_implicit_cast_double_pointer_to_anyopaque.zig b/test/compile_errors/stage1/obj/dont_implicit_cast_double_pointer_to_anyopaque.zig index 5894103f1c2962c67fb1e68158fed1f7425b8745..f61dec2ee07f86f50a1188d1e8d50697cf997892 100644 --- a/test/compile_errors/stage1/obj/dont_implicit_cast_double_pointer_to_anyopaque.zig +++ b/test/compile_errors/stage1/obj/dont_implicit_cast_double_pointer_to_anyopaque.zig @@ -6,6 +6,8 @@ export fn entry() void { _ = ptr2; } -// don't implicit cast double pointer to *anyopaque +// error +// backend=stage1 +// target=native // // tmp.zig:5:29: error: expected type '*anyopaque', found '**u32' diff --git a/test/compile_errors/stage1/obj/double_optional_on_main_return_value.zig b/test/compile_errors/stage1/obj/double_optional_on_main_return_value.zig index c85706bc8775e8ecaa12b1c13249d812520410c0..c61ac400baf048c781f0bee5a4d779696d7583ec 100644 --- a/test/compile_errors/stage1/obj/double_optional_on_main_return_value.zig +++ b/test/compile_errors/stage1/obj/double_optional_on_main_return_value.zig @@ -1,6 +1,8 @@ pub fn main() ??void { } -// double ?? on main return value +// error +// backend=stage1 +// target=native // // error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8' diff --git a/test/compile_errors/stage1/obj/duplicate_boolean_switch_value.zig b/test/compile_errors/stage1/obj/duplicate_boolean_switch_value.zig index 8c496d5e19fcbc6c23fa9cea9b57f81f0ff1a9e7..5b85c0a2eb93e20680e5dbc78b27d0890ac37c96 100644 --- a/test/compile_errors/stage1/obj/duplicate_boolean_switch_value.zig +++ b/test/compile_errors/stage1/obj/duplicate_boolean_switch_value.zig @@ -15,7 +15,9 @@ comptime { _ = x; } -// duplicate boolean switch value +// error +// backend=stage1 +// target=native // // tmp.zig:5:9: error: duplicate switch value // tmp.zig:13:9: error: duplicate switch value diff --git a/test/compile_errors/stage1/obj/duplicate_enum_field.zig b/test/compile_errors/stage1/obj/duplicate_enum_field.zig index 2aee3cc2dca5bca31552712de007f3683482ae2e..cd024270bd10f18aefd50c91527404b236c7a45f 100644 --- a/test/compile_errors/stage1/obj/duplicate_enum_field.zig +++ b/test/compile_errors/stage1/obj/duplicate_enum_field.zig @@ -8,7 +8,9 @@ export fn entry() void { _ = a; } -// duplicate enum field +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: duplicate enum field: 'Bar' // tmp.zig:2:5: note: other field here diff --git a/test/compile_errors/stage1/obj/duplicate_error_in_switch.zig b/test/compile_errors/stage1/obj/duplicate_error_in_switch.zig index bca59056c383c09b196596bb1e2e6d2da15fa233..140a14ec81969d9d8eb5fb8d12cdce57c607fa09 100644 --- a/test/compile_errors/stage1/obj/duplicate_error_in_switch.zig +++ b/test/compile_errors/stage1/obj/duplicate_error_in_switch.zig @@ -14,7 +14,9 @@ fn foo(x: i32) !void { } } -// duplicate error in switch +// error +// backend=stage1 +// target=native // // tmp.zig:5:14: error: duplicate switch value: '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set.Foo' // tmp.zig:3:14: note: other value here diff --git a/test/compile_errors/stage1/obj/duplicate_error_value_in_error_set.zig b/test/compile_errors/stage1/obj/duplicate_error_value_in_error_set.zig index 90457562b2ce5d29a0bff76f039a86d9759d57fb..30d3bee8ab9d8f3dbb4ac1f6f0e1191fbade1a8f 100644 --- a/test/compile_errors/stage1/obj/duplicate_error_value_in_error_set.zig +++ b/test/compile_errors/stage1/obj/duplicate_error_value_in_error_set.zig @@ -7,7 +7,9 @@ export fn entry() void { _ = a; } -// duplicate error value in error set +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: duplicate error set field 'Bar' // tmp.zig:2:5: note: previous declaration here diff --git a/test/compile_errors/stage1/obj/duplicate_field_in_struct_value_expression.zig b/test/compile_errors/stage1/obj/duplicate_field_in_struct_value_expression.zig index 6df71430d9635fa801a9aba8f5d8eaee887b8756..1c0bac75e2ee9b1ab3a8173dd41059e83379ee7f 100644 --- a/test/compile_errors/stage1/obj/duplicate_field_in_struct_value_expression.zig +++ b/test/compile_errors/stage1/obj/duplicate_field_in_struct_value_expression.zig @@ -13,6 +13,8 @@ export fn f() void { _ = a; } -// duplicate field in struct value expression +// error +// backend=stage1 +// target=native // // tmp.zig:11:9: error: duplicate field diff --git a/test/compile_errors/stage1/obj/duplicate_struct_field.zig b/test/compile_errors/stage1/obj/duplicate_struct_field.zig index d1fd05aacc44f59925459566f0b47f78bfaab819..93afdef70eded4469ec9def53b25ab34a43f7836 100644 --- a/test/compile_errors/stage1/obj/duplicate_struct_field.zig +++ b/test/compile_errors/stage1/obj/duplicate_struct_field.zig @@ -7,7 +7,9 @@ export fn entry() void { _ = a; } -// duplicate struct field +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: duplicate struct field: 'Bar' // tmp.zig:2:5: note: other field here diff --git a/test/compile_errors/stage1/obj/duplicate_union_field.zig b/test/compile_errors/stage1/obj/duplicate_union_field.zig index a8bff106c689367a42a3677979c977fc732c3f94..5cbdcb7820a6559e19cd613c45aa52d41d7a76b2 100644 --- a/test/compile_errors/stage1/obj/duplicate_union_field.zig +++ b/test/compile_errors/stage1/obj/duplicate_union_field.zig @@ -7,7 +7,9 @@ export fn entry() void { _ = a; } -// duplicate union field +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: duplicate union field: 'Bar' // tmp.zig:2:5: note: other field here diff --git a/test/compile_errors/stage1/obj/embedFile_with_bogus_file.zig b/test/compile_errors/stage1/obj/embedFile_with_bogus_file.zig index e50e091909eb2bdd6708d13a4f0d49980223fd27..a03949b40a4295082f15b68c348738d89cb42f18 100644 --- a/test/compile_errors/stage1/obj/embedFile_with_bogus_file.zig +++ b/test/compile_errors/stage1/obj/embedFile_with_bogus_file.zig @@ -2,6 +2,8 @@ const resource = @embedFile("bogus.txt",); export fn entry() usize { return @sizeOf(@TypeOf(resource)); } -// @embedFile with bogus file +// error +// backend=stage1 +// target=native // // tmp.zig:1:29: error: unable to find ' diff --git a/test/compile_errors/stage1/obj/empty_for_loop_body.zig b/test/compile_errors/stage1/obj/empty_for_loop_body.zig index 6e042f71e47e647cead2f88b992148bc67f4e7cd..b824c9313181ebd36819aedf1bb1d5f942652743 100644 --- a/test/compile_errors/stage1/obj/empty_for_loop_body.zig +++ b/test/compile_errors/stage1/obj/empty_for_loop_body.zig @@ -2,6 +2,8 @@ export fn a() void { for(undefined) |x|; } -// empty for loop body +// error +// backend=stage1 +// target=native // // tmp.zig:2:23: error: expected block or assignment, found ';' diff --git a/test/compile_errors/stage1/obj/empty_if_body.zig b/test/compile_errors/stage1/obj/empty_if_body.zig index a81973396fb2cfaec6049eb6e2b8cf152204d140..0a7b5b1b8b70a0ab536c4ca97516be800b3b0fab 100644 --- a/test/compile_errors/stage1/obj/empty_if_body.zig +++ b/test/compile_errors/stage1/obj/empty_if_body.zig @@ -2,6 +2,8 @@ export fn a() void { if(true); } -// empty if body +// error +// backend=stage1 +// target=native // // tmp.zig:2:13: error: expected block or assignment, found ';' diff --git a/test/compile_errors/stage1/obj/empty_switch_on_an_integer.zig b/test/compile_errors/stage1/obj/empty_switch_on_an_integer.zig index eb0bdbab19bbfc3a54da9bb8e3c44058127eca42..a7b8e2a81bd47da183d12713a52efa068450c53d 100644 --- a/test/compile_errors/stage1/obj/empty_switch_on_an_integer.zig +++ b/test/compile_errors/stage1/obj/empty_switch_on_an_integer.zig @@ -3,6 +3,8 @@ export fn entry() void { switch(x) {} } -// empty switch on an integer +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: switch must handle all possibilities diff --git a/test/compile_errors/stage1/obj/empty_while_loop_body.zig b/test/compile_errors/stage1/obj/empty_while_loop_body.zig index 3a186f1a2be37997652a0948bf99d175acc29339..01b21325188cec26a31063713b72f16f7bde2d26 100644 --- a/test/compile_errors/stage1/obj/empty_while_loop_body.zig +++ b/test/compile_errors/stage1/obj/empty_while_loop_body.zig @@ -2,6 +2,8 @@ export fn a() void { while(true); } -// empty while loop body +// error +// backend=stage1 +// target=native // // tmp.zig:2:16: error: expected block or assignment, found ';' diff --git a/test/compile_errors/stage1/obj/endless_loop_in_function_evaluation.zig b/test/compile_errors/stage1/obj/endless_loop_in_function_evaluation.zig index fa422ba58844c6aca4abb105493a6530aa2484e3..302ee242e094611b64e0dcbee97e895b06016c05 100644 --- a/test/compile_errors/stage1/obj/endless_loop_in_function_evaluation.zig +++ b/test/compile_errors/stage1/obj/endless_loop_in_function_evaluation.zig @@ -5,6 +5,8 @@ fn fibonacci(x: i32) i32 { export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); } -// endless loop in function evaluation +// error +// backend=stage1 +// target=native // // tmp.zig:3:21: error: evaluation exceeded 1000 backwards branches diff --git a/test/compile_errors/stage1/obj/enum_field_value_references_enum.zig b/test/compile_errors/stage1/obj/enum_field_value_references_enum.zig index 02dcfc1f9d39916831de7f1367cbc2ed00284f9e..ebf32db5e04242bfd89f4a4befda66f347f6451e 100644 --- a/test/compile_errors/stage1/obj/enum_field_value_references_enum.zig +++ b/test/compile_errors/stage1/obj/enum_field_value_references_enum.zig @@ -8,6 +8,8 @@ export fn entry() void { } const D = 1; -// enum field value references enum +// error +// backend=stage1 +// target=native // // tmp.zig:1:17: error: enum 'Foo' depends on itself diff --git a/test/compile_errors/stage1/obj/enum_in_field_count_range_but_not_matching_tag.zig b/test/compile_errors/stage1/obj/enum_in_field_count_range_but_not_matching_tag.zig index dc90c467df23672a5c4d1dc4b4f63ecc69cf7eb2..e783cbee5293c2d755c32bd167a26e97528d1826 100644 --- a/test/compile_errors/stage1/obj/enum_in_field_count_range_but_not_matching_tag.zig +++ b/test/compile_errors/stage1/obj/enum_in_field_count_range_but_not_matching_tag.zig @@ -7,7 +7,9 @@ export fn entry() void { _ = x; } -// enum in field count range but not matching tag +// error +// backend=stage1 +// target=native // // tmp.zig:6:13: error: enum 'Foo' has no tag matching integer value 0 // tmp.zig:1:13: note: 'Foo' declared here diff --git a/test/compile_errors/stage1/obj/enum_value_already_taken.zig b/test/compile_errors/stage1/obj/enum_value_already_taken.zig index 9939553c412ae4f42b764cd5afd9e78eb672e9cb..60e88f0062de86e0d1dad3064773dc338e1fd93c 100644 --- a/test/compile_errors/stage1/obj/enum_value_already_taken.zig +++ b/test/compile_errors/stage1/obj/enum_value_already_taken.zig @@ -10,7 +10,9 @@ export fn entry() void { _ = x; } -// enum value already taken +// error +// backend=stage1 +// target=native // // tmp.zig:6:5: error: enum tag value 60 already taken // tmp.zig:4:5: note: other occurrence here diff --git a/test/compile_errors/stage1/obj/enum_with_0_fields.zig b/test/compile_errors/stage1/obj/enum_with_0_fields.zig index 10559d15b3c44eb4e0747a2255cdbd34019b94ca..9ee18f51ca21c32cb7d35173c0faa9309983e1d2 100644 --- a/test/compile_errors/stage1/obj/enum_with_0_fields.zig +++ b/test/compile_errors/stage1/obj/enum_with_0_fields.zig @@ -1,5 +1,7 @@ const Foo = enum {}; -// enum with 0 fields +// error +// backend=stage1 +// target=native // // tmp.zig:1:13: error: enum declarations must have at least one tag diff --git a/test/compile_errors/stage1/obj/enum_with_declarations_unavailable_for_reify_type.zig b/test/compile_errors/stage1/obj/enum_with_declarations_unavailable_for_reify_type.zig index 4a27caab3d474616135cd86466f595c2311c7699..ffe9a2a78acabed0e4b018e63f88f76e9e4bb74d 100644 --- a/test/compile_errors/stage1/obj/enum_with_declarations_unavailable_for_reify_type.zig +++ b/test/compile_errors/stage1/obj/enum_with_declarations_unavailable_for_reify_type.zig @@ -2,6 +2,8 @@ export fn entry() void { _ = @Type(@typeInfo(enum { foo, const bar = 1; })); } -// enum with declarations unavailable for @Type +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: Type.Enum.decls must be empty for @Type diff --git a/test/compile_errors/stage1/obj/error_equality_but_sets_have_no_common_members.zig b/test/compile_errors/stage1/obj/error_equality_but_sets_have_no_common_members.zig index 433f6d50e33a12b394da4c3d6cebfb659243fd88..d42169b5036f40ba0725358de24a370d58b85bc9 100644 --- a/test/compile_errors/stage1/obj/error_equality_but_sets_have_no_common_members.zig +++ b/test/compile_errors/stage1/obj/error_equality_but_sets_have_no_common_members.zig @@ -9,6 +9,8 @@ fn foo(x: Set1) void { } } -// error equality but sets have no common members +// error +// backend=stage1 +// target=native // // tmp.zig:7:11: error: error sets 'Set1' and 'Set2' have no common errors diff --git a/test/compile_errors/stage1/obj/error_not_handled_in_switch.zig b/test/compile_errors/stage1/obj/error_not_handled_in_switch.zig index a69c538eacceb278154454f197d96e7ef7ff42a0..12ee35daef7d556a854562dc3afdec5bb17ab7d0 100644 --- a/test/compile_errors/stage1/obj/error_not_handled_in_switch.zig +++ b/test/compile_errors/stage1/obj/error_not_handled_in_switch.zig @@ -12,7 +12,9 @@ fn foo(x: i32) !void { } } -// error not handled in switch +// error +// backend=stage1 +// target=native // // tmp.zig:2:26: error: error.Baz not handled in switch // tmp.zig:2:26: error: error.Bar not handled in switch diff --git a/test/compile_errors/stage1/obj/error_note_for_function_parameter_incompatibility.zig b/test/compile_errors/stage1/obj/error_note_for_function_parameter_incompatibility.zig index 5014d01a3daf24b0cc7f0c141e148b35cc417936..edc421d8f43cc25f806dff0f26b73493c8b3d451 100644 --- a/test/compile_errors/stage1/obj/error_note_for_function_parameter_incompatibility.zig +++ b/test/compile_errors/stage1/obj/error_note_for_function_parameter_incompatibility.zig @@ -4,7 +4,9 @@ export fn entry() void { do_the_thing(bar); } -// error note for function parameter incompatibility +// error +// backend=stage1 +// target=native // // tmp.zig:4:18: error: expected type 'fn(i32) void', found 'fn(bool) void // tmp.zig:4:18: note: parameter 0: 'bool' cannot cast into 'i32' diff --git a/test/compile_errors/stage1/obj/error_union_operator_with_non_error_set_LHS.zig b/test/compile_errors/stage1/obj/error_union_operator_with_non_error_set_LHS.zig index 40b5872fc81a6cd8b5d27e5eee4f6ada1afe18ae..785e42fb9b6d2bb0cc935964d8c8145ef2c80f33 100644 --- a/test/compile_errors/stage1/obj/error_union_operator_with_non_error_set_LHS.zig +++ b/test/compile_errors/stage1/obj/error_union_operator_with_non_error_set_LHS.zig @@ -4,6 +4,8 @@ comptime { _ = x; } -// error union operator with non error set LHS +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expected error set type, found type 'i32' diff --git a/test/compile_errors/stage1/obj/error_when_evaluating_return_type.zig b/test/compile_errors/stage1/obj/error_when_evaluating_return_type.zig index 60baa1c5b4878be08150d0dbdc3b160791e09de9..60731740b79dfaff5366a283ef4ac2b20d4d1f04 100644 --- a/test/compile_errors/stage1/obj/error_when_evaluating_return_type.zig +++ b/test/compile_errors/stage1/obj/error_when_evaluating_return_type.zig @@ -10,6 +10,8 @@ export fn entry() void { _ = rule_set; } -// error when evaluating return type +// error +// backend=stage1 +// target=native // // tmp.zig:2:19: error: expected type 'i32', found 'type' diff --git a/test/compile_errors/stage1/obj/exceeded_maximum_bit_width_of_integer.zig b/test/compile_errors/stage1/obj/exceeded_maximum_bit_width_of_integer.zig index e1784de63e6aa220656a42829a5e6e20a6c027a8..2a3c795f8187ade0b6ee9b599dd76bad27f079c1 100644 --- a/test/compile_errors/stage1/obj/exceeded_maximum_bit_width_of_integer.zig +++ b/test/compile_errors/stage1/obj/exceeded_maximum_bit_width_of_integer.zig @@ -7,7 +7,9 @@ export fn entry2() void { _ = x; } -// exceeded maximum bit width of integer +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: primitive integer type 'u65536' exceeds maximum bit width of 65535 // tmp.zig:6:12: error: primitive integer type 'i65536' exceeds maximum bit width of 65535 diff --git a/test/compile_errors/stage1/obj/explicit_cast_float_literal_to_integer_when_there_is_a_fraction_component.zig b/test/compile_errors/stage1/obj/explicit_cast_float_literal_to_integer_when_there_is_a_fraction_component.zig index eaa2be84c7adb813c5c7a1db38fcfcd765f99067..696fef57fa83c849e1b776b394fdbb76d592bfb3 100644 --- a/test/compile_errors/stage1/obj/explicit_cast_float_literal_to_integer_when_there_is_a_fraction_component.zig +++ b/test/compile_errors/stage1/obj/explicit_cast_float_literal_to_integer_when_there_is_a_fraction_component.zig @@ -2,6 +2,8 @@ export fn entry() i32 { return @as(i32, 12.34); } -// explicit cast float literal to integer when there is a fraction component +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: fractional component prevents float value 12.340000 from being casted to type 'i32' diff --git a/test/compile_errors/stage1/obj/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig b/test/compile_errors/stage1/obj/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig index 68d78e0f9228b94e40f52301c3a2638d0c7e3b28..4a41920107e283aa1dae9ae42ae7554cba1e8bd1 100644 --- a/test/compile_errors/stage1/obj/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig +++ b/test/compile_errors/stage1/obj/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig @@ -6,6 +6,8 @@ comptime { _ = y; } -// explicit error set cast known at comptime violates error sets +// error +// backend=stage1 +// target=native // // tmp.zig:5:13: error: error.B not a member of error set 'Set2' diff --git a/test/compile_errors/stage1/obj/explicitly_casting_non_tag_type_to_enum.zig b/test/compile_errors/stage1/obj/explicitly_casting_non_tag_type_to_enum.zig index e7c4d5f5d948cf6a900fd6122899d69f2357b17e..1999fd70a7750f7fb0d51ae7b9476d6fe28d99c3 100644 --- a/test/compile_errors/stage1/obj/explicitly_casting_non_tag_type_to_enum.zig +++ b/test/compile_errors/stage1/obj/explicitly_casting_non_tag_type_to_enum.zig @@ -11,6 +11,8 @@ export fn entry() void { _ = x; } -// explicitly casting non tag type to enum +// error +// backend=stage1 +// target=native // // tmp.zig:10:31: error: expected integer type, found 'f32' diff --git a/test/compile_errors/stage1/obj/export_function_with_comptime_parameter.zig b/test/compile_errors/stage1/obj/export_function_with_comptime_parameter.zig index 0f300f324bba1a06add37a6ff8ab727c037db983..ccfda1ba67eb7757532b4f60d597c7864ac77074 100644 --- a/test/compile_errors/stage1/obj/export_function_with_comptime_parameter.zig +++ b/test/compile_errors/stage1/obj/export_function_with_comptime_parameter.zig @@ -2,6 +2,8 @@ export fn foo(comptime x: i32, y: i32) i32{ return x + y; } -// export function with comptime parameter +// error +// backend=stage1 +// target=native // // tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C' diff --git a/test/compile_errors/stage1/obj/export_generic_function.zig b/test/compile_errors/stage1/obj/export_generic_function.zig index 3fb4375ed46732fc90d947a4154e965860e00ece..9f6bcd4cf489ab8375e0d63d2ed35c62ff3b7336 100644 --- a/test/compile_errors/stage1/obj/export_generic_function.zig +++ b/test/compile_errors/stage1/obj/export_generic_function.zig @@ -3,6 +3,8 @@ export fn foo(num: anytype) i32 { return 0; } -// export generic function +// error +// backend=stage1 +// target=native // // tmp.zig:1:15: error: parameter of type 'anytype' not allowed in function with calling convention 'C' diff --git a/test/compile_errors/stage1/obj/exported_async_function.zig b/test/compile_errors/stage1/obj/exported_async_function.zig index 296a5950e9a72ba477baa959c1787031b81ae36e..b9ac591227d95ea9cf01595a357c97d4e00950fb 100644 --- a/test/compile_errors/stage1/obj/exported_async_function.zig +++ b/test/compile_errors/stage1/obj/exported_async_function.zig @@ -1,5 +1,7 @@ export fn foo() callconv(.Async) void {} -// exported async function +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: exported function cannot be async diff --git a/test/compile_errors/stage1/obj/exported_enum_without_explicit_integer_tag_type.zig b/test/compile_errors/stage1/obj/exported_enum_without_explicit_integer_tag_type.zig index 3d6e63db4354f3c46b4ac170032addf3346c335a..c432bedd6b7179ad8988fcfb7b843d54dffc7f1e 100644 --- a/test/compile_errors/stage1/obj/exported_enum_without_explicit_integer_tag_type.zig +++ b/test/compile_errors/stage1/obj/exported_enum_without_explicit_integer_tag_type.zig @@ -7,7 +7,9 @@ comptime { @export(e, .{ .name = "e" }); } -// exported enum without explicit integer tag type +// error +// backend=stage1 +// target=native // // tmp.zig:3:13: error: exported enum without explicit integer tag type // tmp.zig:7:13: error: exported enum value without explicit integer tag type diff --git a/test/compile_errors/stage1/obj/extern_function_pointer_mismatch.zig b/test/compile_errors/stage1/obj/extern_function_pointer_mismatch.zig index f93a24db346b824adacc3d27599f79cc099ecb82..888b59a6265fa359aa0d97dd58c037f9d0798c75 100644 --- a/test/compile_errors/stage1/obj/extern_function_pointer_mismatch.zig +++ b/test/compile_errors/stage1/obj/extern_function_pointer_mismatch.zig @@ -5,6 +5,8 @@ export fn c(x: i32) i32 {return x + 2;} export fn entry() usize { return @sizeOf(@TypeOf(fns)); } -// extern function pointer mismatch +// error +// backend=stage1 +// target=native // // tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32' diff --git a/test/compile_errors/stage1/obj/extern_function_with_comptime_parameter.zig b/test/compile_errors/stage1/obj/extern_function_with_comptime_parameter.zig index 3dfdfe663e2ef49c64cf52ddf5481794f5a177a6..93e26b9543af4b2d63411aa117a2a9698a151987 100644 --- a/test/compile_errors/stage1/obj/extern_function_with_comptime_parameter.zig +++ b/test/compile_errors/stage1/obj/extern_function_with_comptime_parameter.zig @@ -4,6 +4,8 @@ fn f() i32 { } export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// extern function with comptime parameter +// error +// backend=stage1 +// target=native // // tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C' diff --git a/test/compile_errors/stage1/obj/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig b/test/compile_errors/stage1/obj/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig index e65c438da3c7f69587029bdcfdfb853c3cdb256e..8f45a0e5dc2f5e378e5c80fe46d700db7bc9f10b 100644 --- a/test/compile_errors/stage1/obj/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig +++ b/test/compile_errors/stage1/obj/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig @@ -36,6 +36,8 @@ export fn entry() void { _ = s; } -// extern struct with extern-compatible but inferred integer tag type +// error +// backend=stage1 +// target=native // // tmp.zig:31:5: error: extern structs cannot contain fields of type 'E' diff --git a/test/compile_errors/stage1/obj/extern_struct_with_non-extern-compatible_integer_tag_type.zig b/test/compile_errors/stage1/obj/extern_struct_with_non-extern-compatible_integer_tag_type.zig index 6d698ce8e3ec112ab52597d1256769804d77f6e1..aa508056a192627c3ae7cb35509b6996f40010a2 100644 --- a/test/compile_errors/stage1/obj/extern_struct_with_non-extern-compatible_integer_tag_type.zig +++ b/test/compile_errors/stage1/obj/extern_struct_with_non-extern-compatible_integer_tag_type.zig @@ -7,6 +7,8 @@ export fn entry() void { _ = s; } -// extern struct with non-extern-compatible integer tag type +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: extern structs cannot contain fields of type 'E' diff --git a/test/compile_errors/stage1/obj/extern_union_field_missing_type.zig b/test/compile_errors/stage1/obj/extern_union_field_missing_type.zig index 1287ce015952f748c686fc1b7bd125fdd6a29a91..9d8532f8a1dfd622a6003514537fa05f684a5d47 100644 --- a/test/compile_errors/stage1/obj/extern_union_field_missing_type.zig +++ b/test/compile_errors/stage1/obj/extern_union_field_missing_type.zig @@ -6,6 +6,8 @@ export fn entry() void { _ = a; } -// extern union field missing type +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: union field missing type diff --git a/test/compile_errors/stage1/obj/extern_union_given_enum_tag_type.zig b/test/compile_errors/stage1/obj/extern_union_given_enum_tag_type.zig index 5b38d77eb652249d7f8a4111867464af138a5dd0..86ac42cccf6891c91542a079ca389ea0939eeb12 100644 --- a/test/compile_errors/stage1/obj/extern_union_given_enum_tag_type.zig +++ b/test/compile_errors/stage1/obj/extern_union_given_enum_tag_type.zig @@ -13,6 +13,8 @@ export fn entry() void { _ = a; } -// extern union given enum tag type +// error +// backend=stage1 +// target=native // // tmp.zig:6:30: error: extern union does not support enum tag type diff --git a/test/compile_errors/stage1/obj/extern_variable_has_no_type.zig b/test/compile_errors/stage1/obj/extern_variable_has_no_type.zig index f9d395227559cd3dd44688d78ec6476085beed20..58d67f14e110d2937b53765a83b86a34fadd593a 100644 --- a/test/compile_errors/stage1/obj/extern_variable_has_no_type.zig +++ b/test/compile_errors/stage1/obj/extern_variable_has_no_type.zig @@ -3,6 +3,8 @@ pub export fn entry() void { foo; } -// extern variable has no type +// error +// backend=stage1 +// target=native // // tmp.zig:1:8: error: unable to infer variable type diff --git a/test/compile_errors/stage1/obj/fieldParentPtr-bad_field_name.zig b/test/compile_errors/stage1/obj/fieldParentPtr-bad_field_name.zig index 8c40641113790133915cd784a4b694ccf8c24d7e..73022167f51b481cc5e3c1964560d180f783a04e 100644 --- a/test/compile_errors/stage1/obj/fieldParentPtr-bad_field_name.zig +++ b/test/compile_errors/stage1/obj/fieldParentPtr-bad_field_name.zig @@ -5,6 +5,8 @@ export fn foo(a: *i32) *Foo { return @fieldParentPtr(Foo, "a", a); } -// @fieldParentPtr - bad field name +// error +// backend=stage1 +// target=native // // tmp.zig:5:33: error: struct 'Foo' has no field 'a' diff --git a/test/compile_errors/stage1/obj/fieldParentPtr-comptime_field_ptr_not_based_on_struct.zig b/test/compile_errors/stage1/obj/fieldParentPtr-comptime_field_ptr_not_based_on_struct.zig index a8a54313521ab88b8d4fc76e8b83b4bf31badbf4..9375f4639a020f37f1f1320d0978f131279303df 100644 --- a/test/compile_errors/stage1/obj/fieldParentPtr-comptime_field_ptr_not_based_on_struct.zig +++ b/test/compile_errors/stage1/obj/fieldParentPtr-comptime_field_ptr_not_based_on_struct.zig @@ -10,6 +10,8 @@ comptime { _ = another_foo_ptr; } -// @fieldParentPtr - comptime field ptr not based on struct +// error +// backend=stage1 +// target=native // // tmp.zig:9:55: error: pointer value not based on parent struct diff --git a/test/compile_errors/stage1/obj/fieldParentPtr-comptime_wrong_field_index.zig b/test/compile_errors/stage1/obj/fieldParentPtr-comptime_wrong_field_index.zig index 11bb7282fce3e8092a0dacc989c93a1a74e59db9..c322543dc01886dc35b4f455ffce8fe92a8aed12 100644 --- a/test/compile_errors/stage1/obj/fieldParentPtr-comptime_wrong_field_index.zig +++ b/test/compile_errors/stage1/obj/fieldParentPtr-comptime_wrong_field_index.zig @@ -9,6 +9,8 @@ comptime { _ = another_foo_ptr; } -// @fieldParentPtr - comptime wrong field index +// error +// backend=stage1 +// target=native // // tmp.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo' diff --git a/test/compile_errors/stage1/obj/fieldParentPtr-field_pointer_is_not_pointer.zig b/test/compile_errors/stage1/obj/fieldParentPtr-field_pointer_is_not_pointer.zig index 8db9075b7b84d983f861c9bf7992d50e965e8bc7..71360e56810662e40958a553e4f180c82248db8c 100644 --- a/test/compile_errors/stage1/obj/fieldParentPtr-field_pointer_is_not_pointer.zig +++ b/test/compile_errors/stage1/obj/fieldParentPtr-field_pointer_is_not_pointer.zig @@ -5,6 +5,8 @@ export fn foo(a: i32) *Foo { return @fieldParentPtr(Foo, "a", a); } -// @fieldParentPtr - field pointer is not pointer +// error +// backend=stage1 +// target=native // // tmp.zig:5:38: error: expected pointer, found 'i32' diff --git a/test/compile_errors/stage1/obj/fieldParentPtr-non_struct.zig b/test/compile_errors/stage1/obj/fieldParentPtr-non_struct.zig index 325fbe5b3b04eabbf00e50f70850198884f445c7..16b9a9b3328caaae919dc651d4c01f88b7d578a2 100644 --- a/test/compile_errors/stage1/obj/fieldParentPtr-non_struct.zig +++ b/test/compile_errors/stage1/obj/fieldParentPtr-non_struct.zig @@ -3,6 +3,8 @@ export fn foo(a: *i32) *Foo { return @fieldParentPtr(Foo, "a", a); } -// @fieldParentPtr - non struct +// error +// backend=stage1 +// target=native // // tmp.zig:3:28: error: expected struct type, found 'i32' diff --git a/test/compile_errors/stage1/obj/field_access_of_opaque_type.zig b/test/compile_errors/stage1/obj/field_access_of_opaque_type.zig index 3354c0f471c71f496942da6a7eec2d72d5bd8c2e..963c89dafe79b6ac6b7c0d63c11f30dd458725a2 100644 --- a/test/compile_errors/stage1/obj/field_access_of_opaque_type.zig +++ b/test/compile_errors/stage1/obj/field_access_of_opaque_type.zig @@ -9,6 +9,8 @@ fn bar(x: *MyType) bool { return x.blah; } -// field access of opaque type +// error +// backend=stage1 +// target=native // // tmp.zig:9:13: error: no member named 'blah' in opaque type 'MyType' diff --git a/test/compile_errors/stage1/obj/field_access_of_slices.zig b/test/compile_errors/stage1/obj/field_access_of_slices.zig index 3e79e1f0e0c28cd3b1b410bb972e4d7769961f1d..45ca7113674e923e0c53ea970f518ac96e8cd8ba 100644 --- a/test/compile_errors/stage1/obj/field_access_of_slices.zig +++ b/test/compile_errors/stage1/obj/field_access_of_slices.zig @@ -4,6 +4,8 @@ export fn entry() void { _ = info; } -// field access of slices +// error +// backend=stage1 +// target=native // // tmp.zig:3:32: error: type 'type' does not support field access diff --git a/test/compile_errors/stage1/obj/field_access_of_unknown_length_pointer.zig b/test/compile_errors/stage1/obj/field_access_of_unknown_length_pointer.zig index 7097c13605b47ee801e420100f17764983e05295..f9a37cabccbe99a588faf9f1e1237eb46322dcd8 100644 --- a/test/compile_errors/stage1/obj/field_access_of_unknown_length_pointer.zig +++ b/test/compile_errors/stage1/obj/field_access_of_unknown_length_pointer.zig @@ -6,6 +6,8 @@ export fn entry(foo: [*]Foo) void { foo.a += 1; } -// field access of unknown length pointer +// error +// backend=stage1 +// target=native // // tmp.zig:6:8: error: type '[*]Foo' does not support field access diff --git a/test/compile_errors/stage1/obj/field_type_supplied_in_an_enum.zig b/test/compile_errors/stage1/obj/field_type_supplied_in_an_enum.zig index cb308307bb170f820db68a1181dec52bd1f78443..d6ba214c0ccb145003d52e6ee9d4d63ffa2cece6 100644 --- a/test/compile_errors/stage1/obj/field_type_supplied_in_an_enum.zig +++ b/test/compile_errors/stage1/obj/field_type_supplied_in_an_enum.zig @@ -4,7 +4,9 @@ const Letter = enum { C, }; -// field type supplied in an enum +// error +// backend=stage1 +// target=native // // tmp.zig:2:8: error: enum fields do not have types // tmp.zig:1:16: note: consider 'union(enum)' here to make it a tagged union diff --git a/test/compile_errors/stage1/obj/floatToInt_comptime_safety.zig b/test/compile_errors/stage1/obj/floatToInt_comptime_safety.zig index e54047fb2ff501c3c58b816d36ada7bfb8421440..1e5fa746a14b4fff82df228d6d28ad5a5ff19169 100644 --- a/test/compile_errors/stage1/obj/floatToInt_comptime_safety.zig +++ b/test/compile_errors/stage1/obj/floatToInt_comptime_safety.zig @@ -8,7 +8,9 @@ comptime { _ = @floatToInt(u8, @as(f32, 256.1)); } -// @floatToInt comptime safety +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: integer value '-129' cannot be stored in type 'i8' // tmp.zig:5:9: error: integer value '-1' cannot be stored in type 'u8' diff --git a/test/compile_errors/stage1/obj/float_literal_too_large_error.zig b/test/compile_errors/stage1/obj/float_literal_too_large_error.zig index d7be9874ac299c189a11ba2c415544ae43c55986..c3865c31108cadfed1a77490a6a23ea861e6ee79 100644 --- a/test/compile_errors/stage1/obj/float_literal_too_large_error.zig +++ b/test/compile_errors/stage1/obj/float_literal_too_large_error.zig @@ -3,6 +3,8 @@ comptime { _ = a; } -// float literal too large error +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: float literal out of range of any type diff --git a/test/compile_errors/stage1/obj/float_literal_too_small_error_denormal.zig b/test/compile_errors/stage1/obj/float_literal_too_small_error_denormal.zig index 2657775be0e126c8ede10663010a47d885481ca3..0b0bfee1de541f72fbbe2f9913449ca9dde3bb8b 100644 --- a/test/compile_errors/stage1/obj/float_literal_too_small_error_denormal.zig +++ b/test/compile_errors/stage1/obj/float_literal_too_small_error_denormal.zig @@ -3,6 +3,8 @@ comptime { _ = a; } -// float literal too small error (denormal) +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: float literal out of range of any type diff --git a/test/compile_errors/stage1/obj/for_loop_body_expression_ignored.zig b/test/compile_errors/stage1/obj/for_loop_body_expression_ignored.zig index fffbb13604dfd05b70ff37c8ccf1a9a797cd0766..6281d4b276f702179d5a44cf6d67302ecc0aec78 100644 --- a/test/compile_errors/stage1/obj/for_loop_body_expression_ignored.zig +++ b/test/compile_errors/stage1/obj/for_loop_body_expression_ignored.zig @@ -10,7 +10,9 @@ export fn f2() void { _ = x; } -// for loop body expression ignored +// error +// backend=stage1 +// target=native // // tmp.zig:5:30: error: expression value is ignored // tmp.zig:9:30: error: expression value is ignored diff --git a/test/compile_errors/stage1/obj/frame_called_outside_of_function_definition.zig b/test/compile_errors/stage1/obj/frame_called_outside_of_function_definition.zig index a76fff93a8a6dc31c05a5135fcfa122818f97450..d14099815287f35321510c87104e0a5831a970a6 100644 --- a/test/compile_errors/stage1/obj/frame_called_outside_of_function_definition.zig +++ b/test/compile_errors/stage1/obj/frame_called_outside_of_function_definition.zig @@ -4,6 +4,8 @@ export fn entry() bool { return handle_undef == handle_dummy; } -// @frame() called outside of function definition +// error +// backend=stage1 +// target=native // // tmp.zig:2:30: error: @frame() called outside of function definition diff --git a/test/compile_errors/stage1/obj/frame_causes_function_to_be_async.zig b/test/compile_errors/stage1/obj/frame_causes_function_to_be_async.zig index b45ff6965ea48cc137b1053a3b5fe4c09904087e..f8493b08b2c9e3374ee9c5c8297601c397964dea 100644 --- a/test/compile_errors/stage1/obj/frame_causes_function_to_be_async.zig +++ b/test/compile_errors/stage1/obj/frame_causes_function_to_be_async.zig @@ -5,7 +5,9 @@ fn func() void { _ = @frame(); } -// @frame() causes function to be async +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: function with calling convention 'C' cannot be async // tmp.zig:5:9: note: @frame() causes function to be async diff --git a/test/compile_errors/stage1/obj/function_alignment_non_power_of_2.zig b/test/compile_errors/stage1/obj/function_alignment_non_power_of_2.zig index 949e11c115f6a5c31c9c90c97151c7e73c5ebd0c..617939a120fc6275ce1b9a486f75ab4e90541a76 100644 --- a/test/compile_errors/stage1/obj/function_alignment_non_power_of_2.zig +++ b/test/compile_errors/stage1/obj/function_alignment_non_power_of_2.zig @@ -1,6 +1,8 @@ extern fn foo() align(3) void; export fn entry() void { return foo(); } -// function alignment non power of 2 +// error +// backend=stage1 +// target=native // // tmp.zig:1:23: error: alignment value 3 is not a power of 2 diff --git a/test/compile_errors/stage1/obj/function_call_assigned_to_incorrect_type.zig b/test/compile_errors/stage1/obj/function_call_assigned_to_incorrect_type.zig index 4257b802c14d0d79825c836c871bcb876ce8f5ae..51bc82ffb867bb9f670aa99021c02767f6d1b159 100644 --- a/test/compile_errors/stage1/obj/function_call_assigned_to_incorrect_type.zig +++ b/test/compile_errors/stage1/obj/function_call_assigned_to_incorrect_type.zig @@ -6,6 +6,8 @@ fn concat() [16]f32 { return [1]f32{0}**16; } -// function call assigned to incorrect type +// error +// backend=stage1 +// target=native // // tmp.zig:3:17: error: expected type '[4]f32', found '[16]f32' diff --git a/test/compile_errors/stage1/obj/function_parameter_is_opaque.zig b/test/compile_errors/stage1/obj/function_parameter_is_opaque.zig index 12e50ca59bd12ac6b45df7e9b319ce9ba5b90300..5b52370d868e8e6e28fd7a40d070c8d3bce995da 100644 --- a/test/compile_errors/stage1/obj/function_parameter_is_opaque.zig +++ b/test/compile_errors/stage1/obj/function_parameter_is_opaque.zig @@ -19,7 +19,9 @@ export fn entry4() void { _ = bar; } -// function parameter is opaque +// error +// backend=stage1 +// target=native // // tmp.zig:3:28: error: parameter of opaque type 'FooType' not allowed // tmp.zig:8:28: error: parameter of type '@Type(.Null)' not allowed diff --git a/test/compile_errors/stage1/obj/function_prototype_with_no_body.zig b/test/compile_errors/stage1/obj/function_prototype_with_no_body.zig index 07597af015434f2f6e59f4e32c831c3507dda3d4..7926faaa4435863b2c5ad4d477e7fd6f1a697ce8 100644 --- a/test/compile_errors/stage1/obj/function_prototype_with_no_body.zig +++ b/test/compile_errors/stage1/obj/function_prototype_with_no_body.zig @@ -3,6 +3,8 @@ export fn entry() void { foo(); } -// function prototype with no body +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: non-extern function has no body diff --git a/test/compile_errors/stage1/obj/function_returning_opaque_type.zig b/test/compile_errors/stage1/obj/function_returning_opaque_type.zig index 956a4ed224101a22cc047f93e6455f1f2035fb59..e2c084b517f9437deca2b81981d57d004fe1c6ca 100644 --- a/test/compile_errors/stage1/obj/function_returning_opaque_type.zig +++ b/test/compile_errors/stage1/obj/function_returning_opaque_type.zig @@ -9,7 +9,9 @@ export fn baz() !@TypeOf(undefined) { return error.InvalidValue; } -// function returning opaque type +// error +// backend=stage1 +// target=native // // tmp.zig:2:18: error: Opaque return type 'FooType' not allowed // tmp.zig:1:1: note: type declared here diff --git a/test/compile_errors/stage1/obj/function_with_ccc_indirectly_calling_async_function.zig b/test/compile_errors/stage1/obj/function_with_ccc_indirectly_calling_async_function.zig index 1ccf486be693b0e5878daa6b7472f6722e23937b..9fadb992b4c68407ab3c65c208d968b29123bf7a 100644 --- a/test/compile_errors/stage1/obj/function_with_ccc_indirectly_calling_async_function.zig +++ b/test/compile_errors/stage1/obj/function_with_ccc_indirectly_calling_async_function.zig @@ -8,7 +8,9 @@ fn bar() void { suspend {} } -// function with ccc indirectly calling async function +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: function with calling convention 'C' cannot be async // tmp.zig:2:8: note: async function call here diff --git a/test/compile_errors/stage1/obj/function_with_invalid_return_type.zig b/test/compile_errors/stage1/obj/function_with_invalid_return_type.zig index acedbac7d11effbac8d61f142c7955e44d665a90..897b298a3d346c38f6b509530ec0c264bbfe4e6f 100644 --- a/test/compile_errors/stage1/obj/function_with_invalid_return_type.zig +++ b/test/compile_errors/stage1/obj/function_with_invalid_return_type.zig @@ -1,5 +1,7 @@ export fn foo() boid {} -// function with invalid return type +// error +// backend=stage1 +// target=native // // tmp.zig:1:17: error: use of undeclared identifier 'boid' diff --git a/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_enum_parameter.zig b/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_enum_parameter.zig index 9c1913305d715a84ce51ea7ef837e7a0b703acbb..8de26c08b84a4fcef12222ee24e0adbf5a573118 100644 --- a/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_enum_parameter.zig +++ b/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_enum_parameter.zig @@ -1,6 +1,8 @@ const Foo = enum { A, B, C }; export fn entry(foo: Foo) void { _ = foo; } -// function with non-extern non-packed enum parameter +// error +// backend=stage1 +// target=native // // tmp.zig:2:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C' diff --git a/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_struct_parameter.zig b/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_struct_parameter.zig index eb2617f279205d5c1d68ad520d30999415838926..ecb4a3626723eb8d281c2c83821d1e09d8384844 100644 --- a/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_struct_parameter.zig +++ b/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_struct_parameter.zig @@ -5,6 +5,8 @@ const Foo = struct { }; export fn entry(foo: Foo) void { _ = foo; } -// function with non-extern non-packed struct parameter +// error +// backend=stage1 +// target=native // // tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C' diff --git a/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_union_parameter.zig b/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_union_parameter.zig index 662ffd349b37ca8a0be3ffc9591868895eab0660..bfe2dc6cfa6114959a15aeab842523783bc94d35 100644 --- a/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_union_parameter.zig +++ b/test/compile_errors/stage1/obj/function_with_non-extern_non-packed_union_parameter.zig @@ -5,6 +5,8 @@ const Foo = union { }; export fn entry(foo: Foo) void { _ = foo; } -// function with non-extern non-packed union parameter +// error +// backend=stage1 +// target=native // // tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C' diff --git a/test/compile_errors/stage1/obj/generic_fn_as_parameter_without_comptime_keyword.zig b/test/compile_errors/stage1/obj/generic_fn_as_parameter_without_comptime_keyword.zig index fceea0961b35af36c85626ca9a92db0fa7d5fc33..72e27e3a0d57babdf71017a0ff6c9767ed598ae2 100644 --- a/test/compile_errors/stage1/obj/generic_fn_as_parameter_without_comptime_keyword.zig +++ b/test/compile_errors/stage1/obj/generic_fn_as_parameter_without_comptime_keyword.zig @@ -4,6 +4,8 @@ export fn entry() void { f(g); } -// generic fn as parameter without comptime keyword +// error +// backend=stage1 +// target=native // // tmp.zig:1:9: error: parameter of type 'fn(anytype) anytype' must be declared comptime diff --git a/test/compile_errors/stage1/obj/generic_function_call_assigned_to_incorrect_type.zig b/test/compile_errors/stage1/obj/generic_function_call_assigned_to_incorrect_type.zig index b48d5def57d41233c1fd2620fa29006ac654954f..72ed66b20aba928f16594e677958dece3d809d2c 100644 --- a/test/compile_errors/stage1/obj/generic_function_call_assigned_to_incorrect_type.zig +++ b/test/compile_errors/stage1/obj/generic_function_call_assigned_to_incorrect_type.zig @@ -6,6 +6,8 @@ fn myAlloc(comptime arg: type) anyerror!arg{ unreachable; } -// generic function call assigned to incorrect type +// error +// backend=stage1 +// target=native // // tmp.zig:3:18: error: expected type '[]i32', found 'anyerror!i32 diff --git a/test/compile_errors/stage1/obj/generic_function_instance_with_non-constant_expression.zig b/test/compile_errors/stage1/obj/generic_function_instance_with_non-constant_expression.zig index 3698370b5755deb2aca66454d0b638c4137ce823..9cdd653766149fe4321fa470bc23a3f2af4f4106 100644 --- a/test/compile_errors/stage1/obj/generic_function_instance_with_non-constant_expression.zig +++ b/test/compile_errors/stage1/obj/generic_function_instance_with_non-constant_expression.zig @@ -5,6 +5,8 @@ fn test1(a: i32, b: i32) i32 { export fn entry() usize { return @sizeOf(@TypeOf(test1)); } -// generic function instance with non-constant expression +// error +// backend=stage1 +// target=native // // tmp.zig:3:16: error: runtime value cannot be passed to comptime arg diff --git a/test/compile_errors/stage1/obj/generic_function_returning_opaque_type.zig b/test/compile_errors/stage1/obj/generic_function_returning_opaque_type.zig index c109a5ce7cbe33c8c2281cda148d95f9d5b454cb..247c1a49bf8a06a7fae2278195e58573a03349b9 100644 --- a/test/compile_errors/stage1/obj/generic_function_returning_opaque_type.zig +++ b/test/compile_errors/stage1/obj/generic_function_returning_opaque_type.zig @@ -12,7 +12,9 @@ export fn baz() void { _ = generic(@TypeOf(undefined)); } -// generic function returning opaque type +// error +// backend=stage1 +// target=native // // tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed // tmp.zig:2:1: note: function declared here diff --git a/test/compile_errors/stage1/obj/generic_function_where_return_type_is_self-referenced.zig b/test/compile_errors/stage1/obj/generic_function_where_return_type_is_self-referenced.zig index 18237a50235955b610e99ba2d4bc5311ca54ee32..c8d31ec8dfac0e0e5880d56738d235ecb3eb7533 100644 --- a/test/compile_errors/stage1/obj/generic_function_where_return_type_is_self-referenced.zig +++ b/test/compile_errors/stage1/obj/generic_function_where_return_type_is_self-referenced.zig @@ -8,6 +8,8 @@ export fn entry() void { _ = t; } -// generic function where return type is self-referenced +// error +// backend=stage1 +// target=native // // tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches diff --git a/test/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig b/test/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig index a6c4ccaa98678465ba4c8c1e04f7260acc6782c7..f23f340b1600632d508c78afa7e3553416db0b14 100644 --- a/test/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig +++ b/test/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig @@ -1,6 +1,8 @@ const some_data: [100]u8 align(3) = undefined; export fn entry() usize { return @sizeOf(@TypeOf(some_data)); } -// global variable alignment non power of 2 +// error +// backend=stage1 +// target=native // // tmp.zig:1:32: error: alignment value 3 is not a power of 2 diff --git a/test/compile_errors/stage1/obj/global_variable_initializer_must_be_constant_expression.zig b/test/compile_errors/stage1/obj/global_variable_initializer_must_be_constant_expression.zig index 1d6c20f3aff50baa252e09e458d230af44b7e2e9..d01e828da66600207d8932b4996c898bc5b8d69f 100644 --- a/test/compile_errors/stage1/obj/global_variable_initializer_must_be_constant_expression.zig +++ b/test/compile_errors/stage1/obj/global_variable_initializer_must_be_constant_expression.zig @@ -2,6 +2,8 @@ extern fn foo() i32; const x = foo(); export fn entry() i32 { return x; } -// global variable initializer must be constant expression +// error +// backend=stage1 +// target=native // // tmp.zig:2:11: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/hasDecl_with_non-container.zig b/test/compile_errors/stage1/obj/hasDecl_with_non-container.zig index 50f1231997036a1c951ff4334ef05aac618c7d85..e9aeacdd4e9d054a694d86b86707112f094769dd 100644 --- a/test/compile_errors/stage1/obj/hasDecl_with_non-container.zig +++ b/test/compile_errors/stage1/obj/hasDecl_with_non-container.zig @@ -2,6 +2,8 @@ export fn entry() void { _ = @hasDecl(i32, "hi"); } -// @hasDecl with non-container +// error +// backend=stage1 +// target=native // // tmp.zig:2:18: error: expected struct, enum, or union; found 'i32' diff --git a/test/compile_errors/stage1/obj/if_condition_is_bool_not_int.zig b/test/compile_errors/stage1/obj/if_condition_is_bool_not_int.zig index e8b7c61417e6719137355ba5038fd8b52344d5a6..53afb2792a004d85f0bb8697364ae677812b304f 100644 --- a/test/compile_errors/stage1/obj/if_condition_is_bool_not_int.zig +++ b/test/compile_errors/stage1/obj/if_condition_is_bool_not_int.zig @@ -2,6 +2,8 @@ export fn f() void { if (0) {} } -// if condition is bool, not int +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: expected type 'bool', found 'comptime_int' diff --git a/test/compile_errors/stage1/obj/ignored_assert-err-ok_return_value.zig b/test/compile_errors/stage1/obj/ignored_assert-err-ok_return_value.zig index 53fbcaa8b5b72c8ff78c546b4c1bc5babc82aeb0..4d45ae13043e5589212b4b617bd9685bcaee3196 100644 --- a/test/compile_errors/stage1/obj/ignored_assert-err-ok_return_value.zig +++ b/test/compile_errors/stage1/obj/ignored_assert-err-ok_return_value.zig @@ -3,6 +3,8 @@ export fn foo() void { } fn bar() anyerror!i32 { return 0; } -// ignored assert-err-ok return value +// error +// backend=stage1 +// target=native // // tmp.zig:2:11: error: expression value is ignored diff --git a/test/compile_errors/stage1/obj/ignored_comptime_statement_value.zig b/test/compile_errors/stage1/obj/ignored_comptime_statement_value.zig index 80925d6c84b301c12804eb46fee6dfa3564b2f43..0e82c9ae3ea439da7bd0b886412e8b1654600d43 100644 --- a/test/compile_errors/stage1/obj/ignored_comptime_statement_value.zig +++ b/test/compile_errors/stage1/obj/ignored_comptime_statement_value.zig @@ -2,6 +2,8 @@ export fn foo() void { comptime {1;} } -// ignored comptime statement value +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expression value is ignored diff --git a/test/compile_errors/stage1/obj/ignored_comptime_value.zig b/test/compile_errors/stage1/obj/ignored_comptime_value.zig index 375a5d242cbcfad89c65a079df1b121684d49de7..0306ea72ff14e0a826f6093af8cf9021aab7cd6d 100644 --- a/test/compile_errors/stage1/obj/ignored_comptime_value.zig +++ b/test/compile_errors/stage1/obj/ignored_comptime_value.zig @@ -2,6 +2,8 @@ export fn foo() void { comptime 1; } -// ignored comptime value +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: expression value is ignored diff --git a/test/compile_errors/stage1/obj/ignored_deferred_function_call.zig b/test/compile_errors/stage1/obj/ignored_deferred_function_call.zig index 58b85da985ae2770669b161123178bf5329b13f5..41812bfda93ba61d3fbfb34415b96463ceba6d59 100644 --- a/test/compile_errors/stage1/obj/ignored_deferred_function_call.zig +++ b/test/compile_errors/stage1/obj/ignored_deferred_function_call.zig @@ -3,6 +3,8 @@ export fn foo() void { } fn bar() anyerror!i32 { return 0; } -// ignored deferred function call +// error +// backend=stage1 +// target=native // // tmp.zig:2:14: error: error is ignored. consider using `try`, `catch`, or `if` diff --git a/test/compile_errors/stage1/obj/ignored_deferred_statement_value.zig b/test/compile_errors/stage1/obj/ignored_deferred_statement_value.zig index effc79b03937b6ea210dc3a8b4a941edbc6eef05..1042c4f40a20ebcc6d49abb1631b8b25ca482724 100644 --- a/test/compile_errors/stage1/obj/ignored_deferred_statement_value.zig +++ b/test/compile_errors/stage1/obj/ignored_deferred_statement_value.zig @@ -2,6 +2,8 @@ export fn foo() void { defer {1;} } -// ignored deferred statement value +// error +// backend=stage1 +// target=native // // tmp.zig:2:12: error: expression value is ignored diff --git a/test/compile_errors/stage1/obj/ignored_expression_in_while_continuation.zig b/test/compile_errors/stage1/obj/ignored_expression_in_while_continuation.zig index fb205924e3b682d3b98aa53b7b8613a3c0a5724d..43f3713fc670e731c73a6a7b89e923c59e757038 100644 --- a/test/compile_errors/stage1/obj/ignored_expression_in_while_continuation.zig +++ b/test/compile_errors/stage1/obj/ignored_expression_in_while_continuation.zig @@ -13,7 +13,9 @@ fn bad() anyerror!void { return error.Bad; } -// ignored expression in while continuation +// error +// backend=stage1 +// target=native // // tmp.zig:2:24: error: error is ignored. consider using `try`, `catch`, or `if` // tmp.zig:6:25: error: error is ignored. consider using `try`, `catch`, or `if` diff --git a/test/compile_errors/stage1/obj/ignored_return_value.zig b/test/compile_errors/stage1/obj/ignored_return_value.zig index 9c8cfa0aa428cb6b6cb153a093056c9039f20d86..b918523b372f9967965a7f41aa7611569063eb67 100644 --- a/test/compile_errors/stage1/obj/ignored_return_value.zig +++ b/test/compile_errors/stage1/obj/ignored_return_value.zig @@ -3,6 +3,8 @@ export fn foo() void { } fn bar() i32 { return 0; } -// ignored return value +// error +// backend=stage1 +// target=native // // tmp.zig:2:8: error: expression value is ignored diff --git a/test/compile_errors/stage1/obj/ignored_statement_value.zig b/test/compile_errors/stage1/obj/ignored_statement_value.zig index 7855cf584b7ab89bb6f36bf3c0eacfd39b231871..a0e540a92b08239192950a1ba2a1abeda95ae37e 100644 --- a/test/compile_errors/stage1/obj/ignored_statement_value.zig +++ b/test/compile_errors/stage1/obj/ignored_statement_value.zig @@ -2,6 +2,8 @@ export fn foo() void { 1; } -// ignored statement value +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: expression value is ignored diff --git a/test/compile_errors/stage1/obj/illegal_comparison_of_types.zig b/test/compile_errors/stage1/obj/illegal_comparison_of_types.zig index 462664a40094cfd0cd6e8ecdf8a1020e1af602b4..d04eaec3b52c0f4c53864a3c80e63edc5c440579 100644 --- a/test/compile_errors/stage1/obj/illegal_comparison_of_types.zig +++ b/test/compile_errors/stage1/obj/illegal_comparison_of_types.zig @@ -12,7 +12,9 @@ fn bad_eql_2(a: *const EnumWithData, b: *const EnumWithData) bool { export fn entry1() usize { return @sizeOf(@TypeOf(bad_eql_1)); } export fn entry2() usize { return @sizeOf(@TypeOf(bad_eql_2)); } -// illegal comparison of types +// error +// backend=stage1 +// target=native // // tmp.zig:2:14: error: operator not allowed for type '[]u8' // tmp.zig:9:16: error: operator not allowed for type 'EnumWithData' diff --git a/test/compile_errors/stage1/obj/implicit_cast_between_C_pointer_and_Zig_pointer-bad_const-align-child.zig b/test/compile_errors/stage1/obj/implicit_cast_between_C_pointer_and_Zig_pointer-bad_const-align-child.zig index 1dd751f989c1e1eb08f8b903bc4205e53facad5d..6ff155b591ba476f582fff263cedb3b89e010f52 100644 --- a/test/compile_errors/stage1/obj/implicit_cast_between_C_pointer_and_Zig_pointer-bad_const-align-child.zig +++ b/test/compile_errors/stage1/obj/implicit_cast_between_C_pointer_and_Zig_pointer-bad_const-align-child.zig @@ -29,7 +29,9 @@ export fn f() void { _ = x; } -// implicit cast between C pointer and Zig pointer - bad const/align/child +// error +// backend=stage1 +// target=native // // tmp.zig:3:27: error: cast increases pointer alignment // tmp.zig:8:18: error: cast discards const qualifier diff --git a/test/compile_errors/stage1/obj/implicit_cast_const_array_to_mutable_slice.zig b/test/compile_errors/stage1/obj/implicit_cast_const_array_to_mutable_slice.zig index f38c2c9fe12bc4cf2e385593d0324d39e66a5fe5..3f22cbed6b471071702ba6cc43b25bd03a591893 100644 --- a/test/compile_errors/stage1/obj/implicit_cast_const_array_to_mutable_slice.zig +++ b/test/compile_errors/stage1/obj/implicit_cast_const_array_to_mutable_slice.zig @@ -4,7 +4,9 @@ export fn entry() void { _ = sliceA; } -// implicit cast const array to mutable slice +// error +// backend=stage1 +// target=native // // tmp.zig:3:27: error: cannot cast pointer to array literal to slice type '[]u8' // tmp.zig:3:27: note: cast discards const qualifier diff --git a/test/compile_errors/stage1/obj/implicit_cast_from_array_to_mutable_slice.zig b/test/compile_errors/stage1/obj/implicit_cast_from_array_to_mutable_slice.zig index 60fc5baf1f8f04d95a9a550910c10400fe3c38ae..012555928c1dd29cdc42a963052c675c15092854 100644 --- a/test/compile_errors/stage1/obj/implicit_cast_from_array_to_mutable_slice.zig +++ b/test/compile_errors/stage1/obj/implicit_cast_from_array_to_mutable_slice.zig @@ -4,6 +4,8 @@ export fn entry() void { foo(global_array); } -// implicit cast from array to mutable slice +// error +// backend=stage1 +// target=native // // tmp.zig:4:9: error: expected type '[]i32', found '[10]i32' diff --git a/test/compile_errors/stage1/obj/implicit_cast_from_f64_to_f32.zig b/test/compile_errors/stage1/obj/implicit_cast_from_f64_to_f32.zig index d1d4417f34cf9c4a7a897b9c3f77567f6acf62b2..f18a46b7f51c2be13c0792ee3ff5dda84700da0f 100644 --- a/test/compile_errors/stage1/obj/implicit_cast_from_f64_to_f32.zig +++ b/test/compile_errors/stage1/obj/implicit_cast_from_f64_to_f32.zig @@ -3,6 +3,8 @@ var y: f32 = x; export fn entry() usize { return @sizeOf(@TypeOf(y)); } -// implicit cast from f64 to f32 +// error +// backend=stage1 +// target=native // // tmp.zig:2:14: error: expected type 'f32', found 'f64' diff --git a/test/compile_errors/stage1/obj/implicit_cast_of_error_set_not_a_subset.zig b/test/compile_errors/stage1/obj/implicit_cast_of_error_set_not_a_subset.zig index 9cfce6524f68ef815ca3fe77a52047c9228f61be..5958a4163930319e654571e75eab2d4d84d0afeb 100644 --- a/test/compile_errors/stage1/obj/implicit_cast_of_error_set_not_a_subset.zig +++ b/test/compile_errors/stage1/obj/implicit_cast_of_error_set_not_a_subset.zig @@ -8,7 +8,9 @@ fn foo(set1: Set1) void { _ = x; } -// implicit cast of error set not a subset +// error +// backend=stage1 +// target=native // // tmp.zig:7:19: error: expected type 'Set2', found 'Set1' // tmp.zig:1:23: note: 'error.B' not a member of destination error set diff --git a/test/compile_errors/stage1/obj/implicit_casting_C_pointers_which_would_mess_up_null_semantics.zig b/test/compile_errors/stage1/obj/implicit_casting_C_pointers_which_would_mess_up_null_semantics.zig index cdc35e39637e6db3a2034e2540f011efd7525c81..760bab41da07b3bbb9a510692ab35141d798a38f 100644 --- a/test/compile_errors/stage1/obj/implicit_casting_C_pointers_which_would_mess_up_null_semantics.zig +++ b/test/compile_errors/stage1/obj/implicit_casting_C_pointers_which_would_mess_up_null_semantics.zig @@ -14,7 +14,9 @@ export fn entry2() void { _ = c_ptr; } -// implicit casting C pointers which would mess up null semantics +// error +// backend=stage1 +// target=native // // tmp.zig:6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8' // tmp.zig:6:24: note: pointer type child '[*c]const u8' cannot cast into pointer type child '[*]const u8' diff --git a/test/compile_errors/stage1/obj/implicit_casting_null_c_pointer_to_zig_pointer.zig b/test/compile_errors/stage1/obj/implicit_casting_null_c_pointer_to_zig_pointer.zig index 29dd6d06f9a1f1aa4e6051da3c9cdbc655bd5f1b..0bd38d868b9bdf2c4f86bff0dec84d06b32b6ee3 100644 --- a/test/compile_errors/stage1/obj/implicit_casting_null_c_pointer_to_zig_pointer.zig +++ b/test/compile_errors/stage1/obj/implicit_casting_null_c_pointer_to_zig_pointer.zig @@ -4,6 +4,8 @@ comptime { _ = zig_ptr; } -// implicit casting null c pointer to zig pointer +// error +// backend=stage1 +// target=native // // tmp.zig:3:24: error: null pointer casted to type '*u8' diff --git a/test/compile_errors/stage1/obj/implicit_casting_too_big_integers_to_C_pointers.zig b/test/compile_errors/stage1/obj/implicit_casting_too_big_integers_to_C_pointers.zig index 3deb817b7669cca605f45ca8fb0f43fc5051218e..f142540ff6a13d2143962f9c8fa91249d3b17139 100644 --- a/test/compile_errors/stage1/obj/implicit_casting_too_big_integers_to_C_pointers.zig +++ b/test/compile_errors/stage1/obj/implicit_casting_too_big_integers_to_C_pointers.zig @@ -8,7 +8,9 @@ export fn b() void { _ = ptr; } -// implicit casting too big integers to C pointers +// error +// backend=stage1 +// target=native // // tmp.zig:2:33: error: integer value 18446744073709551617 cannot be coerced to type 'usize' // tmp.zig:7:23: error: integer type 'u65' too big for implicit @intToPtr to type '[*c]u8' diff --git a/test/compile_errors/stage1/obj/implicit_casting_undefined_c_pointer_to_zig_pointer.zig b/test/compile_errors/stage1/obj/implicit_casting_undefined_c_pointer_to_zig_pointer.zig index 4c19f57442482cda74e40fd58161c0dbf2f3d189..5554146fa57dd3278dcb1ed933220dd098bf9943 100644 --- a/test/compile_errors/stage1/obj/implicit_casting_undefined_c_pointer_to_zig_pointer.zig +++ b/test/compile_errors/stage1/obj/implicit_casting_undefined_c_pointer_to_zig_pointer.zig @@ -4,6 +4,8 @@ comptime { _ = zig_ptr; } -// implicit casting undefined c pointer to zig pointer +// error +// backend=stage1 +// target=native // // tmp.zig:3:24: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/implicit_dependency_on_libc.zig b/test/compile_errors/stage1/obj/implicit_dependency_on_libc.zig new file mode 100644 index 0000000000000000000000000000000000000000..f069f785517177e26570acbf6665a8d46add25e5 --- /dev/null +++ b/test/compile_errors/stage1/obj/implicit_dependency_on_libc.zig @@ -0,0 +1,11 @@ +extern "c" fn exit(u8) void; +export fn entry() void { + exit(0); +} + +// error +// backend=stage1 +// target=native-linux +// is_test=1 +// +// tmp.zig:3:5: error: dependency on libc must be explicitly specified in the build command diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-block_expr.zig b/test/compile_errors/stage1/obj/implicit_semicolon-block_expr.zig index bacd484c0c3c7ff514beafc6c36775df3dd5410d..a57da8ac0bcd7f39226eda704706f9def164a95f 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-block_expr.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-block_expr.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - block expr +// error +// backend=stage1 +// target=native // // tmp.zig:4:11: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-block_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-block_statement.zig index dca8998ee6d557e2847fd2095f2fd6990163e60e..2d9d850e75d68c19d3b2b949d0440323241e54e6 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-block_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-block_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - block statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:9: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-comptime_expression.zig b/test/compile_errors/stage1/obj/implicit_semicolon-comptime_expression.zig index a3f679a59acd9e46c6602276a8db95b07f1cafb3..b4cd4de849d90921b1484950ffc05a1715c876bb 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-comptime_expression.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-comptime_expression.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - comptime expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:20: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-comptime_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-comptime_statement.zig index 299b081e4bce24ad7c9ebf0921321ec9e599ce22..3b83ef92eba02aca1fed39d6f949390bc34756cd 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-comptime_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-comptime_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - comptime statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:18: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-defer.zig b/test/compile_errors/stage1/obj/implicit_semicolon-defer.zig index 7e58d930d626cdab1d6f2b496236a40bffe95323..0ded4fcf262b0ae5651cdb52b799dd45f16b4cb8 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-defer.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-defer.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - defer +// error +// backend=stage1 +// target=native // // tmp.zig:4:15: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-for_expression.zig b/test/compile_errors/stage1/obj/implicit_semicolon-for_expression.zig index 3e332ef189566683e1d09a1469c668bc4e7eaecc..964a48d30b9d48d9c5ebcfc60db500ad481d7c0a 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-for_expression.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-for_expression.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - for expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:26: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-for_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-for_statement.zig index 092c28889fa1ab396e1a8c713257bc10b48d2a62..1320e4cc465d2a4926073206c206cb704f114086 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-for_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-for_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - for statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:24: error: expected ';' or 'else' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_expression.zig b/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_expression.zig index fd55529a8f41ea201101a4633278eb28ff03e6fe..40b1a33d7842ec87537984df767d7dbd299c4fb2 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_expression.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_expression.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - if-else-if-else expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:45: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_statement.zig index 3d59e38aa92549a66b70b0cd38a75b32f318c720..8444fe654d528f156f3ef6218c4d6df6ee8440cd 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - if-else-if-else statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:47: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_expression.zig b/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_expression.zig index 2caaad52b86e44205a57a02122f3657807ca5a04..7466d646915b29987f3c79d9e1c7e6b1c3e252dc 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_expression.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_expression.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - if-else-if expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:37: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_statement.zig index 263aa36da30217d904eb834c84903e429abf5d2a..34e116b3f7840cf552e37ae0e064ef7527e2b51d 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - if-else-if statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:37: error: expected ';' or 'else' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-if-else_expression.zig b/test/compile_errors/stage1/obj/implicit_semicolon-if-else_expression.zig index 12d993f6a724cdde93941662f0df7b83d01be650..3c1e0add62bc1519a6ed4e83ea7f96c7896dcf58 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-if-else_expression.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-if-else_expression.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - if-else expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:28: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-if-else_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-if-else_statement.zig index 401fc46a51911d8ca89022bbc32193168af39f35..e9c52fb6bb36f96388e9cd9f14904a6e31b36354 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-if-else_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-if-else_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - if-else statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:28: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-if_expression.zig b/test/compile_errors/stage1/obj/implicit_semicolon-if_expression.zig index b3a81e9d3679a46348ef3a9596b766406d9b2180..2082588e0e9ab0a99fd4d42a3887f7172eda5bd8 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-if_expression.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-if_expression.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - if expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:20: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-if_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-if_statement.zig index e543925d781cf6192291d13c6f9bba32fc8a9956..26cefd0237836ea9434f7e2675a93ab86b02f16c 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-if_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-if_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - if statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:18: error: expected ';' or 'else' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-test_expression.zig b/test/compile_errors/stage1/obj/implicit_semicolon-test_expression.zig index 1702bec0488bfaa015e9b2d091147b0a18214f96..c31f3520c1b57738f6e1613f0a05baa65d7dc45f 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-test_expression.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-test_expression.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - test expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:26: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-test_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-test_statement.zig index 8715ca9ac05a2337b6beead221bff062c5457aae..8abb1cbcb1ee34fc719e8b5b02e34c1efbb13b7b 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-test_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-test_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - test statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:24: error: expected ';' or 'else' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-while-continue_expression.zig b/test/compile_errors/stage1/obj/implicit_semicolon-while-continue_expression.zig index b1a7bdbab82bc0daaa813141cf059484075d9a59..4d3219eb66b8f67129d3485ff6f620eadd86af5f 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-while-continue_expression.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-while-continue_expression.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - while-continue expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:28: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-while-continue_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-while-continue_statement.zig index 601f1f03184d48e29f0f51b7d2324403f723f0c6..c0b3370357204bb007ae7d3e15e621be46b00d2a 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-while-continue_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-while-continue_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - while-continue statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:26: error: expected ';' or 'else' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-while_expression.zig b/test/compile_errors/stage1/obj/implicit_semicolon-while_expression.zig index 9580889bd772056cb3904f95913e9f66646b159c..39f49319d5044ae5cdb1f90534783ca30c711203 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-while_expression.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-while_expression.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - while expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:23: error: expected ';' after statement diff --git a/test/compile_errors/stage1/obj/implicit_semicolon-while_statement.zig b/test/compile_errors/stage1/obj/implicit_semicolon-while_statement.zig index ab64dd991dcec7704df698c6a90858facc66b648..6c253ecf56374e9fa886a1c87f7f167555d991e0 100644 --- a/test/compile_errors/stage1/obj/implicit_semicolon-while_statement.zig +++ b/test/compile_errors/stage1/obj/implicit_semicolon-while_statement.zig @@ -5,6 +5,8 @@ export fn entry() void { var bad = {}; } -// implicit semicolon - while statement +// error +// backend=stage1 +// target=native // // tmp.zig:4:18: error: expected ';' or 'else' after statement diff --git a/test/compile_errors/stage1/obj/implicitly_casting_enum_to_tag_type.zig b/test/compile_errors/stage1/obj/implicitly_casting_enum_to_tag_type.zig index 26806a39142606a8b4e63846c44a86dccfae5c37..a40615f99b09a5cd0a92372454c33244967c7e29 100644 --- a/test/compile_errors/stage1/obj/implicitly_casting_enum_to_tag_type.zig +++ b/test/compile_errors/stage1/obj/implicitly_casting_enum_to_tag_type.zig @@ -10,6 +10,8 @@ export fn entry() void { _ = x; } -// implicitly casting enum to tag type +// error +// backend=stage1 +// target=native // // tmp.zig:9:22: error: expected type 'u2', found 'Small' diff --git a/test/compile_errors/stage1/obj/implicitly_increasing_pointer_alignment.zig b/test/compile_errors/stage1/obj/implicitly_increasing_pointer_alignment.zig index 8f743a3b59901ee738e49db2702a2622417d7b32..3743eef0b2fceebbf3c4e5149b8a2cd3fc642b5e 100644 --- a/test/compile_errors/stage1/obj/implicitly_increasing_pointer_alignment.zig +++ b/test/compile_errors/stage1/obj/implicitly_increasing_pointer_alignment.zig @@ -12,6 +12,8 @@ fn bar(x: *u32) void { x.* += 1; } -// implicitly increasing pointer alignment +// error +// backend=stage1 +// target=native // // tmp.zig:8:13: error: expected type '*u32', found '*align(1) u32' diff --git a/test/compile_errors/stage1/obj/implicitly_increasing_slice_alignment.zig b/test/compile_errors/stage1/obj/implicitly_increasing_slice_alignment.zig index c1d4ec2a0fdbaa9ffe04ad0900d94bdf681dad1e..2e5c201b5dac591e401bdd68358a7dceeeeff877 100644 --- a/test/compile_errors/stage1/obj/implicitly_increasing_slice_alignment.zig +++ b/test/compile_errors/stage1/obj/implicitly_increasing_slice_alignment.zig @@ -13,7 +13,9 @@ fn bar(x: []u32) void { x[0] += 1; } -// implicitly increasing slice alignment +// error +// backend=stage1 +// target=native // // tmp.zig:9:26: error: cast increases pointer alignment // tmp.zig:9:26: note: '*align(1) u32' has alignment 1 diff --git a/test/compile_errors/stage1/obj/import_outside_package_path.zig b/test/compile_errors/stage1/obj/import_outside_package_path.zig index 843de67b63ac33687f5905d397dfaec7e29b325e..5a712c2e0116dfb3ebce9c1b9db79859941897d2 100644 --- a/test/compile_errors/stage1/obj/import_outside_package_path.zig +++ b/test/compile_errors/stage1/obj/import_outside_package_path.zig @@ -2,6 +2,8 @@ comptime{ _ = @import("../a.zig"); } -// import outside package path +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: import of file outside package path: '../a.zig' diff --git a/test/compile_errors/stage1/obj/incompatible_sentinels.zig b/test/compile_errors/stage1/obj/incompatible_sentinels.zig new file mode 100644 index 0000000000000000000000000000000000000000..a292ae3d7c9700713c4037ef3333560cda91d672 --- /dev/null +++ b/test/compile_errors/stage1/obj/incompatible_sentinels.zig @@ -0,0 +1,29 @@ +// Note: One of the error messages here is backwards. It would be nice to fix, but that's not +// going to stop me from merging this branch which fixes a bunch of other stuff. +export fn entry1(ptr: [*:255]u8) [*:0]u8 { + return ptr; +} +export fn entry2(ptr: [*]u8) [*:0]u8 { + return ptr; +} +export fn entry3() void { + var array: [2:0]u8 = [_:255]u8{ 1, 2 }; + _ = array; +} +export fn entry4() void { + var array: [2:0]u8 = [_]u8{ 1, 2 }; + _ = array; +} + +// error +// backend=stage1 +// target=native +// +// tmp.zig:4:12: error: expected type '[*:0]u8', found '[*:255]u8' +// tmp.zig:4:12: note: destination pointer requires a terminating '0' sentinel, but source pointer has a terminating '255' sentinel +// tmp.zig:7:12: error: expected type '[*:0]u8', found '[*]u8' +// tmp.zig:7:12: note: destination pointer requires a terminating '0' sentinel +// tmp.zig:10:35: error: expected type '[2:255]u8', found '[2:0]u8' +// tmp.zig:10:35: note: destination array requires a terminating '255' sentinel, but source array has a terminating '0' sentinel +// tmp.zig:14:31: error: expected type '[2:0]u8', found '[2]u8' +// tmp.zig:14:31: note: destination array requires a terminating '0' sentinel diff --git a/test/compile_errors/stage1/obj/incorrect_return_type.zig b/test/compile_errors/stage1/obj/incorrect_return_type.zig index 86c5f23dc35eb296018a300294b87ec27f26fe0e..b25e2a8ea46a8cfd0768cd782cd047f93d442c02 100644 --- a/test/compile_errors/stage1/obj/incorrect_return_type.zig +++ b/test/compile_errors/stage1/obj/incorrect_return_type.zig @@ -14,6 +14,8 @@ unreachable; } -// incorrect return type +// error +// backend=stage1 +// target=native // // tmp.zig:8:16: error: expected type 'A', found 'B' diff --git a/test/compile_errors/stage1/obj/increase_pointer_alignment_in_ptrCast.zig b/test/compile_errors/stage1/obj/increase_pointer_alignment_in_ptrCast.zig index 01d8ac821ef9cf8985bf19602bd4a2d12fba8e39..f3f67ca4c657f43eba8741833e83ad469610f3c9 100644 --- a/test/compile_errors/stage1/obj/increase_pointer_alignment_in_ptrCast.zig +++ b/test/compile_errors/stage1/obj/increase_pointer_alignment_in_ptrCast.zig @@ -4,7 +4,9 @@ export fn entry() u32 { return ptr.*; } -// increase pointer alignment in @ptrCast +// error +// backend=stage1 +// target=native // // tmp.zig:3:17: error: cast increases pointer alignment // tmp.zig:3:38: note: '*u8' has alignment 1 diff --git a/test/compile_errors/stage1/obj/indexing_a_undefined_slice_at_comptime.zig b/test/compile_errors/stage1/obj/indexing_a_undefined_slice_at_comptime.zig index 4653d8668ebbaa068c9689af438a37f0e06a0b83..70b0c68658578c3d677a82cabe80c492eac2453a 100644 --- a/test/compile_errors/stage1/obj/indexing_a_undefined_slice_at_comptime.zig +++ b/test/compile_errors/stage1/obj/indexing_a_undefined_slice_at_comptime.zig @@ -3,6 +3,8 @@ comptime { slice[0] = 2; } -// indexing a undefined slice at comptime +// error +// backend=stage1 +// target=native // // tmp.zig:3:10: error: index 0 outside slice of size 0 diff --git a/test/compile_errors/stage1/obj/indexing_an_array_of_size_zero.zig b/test/compile_errors/stage1/obj/indexing_an_array_of_size_zero.zig index 9066985de54beaa4957abaf2a2673ecbb124fb6a..dfb2e7c1c314a1202f7f3348218b3b0064ed27d6 100644 --- a/test/compile_errors/stage1/obj/indexing_an_array_of_size_zero.zig +++ b/test/compile_errors/stage1/obj/indexing_an_array_of_size_zero.zig @@ -4,6 +4,8 @@ export fn foo() void { _ = pointer; } -// indexing an array of size zero +// error +// backend=stage1 +// target=native // // tmp.zig:3:27: error: accessing a zero length array is not allowed diff --git a/test/compile_errors/stage1/obj/indexing_an_array_of_size_zero_with_runtime_index.zig b/test/compile_errors/stage1/obj/indexing_an_array_of_size_zero_with_runtime_index.zig index c5f3acb3cc8ce81843ca622cd7a66318fa7690c4..f50931312e6e50e0f1dfe40463f2fe6b53c6bab1 100644 --- a/test/compile_errors/stage1/obj/indexing_an_array_of_size_zero_with_runtime_index.zig +++ b/test/compile_errors/stage1/obj/indexing_an_array_of_size_zero_with_runtime_index.zig @@ -5,6 +5,8 @@ export fn foo() void { _ = pointer; } -// indexing an array of size zero with runtime index +// error +// backend=stage1 +// target=native // // tmp.zig:4:27: error: accessing a zero length array is not allowed diff --git a/test/compile_errors/stage1/obj/indexing_single-item_pointer.zig b/test/compile_errors/stage1/obj/indexing_single-item_pointer.zig index e228083964ea0db2596ce3977932048ac975274c..bc7951ec963c0076ca7fdb19816ce4c72ff28368 100644 --- a/test/compile_errors/stage1/obj/indexing_single-item_pointer.zig +++ b/test/compile_errors/stage1/obj/indexing_single-item_pointer.zig @@ -2,6 +2,8 @@ export fn entry(ptr: *i32) i32 { return ptr[1]; } -// indexing single-item pointer +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: index of single-item pointer diff --git a/test/compile_errors/stage1/obj/indirect_recursion_of_async_functions_detected.zig b/test/compile_errors/stage1/obj/indirect_recursion_of_async_functions_detected.zig index 5765f7aae194e6e19d387419553df677d2b98dbc..d845dc7930a73e4c85f24b57f9c6432a64bae4d3 100644 --- a/test/compile_errors/stage1/obj/indirect_recursion_of_async_functions_detected.zig +++ b/test/compile_errors/stage1/obj/indirect_recursion_of_async_functions_detected.zig @@ -27,7 +27,9 @@ fn rangeSumIndirect(x: i32) i32 { return child + 1; } -// indirect recursion of async functions detected +// error +// backend=stage1 +// target=native // // tmp.zig:8:1: error: '@Frame(rangeSum)' depends on itself // tmp.zig:15:33: note: when analyzing type '@Frame(rangeSum)' here diff --git a/test/compile_errors/stage1/obj/indirect_struct_loop.zig b/test/compile_errors/stage1/obj/indirect_struct_loop.zig index 903a1bda39a1a4b220eaca6b1a5ab75feaf96b22..12214923d089e642631c4b8c169153eccd23b5e1 100644 --- a/test/compile_errors/stage1/obj/indirect_struct_loop.zig +++ b/test/compile_errors/stage1/obj/indirect_struct_loop.zig @@ -3,6 +3,8 @@ const B = struct { c : C, }; const C = struct { a : A, }; export fn entry() usize { return @sizeOf(A); } -// indirect struct loop +// error +// backend=stage1 +// target=native // // tmp.zig:1:11: error: struct 'A' depends on itself diff --git a/test/compile_errors/stage1/obj/inferred_array_size_invalid_here.zig b/test/compile_errors/stage1/obj/inferred_array_size_invalid_here.zig index a45b6aa027e77018887ec884a623a44e6850b98e..2b2d944eab15d5a6cff927d91cb2c8ffc679dbc1 100644 --- a/test/compile_errors/stage1/obj/inferred_array_size_invalid_here.zig +++ b/test/compile_errors/stage1/obj/inferred_array_size_invalid_here.zig @@ -8,7 +8,9 @@ export fn entry2() void { _ = a; } -// inferred array size invalid here +// error +// backend=stage1 +// target=native // // tmp.zig:2:16: error: unable to infer array size // tmp.zig:6:35: error: unable to infer array size diff --git a/test/compile_errors/stage1/obj/inferring_error_set_of_function_pointer.zig b/test/compile_errors/stage1/obj/inferring_error_set_of_function_pointer.zig index ead5afd248fee072556e965e4d4640ec21f28e9d..b91242322d46db9edca71c412c9d46de7176d604 100644 --- a/test/compile_errors/stage1/obj/inferring_error_set_of_function_pointer.zig +++ b/test/compile_errors/stage1/obj/inferring_error_set_of_function_pointer.zig @@ -2,6 +2,8 @@ comptime { const z: ?fn()!void = null; } -// inferring error set of function pointer +// error +// backend=stage1 +// target=native // // tmp.zig:2:19: error: function prototype may not have inferred error set diff --git a/test/compile_errors/stage1/obj/initializing_array_with_struct_syntax.zig b/test/compile_errors/stage1/obj/initializing_array_with_struct_syntax.zig index 15412ac5ab5deb5fa0a7391555b46cfec72fbc38..2884c6193e53fccb46f4fe6bf3bbc91561a2b3b4 100644 --- a/test/compile_errors/stage1/obj/initializing_array_with_struct_syntax.zig +++ b/test/compile_errors/stage1/obj/initializing_array_with_struct_syntax.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// initializing array with struct syntax +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: initializing array with struct syntax diff --git a/test/compile_errors/stage1/obj/instantiating_an_undefined_value_for_an_invalid_struct_that_contains_itself.zig b/test/compile_errors/stage1/obj/instantiating_an_undefined_value_for_an_invalid_struct_that_contains_itself.zig index c39908c9b58aa265b7ea8da0b12436f6a5045842..dd6909b1c22a2db543f7f1390dfc96a1fc3186b0 100644 --- a/test/compile_errors/stage1/obj/instantiating_an_undefined_value_for_an_invalid_struct_that_contains_itself.zig +++ b/test/compile_errors/stage1/obj/instantiating_an_undefined_value_for_an_invalid_struct_that_contains_itself.zig @@ -8,6 +8,8 @@ export fn entry() usize { return @sizeOf(@TypeOf(foo.x)); } -// instantiating an undefined value for an invalid struct that contains itself +// error +// backend=stage1 +// target=native // // tmp.zig:1:13: error: struct 'Foo' depends on itself diff --git a/test/compile_errors/stage1/obj/intToPtr_with_misaligned_address.zig b/test/compile_errors/stage1/obj/intToPtr_with_misaligned_address.zig index a04f318f0c62459fff074f5e96a9c2f3a71d185d..16b6bf565e0d20f69b490bc66d81fc2e17e5106b 100644 --- a/test/compile_errors/stage1/obj/intToPtr_with_misaligned_address.zig +++ b/test/compile_errors/stage1/obj/intToPtr_with_misaligned_address.zig @@ -3,6 +3,8 @@ pub fn main() void { _ = y; } -// intToPtr with misaligned address +// error +// backend=stage1 +// target=native // // tmp.zig:2:13: error: pointer type '[*]align(4) u8' requires aligned address diff --git a/test/compile_errors/stage1/obj/int_to_err_global_invalid_number.zig b/test/compile_errors/stage1/obj/int_to_err_global_invalid_number.zig index 180da60ab2f1091bb71e1e8fd77db20fe48fcc2f..5c078a751cc9d89c0ac97b969bc653afb6d0bc56 100644 --- a/test/compile_errors/stage1/obj/int_to_err_global_invalid_number.zig +++ b/test/compile_errors/stage1/obj/int_to_err_global_invalid_number.zig @@ -8,6 +8,8 @@ comptime { _ = y; } -// int to err global invalid number +// error +// backend=stage1 +// target=native // // tmp.zig:7:13: error: integer value 3 represents no error diff --git a/test/compile_errors/stage1/obj/int_to_err_non_global_invalid_number.zig b/test/compile_errors/stage1/obj/int_to_err_non_global_invalid_number.zig index a6627891d08729ec943a0717047abfd9310d2ef5..8c1e547746efb84b01daaa858b437ea861076bbd 100644 --- a/test/compile_errors/stage1/obj/int_to_err_non_global_invalid_number.zig +++ b/test/compile_errors/stage1/obj/int_to_err_non_global_invalid_number.zig @@ -12,6 +12,8 @@ comptime { _ = y; } -// int to err non global invalid number +// error +// backend=stage1 +// target=native // // tmp.zig:11:13: error: error.B not a member of error set 'Set2' diff --git a/test/compile_errors/stage1/obj/int_to_ptr_of_0_bits.zig b/test/compile_errors/stage1/obj/int_to_ptr_of_0_bits.zig index 7047600c1b3707fdf2f50634b9770cae0595b9fc..7b65cdf836eb711121f72c81f20697d8d4dc413c 100644 --- a/test/compile_errors/stage1/obj/int_to_ptr_of_0_bits.zig +++ b/test/compile_errors/stage1/obj/int_to_ptr_of_0_bits.zig @@ -4,6 +4,8 @@ export fn foo() void { _ = y; } -// int to ptr of 0 bits +// error +// backend=stage1 +// target=native // // tmp.zig:3:30: error: type '*void' has 0 bits and cannot store information diff --git a/test/compile_errors/stage1/obj/integer_cast_truncates_bits.zig b/test/compile_errors/stage1/obj/integer_cast_truncates_bits.zig index a5c803615224f2aab15d42993e45677212a57df1..e8ef41862430fc667c6e63c74298519c4caa5a94 100644 --- a/test/compile_errors/stage1/obj/integer_cast_truncates_bits.zig +++ b/test/compile_errors/stage1/obj/integer_cast_truncates_bits.zig @@ -19,7 +19,9 @@ export fn entry4() void { _ = unsigned; } -// integer cast truncates bits +// error +// backend=stage1 +// target=native // // tmp.zig:3:18: error: cast from 'u16' to 'u8' truncates bits // tmp.zig:8:22: error: integer value 300 cannot be coerced to type 'u8' diff --git a/test/compile_errors/stage1/obj/integer_overflow_error.zig b/test/compile_errors/stage1/obj/integer_overflow_error.zig index 568cc5034be89b86c36ab82f66c5e5b70a609d43..117d77ed938c8a4d0d7b5986fc50bf38999b26ba 100644 --- a/test/compile_errors/stage1/obj/integer_overflow_error.zig +++ b/test/compile_errors/stage1/obj/integer_overflow_error.zig @@ -1,6 +1,8 @@ const x : u8 = 300; export fn entry() usize { return @sizeOf(@TypeOf(x)); } -// integer overflow error +// error +// backend=stage1 +// target=native // // tmp.zig:1:16: error: integer value 300 cannot be coerced to type 'u8' diff --git a/test/compile_errors/stage1/obj/integer_underflow_error.zig b/test/compile_errors/stage1/obj/integer_underflow_error.zig index 01171589d9e0dc0dc89e835952757b98f0bc8df3..15bd4c472bd3e9979908188e28bf7d7054f1ad26 100644 --- a/test/compile_errors/stage1/obj/integer_underflow_error.zig +++ b/test/compile_errors/stage1/obj/integer_underflow_error.zig @@ -2,6 +2,8 @@ export fn entry() void { _ = @intToPtr(*anyopaque, ~@as(usize, @import("std").math.maxInt(usize)) - 1); } -// integer underflow error +// error +// backend=stage1 +// target=native // // :2:78: error: operation caused overflow diff --git a/test/compile_errors/stage1/obj/invalid_break_expression.zig b/test/compile_errors/stage1/obj/invalid_break_expression.zig index b6d27d6ea59156b746b2de628902609e2ba630fb..efb76a34f7b7d5b434a4376e892d6874ce8bb413 100644 --- a/test/compile_errors/stage1/obj/invalid_break_expression.zig +++ b/test/compile_errors/stage1/obj/invalid_break_expression.zig @@ -2,6 +2,8 @@ export fn f() void { break; } -// invalid break expression +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: break expression outside loop diff --git a/test/compile_errors/stage1/obj/invalid_builtin_fn.zig b/test/compile_errors/stage1/obj/invalid_builtin_fn.zig index e10baf5965de149b18dafa3af9ad62288cac0a2a..8f0e3633bb35a07a91e65d3242470c4ed655d0c8 100644 --- a/test/compile_errors/stage1/obj/invalid_builtin_fn.zig +++ b/test/compile_errors/stage1/obj/invalid_builtin_fn.zig @@ -2,6 +2,8 @@ fn f() @bogus(foo) { } export fn entry() void { _ = f(); } -// invalid builtin fn +// error +// backend=stage1 +// target=native // // tmp.zig:1:8: error: invalid builtin function: '@bogus' diff --git a/test/compile_errors/stage1/obj/invalid_cast_from_integral_type_to_enum.zig b/test/compile_errors/stage1/obj/invalid_cast_from_integral_type_to_enum.zig index 476a4929ef296b7b6fc38e483d53b6d6654aa6d6..81dbd88e3b1b24a2a4019cb4bf9b90a879f50916 100644 --- a/test/compile_errors/stage1/obj/invalid_cast_from_integral_type_to_enum.zig +++ b/test/compile_errors/stage1/obj/invalid_cast_from_integral_type_to_enum.zig @@ -10,6 +10,8 @@ fn foo(x: usize) void { } } -// invalid cast from integral type to enum +// error +// backend=stage1 +// target=native // // tmp.zig:9:10: error: expected type 'usize', found 'E' diff --git a/test/compile_errors/stage1/obj/invalid_comparison_for_function_pointers.zig b/test/compile_errors/stage1/obj/invalid_comparison_for_function_pointers.zig index f7827ed0e9461ff16ef8b4409cce10acc0877077..6d64b6cdaf938620f99f05c5be8e77ee5239d19c 100644 --- a/test/compile_errors/stage1/obj/invalid_comparison_for_function_pointers.zig +++ b/test/compile_errors/stage1/obj/invalid_comparison_for_function_pointers.zig @@ -3,6 +3,8 @@ const invalid = foo > foo; export fn entry() usize { return @sizeOf(@TypeOf(invalid)); } -// invalid comparison for function pointers +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: operator not allowed for type 'fn() void' diff --git a/test/compile_errors/stage1/obj/invalid_continue_expression.zig b/test/compile_errors/stage1/obj/invalid_continue_expression.zig index 9bd40c516a7c1f7ef9187a0fa58992d8573b5d55..00f3c5a3d56f4b7d8c67112e670c62f5da41a3b2 100644 --- a/test/compile_errors/stage1/obj/invalid_continue_expression.zig +++ b/test/compile_errors/stage1/obj/invalid_continue_expression.zig @@ -2,6 +2,8 @@ export fn f() void { continue; } -// invalid continue expression +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: continue expression outside loop diff --git a/test/compile_errors/stage1/obj/invalid_deref_on_switch_target.zig b/test/compile_errors/stage1/obj/invalid_deref_on_switch_target.zig index 47dc0a52c1e39969e6192cba5778ff838d7a4e22..966a881543304a501d5a9f5b0db62d93e9caa65d 100644 --- a/test/compile_errors/stage1/obj/invalid_deref_on_switch_target.zig +++ b/test/compile_errors/stage1/obj/invalid_deref_on_switch_target.zig @@ -10,6 +10,8 @@ const Tile = enum { Filled, }; -// invalid deref on switch target +// error +// backend=stage1 +// target=native // // tmp.zig:3:17: error: attempt to dereference non-pointer type 'Tile' diff --git a/test/compile_errors/stage1/obj/invalid_empty_unicode_escape.zig b/test/compile_errors/stage1/obj/invalid_empty_unicode_escape.zig index d8853110a45a2101995809e5b904b4592fe7ed63..57dd16a63def4ef8e2197786f4d0f7d05d8b3f0d 100644 --- a/test/compile_errors/stage1/obj/invalid_empty_unicode_escape.zig +++ b/test/compile_errors/stage1/obj/invalid_empty_unicode_escape.zig @@ -2,6 +2,8 @@ export fn entry() void { const a = '\u{}'; } -// invalid empty unicode escape +// error +// backend=stage1 +// target=native // // tmp.zig:2:19: error: empty unicode escape sequence diff --git a/test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-1.zig b/test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-1.zig index 4f13de2a6287d5e8fe8ade3f6a8ec3010a292500..431401c53421868fcb5e7087b57e2a5fd57cee58 100644 --- a/test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-1.zig +++ b/test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-1.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid exponent in float literal - 1 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:28: note: invalid byte: 'a' diff --git a/test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-2.zig b/test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-2.zig index f612d8c510a7f5a9ebd9d490f8687e9ca6960441..088b43546c64a1aa67af3d734f22dbcc9267dae2 100644 --- a/test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-2.zig +++ b/test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-2.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid exponent in float literal - 2 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:29: note: invalid byte: 'F' diff --git a/test/compile_errors/stage1/obj/invalid_field_access_in_comptime.zig b/test/compile_errors/stage1/obj/invalid_field_access_in_comptime.zig index e8395b5e7a03fceee8cf5c352aeebf9d038ebb5c..2630a704ed49224a36ae7972196dc8f7a416a573 100644 --- a/test/compile_errors/stage1/obj/invalid_field_access_in_comptime.zig +++ b/test/compile_errors/stage1/obj/invalid_field_access_in_comptime.zig @@ -1,5 +1,7 @@ comptime { var x = doesnt_exist.whatever; _ = x; } -// invalid field access in comptime +// error +// backend=stage1 +// target=native // // tmp.zig:1:20: error: use of undeclared identifier 'doesnt_exist' diff --git a/test/compile_errors/stage1/obj/invalid_field_in_struct_value_expression.zig b/test/compile_errors/stage1/obj/invalid_field_in_struct_value_expression.zig index 41511f0d0a7aaa30beb391ee1c5df73a0d4906d9..fae0a90b518cc0c701edbd144cb6d7077b472beb 100644 --- a/test/compile_errors/stage1/obj/invalid_field_in_struct_value_expression.zig +++ b/test/compile_errors/stage1/obj/invalid_field_in_struct_value_expression.zig @@ -12,6 +12,8 @@ export fn f() void { _ = a; } -// invalid field in struct value expression +// error +// backend=stage1 +// target=native // // tmp.zig:10:9: error: no member named 'foo' in struct 'A' diff --git a/test/compile_errors/stage1/obj/invalid_float_literal.zig b/test/compile_errors/stage1/obj/invalid_float_literal.zig index 5d9a26032f41119780b70aa46bd59a41467a0375..709609a027a5ebf4464aa21f4f29a351d121d70b 100644 --- a/test/compile_errors/stage1/obj/invalid_float_literal.zig +++ b/test/compile_errors/stage1/obj/invalid_float_literal.zig @@ -6,6 +6,8 @@ pub fn main() void { std.debug.assert(bad_float < 1.0); } -// invalid float literal +// error +// backend=stage1 +// target=native // // tmp.zig:5:29: error: expected expression, found '.' diff --git a/test/compile_errors/stage1/obj/invalid_legacy_unicode_escape.zig b/test/compile_errors/stage1/obj/invalid_legacy_unicode_escape.zig index 58e1390345e580d19360874981ddefef5ef28719..b81a814a604ac77c001f133b611b539bb1a55ec0 100644 --- a/test/compile_errors/stage1/obj/invalid_legacy_unicode_escape.zig +++ b/test/compile_errors/stage1/obj/invalid_legacy_unicode_escape.zig @@ -2,7 +2,9 @@ export fn entry() void { const a = '\U1234'; } -// invalid legacy unicode escape +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expected expression, found 'invalid bytes' // tmp.zig:2:18: note: invalid byte: '1' diff --git a/test/compile_errors/stage1/obj/invalid_maybe_type.zig b/test/compile_errors/stage1/obj/invalid_maybe_type.zig index 9edc313526a258d3c3c391cfe4822bc6299c57d0..cb075c36b7139b2fce5fcc688d646e848971fa16 100644 --- a/test/compile_errors/stage1/obj/invalid_maybe_type.zig +++ b/test/compile_errors/stage1/obj/invalid_maybe_type.zig @@ -2,6 +2,8 @@ export fn f() void { if (true) |x| { _ = x; } } -// invalid maybe type +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: expected optional type, found 'bool' diff --git a/test/compile_errors/stage1/obj/invalid_member_of_builtin_enum.zig b/test/compile_errors/stage1/obj/invalid_member_of_builtin_enum.zig index 32888ff84ba33296877d2d7fd697c42580e7aa84..166ebfc78260858195378552ce4464c49967c7b0 100644 --- a/test/compile_errors/stage1/obj/invalid_member_of_builtin_enum.zig +++ b/test/compile_errors/stage1/obj/invalid_member_of_builtin_enum.zig @@ -4,6 +4,8 @@ export fn entry() void { _ = foo; } -// invalid member of builtin enum +// error +// backend=stage1 +// target=native // // tmp.zig:3:29: error: container 'std.builtin.Mode' has no member called 'x86' diff --git a/test/compile_errors/stage1/obj/invalid_multiple_dereferences.zig b/test/compile_errors/stage1/obj/invalid_multiple_dereferences.zig index bdf5ccb228f6620a6d998d3763f40660e7df15ad..f8a0b8013f0ccbaa8e1519cf013932b0ce607a18 100644 --- a/test/compile_errors/stage1/obj/invalid_multiple_dereferences.zig +++ b/test/compile_errors/stage1/obj/invalid_multiple_dereferences.zig @@ -11,7 +11,9 @@ pub const Box = struct { field: i32, }; -// invalid multiple dereferences +// error +// backend=stage1 +// target=native // // tmp.zig:3:8: error: attempt to dereference non-pointer type 'Box' // tmp.zig:8:13: error: attempt to dereference non-pointer type 'Box' diff --git a/test/compile_errors/stage1/obj/invalid_optional_type_in_extern_struct.zig b/test/compile_errors/stage1/obj/invalid_optional_type_in_extern_struct.zig index 17d9477abf29212be175db0f253d5f970e8ad53e..dc2e2690b8cf539a80c86089f2ee34c029c888ca 100644 --- a/test/compile_errors/stage1/obj/invalid_optional_type_in_extern_struct.zig +++ b/test/compile_errors/stage1/obj/invalid_optional_type_in_extern_struct.zig @@ -3,6 +3,8 @@ const stroo = extern struct { }; export fn testf(fluff: *stroo) void { _ = fluff; } -// invalid optional type in extern struct +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: extern structs cannot contain fields of type '?[*c]u8' diff --git a/test/compile_errors/stage1/obj/invalid_pointer_for_var_type.zig b/test/compile_errors/stage1/obj/invalid_pointer_for_var_type.zig index 599aef54f2b3083005c06a3303dd287bfec7d009..caf8c707975612901866ee4d53836b491436258d 100644 --- a/test/compile_errors/stage1/obj/invalid_pointer_for_var_type.zig +++ b/test/compile_errors/stage1/obj/invalid_pointer_for_var_type.zig @@ -6,6 +6,8 @@ export fn f() void { } } -// invalid pointer for var type +// error +// backend=stage1 +// target=native // // tmp.zig:2:13: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/invalid_pointer_syntax.zig b/test/compile_errors/stage1/obj/invalid_pointer_syntax.zig index d4b68200b65c91d5e04f83aededd3e742dfc9902..a4c823bde1a755b70782643ab988ff2a9db6bfb7 100644 --- a/test/compile_errors/stage1/obj/invalid_pointer_syntax.zig +++ b/test/compile_errors/stage1/obj/invalid_pointer_syntax.zig @@ -2,6 +2,8 @@ export fn foo() void { var guid: *:0 const u8 = undefined; } -// invalid pointer syntax +// error +// backend=stage1 +// target=native // // tmp.zig:2:16: error: expected type expression, found ':' diff --git a/test/compile_errors/stage1/obj/invalid_shift_amount_error.zig b/test/compile_errors/stage1/obj/invalid_shift_amount_error.zig index f4fe1cb2ff8e61d93c5e75384d32dfdceaed287f..7c84f2db38d98bdd31b22600e299233499810bf9 100644 --- a/test/compile_errors/stage1/obj/invalid_shift_amount_error.zig +++ b/test/compile_errors/stage1/obj/invalid_shift_amount_error.zig @@ -4,6 +4,8 @@ fn f() u16 { } export fn entry() u16 { return f(); } -// invalid shift amount error +// error +// backend=stage1 +// target=native // // tmp.zig:3:17: error: integer value 8 cannot be coerced to type 'u3' diff --git a/test/compile_errors/stage1/obj/invalid_struct_field.zig b/test/compile_errors/stage1/obj/invalid_struct_field.zig index 2d85914907206ee07d1c9a26bfb8a70f1f07c088..6264125bca531e2e83e0c9b908842441e11ddf95 100644 --- a/test/compile_errors/stage1/obj/invalid_struct_field.zig +++ b/test/compile_errors/stage1/obj/invalid_struct_field.zig @@ -11,7 +11,9 @@ export fn g() void { _ = y; } -// invalid struct field +// error +// backend=stage1 +// target=native // // tmp.zig:4:6: error: no member named 'foo' in struct 'A' // tmp.zig:10:16: error: no member named 'bar' in struct 'A' diff --git a/test/compile_errors/stage1/obj/invalid_suspend_in_exported_function.zig b/test/compile_errors/stage1/obj/invalid_suspend_in_exported_function.zig index da808563a55e7e614d0c3cb72e839633fe01b1ed..cfcbfba889dfd57b1260ee14df08d354f4973de4 100644 --- a/test/compile_errors/stage1/obj/invalid_suspend_in_exported_function.zig +++ b/test/compile_errors/stage1/obj/invalid_suspend_in_exported_function.zig @@ -7,7 +7,9 @@ fn func() void { suspend {} } -// invalid suspend in exported function +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: function with calling convention 'C' cannot be async // tmp.zig:3:18: note: await here is a suspend point diff --git a/test/compile_errors/stage1/obj/invalid_type.zig b/test/compile_errors/stage1/obj/invalid_type.zig index 030730051739aceeb21b5a02ccd3a06971570177..8a2952e5f2c32346811eb3a50dd399b7046a0a52 100644 --- a/test/compile_errors/stage1/obj/invalid_type.zig +++ b/test/compile_errors/stage1/obj/invalid_type.zig @@ -1,6 +1,8 @@ fn a() bogus {} export fn entry() void { _ = a(); } -// invalid type +// error +// backend=stage1 +// target=native // // tmp.zig:1:8: error: use of undeclared identifier 'bogus' diff --git a/test/compile_errors/stage1/obj/invalid_type_used_in_array_type.zig b/test/compile_errors/stage1/obj/invalid_type_used_in_array_type.zig index 26f0e6a7db8d2ebf33d0891d1c9c32450ac25338..3a7bc4272c04807cdd437948bc6b2af9021e4362 100644 --- a/test/compile_errors/stage1/obj/invalid_type_used_in_array_type.zig +++ b/test/compile_errors/stage1/obj/invalid_type_used_in_array_type.zig @@ -7,6 +7,8 @@ export fn entry() void { _ = a; } -// invalid type used in array type +// error +// backend=stage1 +// target=native // // tmp.zig:2:12: error: use of undeclared identifier 'SomeNonexistentType' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-1.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-1.zig index 5cea5401043e278f004ca8ca36a1e708da117123..a3e2827f3141bd39c163dffcf77ec5061d782301 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-1.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-1.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 1 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:23: note: invalid byte: '_' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-10.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-10.zig index d789579a2b7b0154ab249b3f8d6f54bf733e9db4..7d33244483322d15183a2388740db14d4147dbdd 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-10.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-10.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 10 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:25: note: invalid byte: '_' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-11.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-11.zig index 197b1140905b33647e5de0e753221e0f5a82c9db..fa4f5b8975f619a123e2c9a297d9a09c5587b981 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-11.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-11.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 11 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:28: note: invalid byte: '_' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-12.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-12.zig index 1d25c9f4b4952562f415382483548c9639054a69..2d36187711738ac775525c2818d8469fb62d0ba7 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-12.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-12.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 12 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:23: note: invalid byte: 'x' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-13.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-13.zig index c3de75ed32c2c4fbb44e249826e02e7c10f0e8ea..21b044121c9cfcbbf1ac2b1cfdeeb5a1f9140d2d 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-13.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-13.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 13 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:23: note: invalid byte: '_' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-14.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-14.zig index cbb967e926704ef3cfb26bb6a9c92ce00893a953..adb0727eba7f1822d8916a7c81a6f04042d9fb1c 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-14.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-14.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 14 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:27: note: invalid byte: 'p' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-2.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-2.zig index e83c1b420b25fa16d35ca4cf4096dd7424f513f9..16618c6a18b18f49ded416ae2cf0bc0ab8438a9d 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-2.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-2.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 2 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:23: note: invalid byte: '.' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-3.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-3.zig index f9ca8e0d7c4d624c86b69094611f0bc3ea432665..09e9e20b4b607af0e83801e7404de60619ef4af6 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-3.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-3.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 3 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:25: note: invalid byte: ';' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-4.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-4.zig index 20e8d3692e83fb8aa3572ac00e89e0568a8882f4..278ee35f5f2130fbf8a4490b3730645e24d639c1 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-4.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-4.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 4 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:25: note: invalid byte: '_' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-5.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-5.zig index 3719f54e06beaa69dd04dad7ca91d18d59b72f35..4912c15e504e4874775def6e859f278c1b628e65 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-5.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-5.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 5 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:26: note: invalid byte: '_' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-6.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-6.zig index 64a439538a30e0640c1be1a0640630b350507fcf..3386c860b93278e6322434bf58d5b2ed756a3220 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-6.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-6.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 6 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:26: note: invalid byte: '_' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-7.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-7.zig index 311b27339a56940669cc9ae8d4246aa8ae02481e..c0e57424a948fa2b50b2ed88f4d00223386f5a40 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-7.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-7.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 7 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:28: note: invalid byte: ';' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-9.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-9.zig index ecd1149f2261a0d397ec87f4443980c79e09d3d7..f7475332c1540149e921c03079cabb056ef5fc11 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-9.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-9.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in float literal - 9 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:23: note: invalid byte: '_' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-1.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-1.zig index 47da090745d02d65357ae47716f67385bb2e4e3b..9cea337db46ceb33d12386fb64c57aa4f3a64635 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-1.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-1.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in int literal - 1 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:26: note: invalid byte: ';' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-2.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-2.zig index bb230daa9e3d76e3dbb8276c5a8576a3de9bf262..5f02479f2e7d6b68de0a8323ffa1f91ccd934b2a 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-2.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-2.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in int literal - 2 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:28: note: invalid byte: ';' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-3.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-3.zig index 7808b6ee4dca31a6356d350a8bb5ee71cf6e7436..aed4cb90687f9394dfbf14664baa502ce0bf465d 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-3.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-3.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in int literal - 3 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:28: note: invalid byte: ';' diff --git a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-4.zig b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-4.zig index 51ddb3d0614578a1d30fe26568b632ec4f0415e7..dce2771048c9baf8e2c1d452cb331e6fa3927267 100644 --- a/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-4.zig +++ b/test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-4.zig @@ -3,7 +3,9 @@ fn main() void { _ = bad; } -// invalid underscore placement in int literal - 4 +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected expression, found 'invalid bytes' // tmp.zig:2:28: note: invalid byte: ';' diff --git a/test/compile_errors/stage1/obj/invalid_union_field_access_in_comptime.zig b/test/compile_errors/stage1/obj/invalid_union_field_access_in_comptime.zig index d570dca0b99e37a8f7f09f62e62d90a18f6e50d9..6d55f3b04fb3c0dcfde90f94d70023ae81a053c5 100644 --- a/test/compile_errors/stage1/obj/invalid_union_field_access_in_comptime.zig +++ b/test/compile_errors/stage1/obj/invalid_union_field_access_in_comptime.zig @@ -8,6 +8,8 @@ comptime { _ = bar_val; } -// invalid union field access in comptime +// error +// backend=stage1 +// target=native // // tmp.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set diff --git a/test/compile_errors/stage1/obj/issue_2032_compile_diagnostic_string_for_top_level_decl_type.zig b/test/compile_errors/stage1/obj/issue_2032_compile_diagnostic_string_for_top_level_decl_type.zig index 9e353a4d386ed60f51aa7c2220cd29ea16f7d610..c742cb9b7756546712193dc0f72db5e307b3ed6a 100644 --- a/test/compile_errors/stage1/obj/issue_2032_compile_diagnostic_string_for_top_level_decl_type.zig +++ b/test/compile_errors/stage1/obj/issue_2032_compile_diagnostic_string_for_top_level_decl_type.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = foo; } -// compile diagnostic string for top level decl type (issue 2032) +// error +// backend=stage1 +// target=native // // tmp.zig:2:27: error: type 'u32' does not support array initialization diff --git a/test/compile_errors/stage1/obj/issue_2687_coerce_from_undefined_array_pointer_to_slice.zig b/test/compile_errors/stage1/obj/issue_2687_coerce_from_undefined_array_pointer_to_slice.zig index 7c125b85cef8391cfb7d9f58af7bc4468cf1c870..21fbb6b4fe94a065781e911e13b83359e0125bb4 100644 --- a/test/compile_errors/stage1/obj/issue_2687_coerce_from_undefined_array_pointer_to_slice.zig +++ b/test/compile_errors/stage1/obj/issue_2687_coerce_from_undefined_array_pointer_to_slice.zig @@ -18,7 +18,9 @@ export fn foo3() void { } } -// issue #2687: coerce from undefined array pointer to slice +// error +// backend=stage1 +// target=native // // tmp.zig:3:19: error: use of undefined value here causes undefined behavior // tmp.zig:9:23: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/issue_3818_bitcast_from_parray-slice_to_u16.zig b/test/compile_errors/stage1/obj/issue_3818_bitcast_from_parray-slice_to_u16.zig index 1c9d9cd1b1b5c9fff2410be106bf4b146faa2137..cdc1def677920f15211808b80741d89965f5f960 100644 --- a/test/compile_errors/stage1/obj/issue_3818_bitcast_from_parray-slice_to_u16.zig +++ b/test/compile_errors/stage1/obj/issue_3818_bitcast_from_parray-slice_to_u16.zig @@ -9,7 +9,9 @@ export fn foo2() void { _ = word; } -// issue #3818: bitcast from parray/slice to u16 +// error +// backend=stage1 +// target=native // // tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8' // tmp.zig:8:32: error: destination type 'u16' has size 2 but source type '[]const u8' has size 16 diff --git a/test/compile_errors/stage1/obj/issue_4207_coerce_from_non-terminated-slice_to_terminated-pointer.zig b/test/compile_errors/stage1/obj/issue_4207_coerce_from_non-terminated-slice_to_terminated-pointer.zig index bfb0595cce186c82af9e8d18c4dd0cdd13263b58..d53f7731a091272165cdd221ecc5e3be024764b3 100644 --- a/test/compile_errors/stage1/obj/issue_4207_coerce_from_non-terminated-slice_to_terminated-pointer.zig +++ b/test/compile_errors/stage1/obj/issue_4207_coerce_from_non-terminated-slice_to_terminated-pointer.zig @@ -3,7 +3,9 @@ export fn foo() [*:0]const u8 { return buffer[0..]; } -// issue #4207: coerce from non-terminated-slice to terminated-pointer +// error +// backend=stage1 +// target=native // // :3:18: error: expected type '[*:0]const u8', found '*[64]u8' // :3:18: note: destination pointer requires a terminating '0' sentinel diff --git a/test/compile_errors/stage1/obj/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig b/test/compile_errors/stage1/obj/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig index aa839bc72ccdf02f111387f6011bf4cd8ec901b9..a622ceb44e0abf38d9131ed19eed8a4b9895cf73 100644 --- a/test/compile_errors/stage1/obj/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig +++ b/test/compile_errors/stage1/obj/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig @@ -8,7 +8,9 @@ export fn foo() void { comptime ignore(@typeInfo(MyStruct).Struct.fields[0]); } -// issue #5221: invalid struct init type referenced by @typeInfo and passed into function +// error +// backend=stage1 +// target=native // // :5:28: error: cannot cast pointer to array literal to slice type '[]u8' // :5:28: note: cast discards const qualifier diff --git a/test/compile_errors/stage1/obj/issue_5618_coercion_of_optional_anyopaque_to_anyopaque_must_fail.zig b/test/compile_errors/stage1/obj/issue_5618_coercion_of_optional_anyopaque_to_anyopaque_must_fail.zig index daa8a91f4036e44908d5105a1a86d956e356eb5b..9ba991083865b84cbe56ebfcc6fd8503b2ce5bc6 100644 --- a/test/compile_errors/stage1/obj/issue_5618_coercion_of_optional_anyopaque_to_anyopaque_must_fail.zig +++ b/test/compile_errors/stage1/obj/issue_5618_coercion_of_optional_anyopaque_to_anyopaque_must_fail.zig @@ -4,6 +4,8 @@ export fn foo() void { v = u; } -// Issue #5618: coercion of ?*anyopaque to *anyopaque must fail. +// error +// backend=stage1 +// target=native // // tmp.zig:4:9: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type '*anyopaque', found '?*anyopaque' diff --git a/test/compile_errors/stage1/obj/issue_7810-comptime_slice-len_increment_beyond_bounds.zig b/test/compile_errors/stage1/obj/issue_7810-comptime_slice-len_increment_beyond_bounds.zig index 533ac928b462fd50467af59cd2a7f7ffe542c686..c8b2f0b09e9310836c7c7e0766c9f99f20f36e9e 100644 --- a/test/compile_errors/stage1/obj/issue_7810-comptime_slice-len_increment_beyond_bounds.zig +++ b/test/compile_errors/stage1/obj/issue_7810-comptime_slice-len_increment_beyond_bounds.zig @@ -7,6 +7,8 @@ export fn foo_slice_len_increment_beyond_bounds() void { } } -// comptime slice-len increment beyond bounds +// error +// backend=stage1 +// target=native // // :6:12: error: out of bounds slice diff --git a/test/compile_errors/stage1/obj/issue_9346_return_outside_of_function_scope.zig b/test/compile_errors/stage1/obj/issue_9346_return_outside_of_function_scope.zig index 6be92e2ee8f579845b85137380ba210517dd0d80..d12bff2b49c542ef7b07e4832e606c23c247c616 100644 --- a/test/compile_errors/stage1/obj/issue_9346_return_outside_of_function_scope.zig +++ b/test/compile_errors/stage1/obj/issue_9346_return_outside_of_function_scope.zig @@ -1,5 +1,7 @@ pub const empty = return 1; -// issue #9346: return outside of function scope +// error +// backend=stage1 +// target=native // // tmp.zig:1:19: error: 'return' outside function scope diff --git a/test/compile_errors/stage1/obj/labeled_break_not_found.zig b/test/compile_errors/stage1/obj/labeled_break_not_found.zig index 0f4632d74d1f4bd85dcd4f8e5b5c4045903dc5a3..754e1864b096a6c76fcbdb3359c2dba8452da8c2 100644 --- a/test/compile_errors/stage1/obj/labeled_break_not_found.zig +++ b/test/compile_errors/stage1/obj/labeled_break_not_found.zig @@ -6,6 +6,8 @@ export fn entry() void { } } -// labeled break not found +// error +// backend=stage1 +// target=native // // tmp.zig:4:20: error: label not found: 'outer' diff --git a/test/compile_errors/stage1/obj/labeled_continue_not_found.zig b/test/compile_errors/stage1/obj/labeled_continue_not_found.zig index 8f95a0fce1741941ce3964f87d7afee5e24b53d8..b112e9b3557ffc9b463a1d6a3221151820e37490 100644 --- a/test/compile_errors/stage1/obj/labeled_continue_not_found.zig +++ b/test/compile_errors/stage1/obj/labeled_continue_not_found.zig @@ -7,6 +7,8 @@ export fn entry() void { } } -// labeled continue not found +// error +// backend=stage1 +// target=native // // tmp.zig:5:23: error: label not found: 'outer' diff --git a/test/compile_errors/stage1/obj/lazy_pointer_with_undefined_element_type.zig b/test/compile_errors/stage1/obj/lazy_pointer_with_undefined_element_type.zig index 47b271a05e12067a8ac95a196c1d9cf1f8fba93e..733a3ca2dd89d1b97050473303a5d90cd7747c8e 100644 --- a/test/compile_errors/stage1/obj/lazy_pointer_with_undefined_element_type.zig +++ b/test/compile_errors/stage1/obj/lazy_pointer_with_undefined_element_type.zig @@ -5,6 +5,8 @@ export fn foo() void { _ = I; } -// lazy pointer with undefined element type +// error +// backend=stage1 +// target=native // // :3:28: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/libc_headers_note.zig b/test/compile_errors/stage1/obj/libc_headers_note.zig new file mode 100644 index 0000000000000000000000000000000000000000..c8d9a9cbf3aff757f4b5ce532beb1ef430f37c72 --- /dev/null +++ b/test/compile_errors/stage1/obj/libc_headers_note.zig @@ -0,0 +1,12 @@ +const c = @cImport(@cInclude("stdio.h")); +export fn entry() void { + _ = c.printf("hello, world!\n"); +} + +// error +// backend=stage1 +// is_test=1 +// target=native-linux +// +// tmp.zig:1:11: error: C import failed +// tmp.zig:1:11: note: libc headers not available; compilation does not link against libc diff --git a/test/compile_errors/stage1/obj/load_too_many_bytes_from_comptime_reinterpreted_pointer.zig b/test/compile_errors/stage1/obj/load_too_many_bytes_from_comptime_reinterpreted_pointer.zig index 2c5e1c7327d61cdc0dadd239d0429cd9aed8108e..b275dbbeedbef7f25a3ec42a3c9a3e3c757542bc 100644 --- a/test/compile_errors/stage1/obj/load_too_many_bytes_from_comptime_reinterpreted_pointer.zig +++ b/test/compile_errors/stage1/obj/load_too_many_bytes_from_comptime_reinterpreted_pointer.zig @@ -6,6 +6,8 @@ export fn entry() void { _ = int_val; } -// load too many bytes from comptime reinterpreted pointer +// error +// backend=stage1 +// target=native // // tmp.zig:5:28: error: attempt to read 8 bytes from pointer to f32 which is 4 bytes diff --git a/test/compile_errors/stage1/obj/load_vector_pointer_with_unknown_runtime_index.zig b/test/compile_errors/stage1/obj/load_vector_pointer_with_unknown_runtime_index.zig index fe28fa91022e35166eb8d8a6130f14b3da1b0972..8d703b09e6c6c9a1a370badaade02aeebc252abe 100644 --- a/test/compile_errors/stage1/obj/load_vector_pointer_with_unknown_runtime_index.zig +++ b/test/compile_errors/stage1/obj/load_vector_pointer_with_unknown_runtime_index.zig @@ -10,6 +10,8 @@ fn loadv(ptr: anytype) i32 { return ptr.*; } -// load vector pointer with unknown runtime index +// error +// backend=stage1 +// target=native // // tmp.zig:10:12: error: unable to determine vector element index of type '*align(16:0:4:?) i32 diff --git a/test/compile_errors/stage1/obj/local_shadows_global_that_occurs_later.zig b/test/compile_errors/stage1/obj/local_shadows_global_that_occurs_later.zig index 2265a34f18cf8c26998f7b34def44f1fcbc7588a..4b9b58871ff0e689880772d357e433597f16275e 100644 --- a/test/compile_errors/stage1/obj/local_shadows_global_that_occurs_later.zig +++ b/test/compile_errors/stage1/obj/local_shadows_global_that_occurs_later.zig @@ -4,7 +4,9 @@ pub fn main() void { } fn foo() void {} -// local shadows global that occurs later +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: local shadows declaration of 'foo' // tmp.zig:5:1: note: declared here diff --git a/test/compile_errors/stage1/obj/local_variable_redeclaration.zig b/test/compile_errors/stage1/obj/local_variable_redeclaration.zig index 2367963edb006aa4414b864643654513338901e7..79eba0d4288233f7dd4f4d2ceba0f8b076d2b8eb 100644 --- a/test/compile_errors/stage1/obj/local_variable_redeclaration.zig +++ b/test/compile_errors/stage1/obj/local_variable_redeclaration.zig @@ -3,7 +3,9 @@ export fn f() void { var a = 0; } -// local variable redeclaration +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: redeclaration of local constant 'a' // tmp.zig:2:11: note: previous declaration here diff --git a/test/compile_errors/stage1/obj/local_variable_redeclares_parameter.zig b/test/compile_errors/stage1/obj/local_variable_redeclares_parameter.zig index e624e14e31dc0d1828193ebbae75f4ba33c62e35..854ef080c526909f13f0fc442303b6fc579a3bcd 100644 --- a/test/compile_errors/stage1/obj/local_variable_redeclares_parameter.zig +++ b/test/compile_errors/stage1/obj/local_variable_redeclares_parameter.zig @@ -3,7 +3,9 @@ fn f(a : i32) void { } export fn entry() void { f(1); } -// local variable redeclares parameter +// error +// backend=stage1 +// target=native // // tmp.zig:2:11: error: redeclaration of function parameter 'a' // tmp.zig:1:6: note: previous declaration here diff --git a/test/compile_errors/stage1/obj/local_variable_shadowing_global.zig b/test/compile_errors/stage1/obj/local_variable_shadowing_global.zig index c824cb3df7be50cfadb8644d06ee34405604639d..3f1af3a4cb891aab5048a4f5218f62489a557d8d 100644 --- a/test/compile_errors/stage1/obj/local_variable_shadowing_global.zig +++ b/test/compile_errors/stage1/obj/local_variable_shadowing_global.zig @@ -6,7 +6,9 @@ export fn entry() void { _ = Bar; } -// local variable shadowing global +// error +// backend=stage1 +// target=native // // tmp.zig:5:9: error: local shadows declaration of 'Bar' // tmp.zig:2:1: note: declared here diff --git a/test/compile_errors/stage1/obj/locally_shadowing_a_primitive_type.zig b/test/compile_errors/stage1/obj/locally_shadowing_a_primitive_type.zig index 457cea418c5e17290c3885d2f2cd2f834e1c9b82..e66a2082ea87fbf27a9338a7a5c7cfcda12e13c5 100644 --- a/test/compile_errors/stage1/obj/locally_shadowing_a_primitive_type.zig +++ b/test/compile_errors/stage1/obj/locally_shadowing_a_primitive_type.zig @@ -4,7 +4,9 @@ export fn foo() void { _ = a; } -// locally shadowing a primitive type +// error +// backend=stage1 +// target=native // // tmp.zig:2:11: error: name shadows primitive 'u8' // tmp.zig:2:11: note: consider using @"u8" to disambiguate diff --git a/test/compile_errors/stage1/obj/main_function_with_bogus_args_type.zig b/test/compile_errors/stage1/obj/main_function_with_bogus_args_type.zig index 3954c4b846df605d0daa357b7c2938a59dee9160..5808ab90ecc7b10d2587e6186a9ab28ecc6ff88b 100644 --- a/test/compile_errors/stage1/obj/main_function_with_bogus_args_type.zig +++ b/test/compile_errors/stage1/obj/main_function_with_bogus_args_type.zig @@ -1,5 +1,7 @@ pub fn main(args: [][]bogus) !void {_ = args;} -// main function with bogus args type +// error +// backend=stage1 +// target=native // // tmp.zig:1:23: error: use of undeclared identifier 'bogus' diff --git a/test/compile_errors/stage1/obj/method_call_with_first_arg_type_primitive.zig b/test/compile_errors/stage1/obj/method_call_with_first_arg_type_primitive.zig index 9763e84fbaf60d1c0f025985210a7f6b6dbd51fd..316be2d899f08ce8e1bb12e4e0dfc8550ddec941 100644 --- a/test/compile_errors/stage1/obj/method_call_with_first_arg_type_primitive.zig +++ b/test/compile_errors/stage1/obj/method_call_with_first_arg_type_primitive.zig @@ -14,6 +14,8 @@ export fn f() void { derp.init(); } -// method call with first arg type primitive +// error +// backend=stage1 +// target=native // // tmp.zig:14:5: error: expected type 'i32', found 'Foo' diff --git a/test/compile_errors/stage1/obj/method_call_with_first_arg_type_wrong_container.zig b/test/compile_errors/stage1/obj/method_call_with_first_arg_type_wrong_container.zig index ccbc7e32e3cc7e9d64d5d9fac9246c5014c4af40..04ab89fb6ca76262d9b51f8b311196270071c296 100644 --- a/test/compile_errors/stage1/obj/method_call_with_first_arg_type_wrong_container.zig +++ b/test/compile_errors/stage1/obj/method_call_with_first_arg_type_wrong_container.zig @@ -23,6 +23,8 @@ export fn foo() void { x.init(); } -// method call with first arg type wrong container +// error +// backend=stage1 +// target=native // // tmp.zig:23:5: error: expected type '*Allocator', found '*List' diff --git a/test/compile_errors/stage1/obj/missing_boolean_switch_value.zig b/test/compile_errors/stage1/obj/missing_boolean_switch_value.zig index 63a12c4e6f98fdf6371014fec388a80e39956cb3..2e9d4b48ce3f0ced8088ab957f22e995fc170054 100644 --- a/test/compile_errors/stage1/obj/missing_boolean_switch_value.zig +++ b/test/compile_errors/stage1/obj/missing_boolean_switch_value.zig @@ -11,7 +11,9 @@ comptime { _ = x; } -// missing boolean switch value +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: switch must handle all possibilities // tmp.zig:8:15: error: switch must handle all possibilities diff --git a/test/compile_errors/stage1/obj/missing_const_in_slice_with_nested_array_type.zig b/test/compile_errors/stage1/obj/missing_const_in_slice_with_nested_array_type.zig index 4f552284d79a8f4237753efcc7587f8e10922d13..af9d690d438316d9e3da093387302760c64aa9e7 100644 --- a/test/compile_errors/stage1/obj/missing_const_in_slice_with_nested_array_type.zig +++ b/test/compile_errors/stage1/obj/missing_const_in_slice_with_nested_array_type.zig @@ -11,6 +11,8 @@ export fn entry() void { _ = geo_data; } -// missing const in slice with nested array type +// error +// backend=stage1 +// target=native // // tmp.zig:4:30: error: array literal requires address-of operator (&) to coerce to slice type '[][2]f32' diff --git a/test/compile_errors/stage1/obj/missing_else_clause.zig b/test/compile_errors/stage1/obj/missing_else_clause.zig index 28adfd21e849f222a0ea32c33f466f4946f9615c..f331933437f2579377b6f3b29d607fa68787d5af 100644 --- a/test/compile_errors/stage1/obj/missing_else_clause.zig +++ b/test/compile_errors/stage1/obj/missing_else_clause.zig @@ -8,7 +8,9 @@ fn g(b: bool) void { } export fn entry() void { f(true); g(true); } -// missing else clause +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected type 'i32', found 'void' // tmp.zig:6:15: error: incompatible types: 'i32' and 'void' diff --git a/test/compile_errors/stage1/obj/missing_field_in_struct_value_expression.zig b/test/compile_errors/stage1/obj/missing_field_in_struct_value_expression.zig index bea4021a5a65995bf5fd5f38dafeaf728d674f06..9eb4246c8f76fa40b7901040d43e321514a5b375 100644 --- a/test/compile_errors/stage1/obj/missing_field_in_struct_value_expression.zig +++ b/test/compile_errors/stage1/obj/missing_field_in_struct_value_expression.zig @@ -13,6 +13,8 @@ export fn f() void { _ = a; } -// missing field in struct value expression +// error +// backend=stage1 +// target=native // // tmp.zig:9:17: error: missing field: 'x' diff --git a/test/compile_errors/stage1/obj/missing_function_call_param.zig b/test/compile_errors/stage1/obj/missing_function_call_param.zig index 45a72598141f2c36cb5cbbfa39c7244af4c1f5bd..9e08ed7140c6a50a6a19e79a42b1357a714958a4 100644 --- a/test/compile_errors/stage1/obj/missing_function_call_param.zig +++ b/test/compile_errors/stage1/obj/missing_function_call_param.zig @@ -24,6 +24,8 @@ fn f(foo: *const Foo, index: usize) void { export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// missing function call param +// error +// backend=stage1 +// target=native // // tmp.zig:20:34: error: expected 1 argument(s), found 0 diff --git a/test/compile_errors/stage1/obj/missing_function_name.zig b/test/compile_errors/stage1/obj/missing_function_name.zig index 194f5eb6a845d31f17aaf97c9468f6ac72ce36b5..cd9a3ca7ee96c625ea7b43a0867a29d9fedd4bb7 100644 --- a/test/compile_errors/stage1/obj/missing_function_name.zig +++ b/test/compile_errors/stage1/obj/missing_function_name.zig @@ -1,6 +1,8 @@ fn () void {} export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// missing function name +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: missing function name diff --git a/test/compile_errors/stage1/obj/missing_param_name.zig b/test/compile_errors/stage1/obj/missing_param_name.zig index 1c379dd245f2534ddf7eca7699e17030a500eb52..febb16d2cacc7adfb10ebc908e775c15128e2606 100644 --- a/test/compile_errors/stage1/obj/missing_param_name.zig +++ b/test/compile_errors/stage1/obj/missing_param_name.zig @@ -1,6 +1,8 @@ fn f(i32) void {} export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// missing param name +// error +// backend=stage1 +// target=native // // tmp.zig:1:6: error: missing parameter name diff --git a/test/compile_errors/stage1/obj/missing_parameter_name_of_generic_function.zig b/test/compile_errors/stage1/obj/missing_parameter_name_of_generic_function.zig index 3a3ccd28a82c517db62dcd23e2fa0e4488999518..041c0c4a47726ba9a806587c8b3fd7d1ae91cc1d 100644 --- a/test/compile_errors/stage1/obj/missing_parameter_name_of_generic_function.zig +++ b/test/compile_errors/stage1/obj/missing_parameter_name_of_generic_function.zig @@ -4,6 +4,8 @@ export fn entry() void { dump(a); } -// missing parameter name of generic function +// error +// backend=stage1 +// target=native // // tmp.zig:1:9: error: missing parameter name diff --git a/test/compile_errors/stage1/obj/missing_result_type_for_phi_node.zig b/test/compile_errors/stage1/obj/missing_result_type_for_phi_node.zig index 3ef99e08597663fc3cad4059abe46f34e51325a1..33bc1d0d9c907934d0ba055d91b128e31bec9265 100644 --- a/test/compile_errors/stage1/obj/missing_result_type_for_phi_node.zig +++ b/test/compile_errors/stage1/obj/missing_result_type_for_phi_node.zig @@ -5,6 +5,8 @@ export fn entry() void { foo() catch 0; } -// missing result type for phi node +// error +// backend=stage1 +// target=native // // tmp.zig:5:17: error: integer value 0 cannot be coerced to type 'void' diff --git a/test/compile_errors/stage1/obj/misspelled_type_with_pointer_only_reference.zig b/test/compile_errors/stage1/obj/misspelled_type_with_pointer_only_reference.zig index 6b3f647c0231c7bb749d104bfc38f3797f363365..8e2055a829912c9d3b4d55c24f09027d3407f94e 100644 --- a/test/compile_errors/stage1/obj/misspelled_type_with_pointer_only_reference.zig +++ b/test/compile_errors/stage1/obj/misspelled_type_with_pointer_only_reference.zig @@ -30,6 +30,8 @@ fn foo() void { export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// misspelled type with pointer only reference +// error +// backend=stage1 +// target=native // // tmp.zig:5:16: error: use of undeclared identifier 'JsonList' diff --git a/test/compile_errors/stage1/obj/mod_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/mod_assign_on_undefined_value.zig index 3165970d44248efc17a2b19eea4647b54d2d32e9..c127e256e8bd23f73517ed1dd5be34c20580a324 100644 --- a/test/compile_errors/stage1/obj/mod_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/mod_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a %= a; } -// mod assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/mod_on_undefined_value.zig b/test/compile_errors/stage1/obj/mod_on_undefined_value.zig index 3b33f6ed828890932e3c9a57d4ca624676ea78ff..8bd7774a4638148af6666ccca95c504195423e28 100644 --- a/test/compile_errors/stage1/obj/mod_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/mod_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a % a; } -// mod on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/mul_overflow_in_function_evaluation.zig b/test/compile_errors/stage1/obj/mul_overflow_in_function_evaluation.zig index ea8eea5ab57b11dfdea23ae39dabc389194cb3cc..8209b33f94145dd11431f295f7c7fea999ad9316 100644 --- a/test/compile_errors/stage1/obj/mul_overflow_in_function_evaluation.zig +++ b/test/compile_errors/stage1/obj/mul_overflow_in_function_evaluation.zig @@ -5,6 +5,8 @@ fn mul(a: u16, b: u16) u16 { export fn entry() usize { return @sizeOf(@TypeOf(y)); } -// mul overflow in function evaluation +// error +// backend=stage1 +// target=native // // tmp.zig:3:14: error: operation caused overflow diff --git a/test/compile_errors/stage1/obj/mult_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/mult_assign_on_undefined_value.zig index 4617c5f62b45f50da801b799c154667c20ff27b7..04040b975643bdefbc4045ab94a96991527f1871 100644 --- a/test/compile_errors/stage1/obj/mult_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/mult_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a *= a; } -// mult assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/mult_on_undefined_value.zig b/test/compile_errors/stage1/obj/mult_on_undefined_value.zig index 836b59e19db98a8aeebd35b07ab08ebdbf84037c..0dcd2b02f2d08afdee284ca4571bd5847ae97f74 100644 --- a/test/compile_errors/stage1/obj/mult_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/mult_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a * a; } -// mult on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/mult_wrap_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/mult_wrap_assign_on_undefined_value.zig index 38bd38bf79ab1dfc061d809b59db5105ce09fca5..db54af9f0b53687ac4e8c863efd40d61878b1080 100644 --- a/test/compile_errors/stage1/obj/mult_wrap_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/mult_wrap_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a *%= a; } -// mult wrap assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/mult_wrap_on_undefined_value.zig b/test/compile_errors/stage1/obj/mult_wrap_on_undefined_value.zig index 0c0ca4654066e860542cf28b3d313e81fa33d96b..9ad09f7e9306fc682e2a346f413040281999a378 100644 --- a/test/compile_errors/stage1/obj/mult_wrap_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/mult_wrap_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a *% a; } -// mult wrap on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/multiple_function_definitions.zig b/test/compile_errors/stage1/obj/multiple_function_definitions.zig index c4efefce8df4b1accacc1364b8bab1c24e2976d1..baa4a43048fccc340dd41de0f735a992fb1160aa 100644 --- a/test/compile_errors/stage1/obj/multiple_function_definitions.zig +++ b/test/compile_errors/stage1/obj/multiple_function_definitions.zig @@ -2,7 +2,9 @@ fn a() void {} fn a() void {} export fn entry() void { a(); } -// multiple function definitions +// error +// backend=stage1 +// target=native // // tmp.zig:2:1: error: redeclaration of 'a' // tmp.zig:1:1: note: other declaration here diff --git a/test/compile_errors/stage1/obj/negate_on_undefined_value.zig b/test/compile_errors/stage1/obj/negate_on_undefined_value.zig index 7e7e3921042af326162a01c855bbe7742489f572..f8d5f6128d48743bcacdcd267550e05d9903e203 100644 --- a/test/compile_errors/stage1/obj/negate_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/negate_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = -a; } -// negate on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:10: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/negate_wrap_on_undefined_value.zig b/test/compile_errors/stage1/obj/negate_wrap_on_undefined_value.zig index f49c6eac344cd349d550ac31c9ec7baa315f0a2c..4ca32956de7e8bb4de3c877b8246bdd017d44394 100644 --- a/test/compile_errors/stage1/obj/negate_wrap_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/negate_wrap_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = -%a; } -// negate wrap on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:11: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/negation_overflow_in_function_evaluation.zig b/test/compile_errors/stage1/obj/negation_overflow_in_function_evaluation.zig index ca69b6fb5d86edf3d8c15686bb97454dfe96cead..f83e0de6ae33c50986f0ef06f063b4bd353ee35f 100644 --- a/test/compile_errors/stage1/obj/negation_overflow_in_function_evaluation.zig +++ b/test/compile_errors/stage1/obj/negation_overflow_in_function_evaluation.zig @@ -5,6 +5,8 @@ fn neg(x: i8) i8 { export fn entry() usize { return @sizeOf(@TypeOf(y)); } -// negation overflow in function evaluation +// error +// backend=stage1 +// target=native // // tmp.zig:3:12: error: negation caused overflow diff --git a/test/compile_errors/stage1/obj/nested_error_set_mismatch.zig b/test/compile_errors/stage1/obj/nested_error_set_mismatch.zig index 6c677049dfc5c45e71762fa35f0d528229180443..cd037635bc4cc8b5ccd35d8671645be45e8a2695 100644 --- a/test/compile_errors/stage1/obj/nested_error_set_mismatch.zig +++ b/test/compile_errors/stage1/obj/nested_error_set_mismatch.zig @@ -10,7 +10,9 @@ fn foo() ?OtherError!i32 { return null; } -// nested error set mismatch +// error +// backend=stage1 +// target=native // // tmp.zig:5:34: error: expected type '?NextError!i32', found '?OtherError!i32' // tmp.zig:5:34: note: optional type child 'OtherError!i32' cannot cast into optional type child 'NextError!i32' diff --git a/test/compile_errors/stage1/obj/no_else_prong_on_switch_on_global_error_set.zig b/test/compile_errors/stage1/obj/no_else_prong_on_switch_on_global_error_set.zig index 7de3f189f08b08af8ac467cc070647baa805c987..39f4399cafcb6c11ca997f115329ebb5fc8891b4 100644 --- a/test/compile_errors/stage1/obj/no_else_prong_on_switch_on_global_error_set.zig +++ b/test/compile_errors/stage1/obj/no_else_prong_on_switch_on_global_error_set.zig @@ -7,6 +7,8 @@ fn foo(a: anyerror) void { } } -// no else prong on switch on global error set +// error +// backend=stage1 +// target=native // // tmp.zig:5:5: error: else prong required when switching on type 'anyerror' diff --git a/test/compile_errors/stage1/obj/noalias_on_non_pointer_param.zig b/test/compile_errors/stage1/obj/noalias_on_non_pointer_param.zig index 3419dc8c99590c8a97ba528dc6a4de7129a5c4d6..ca84aca73f65615812281bf10695672c6cd61207 100644 --- a/test/compile_errors/stage1/obj/noalias_on_non_pointer_param.zig +++ b/test/compile_errors/stage1/obj/noalias_on_non_pointer_param.zig @@ -1,6 +1,8 @@ fn f(noalias x: i32) void { _ = x; } export fn entry() void { f(1234); } -// noalias on non pointer param +// error +// backend=stage1 +// target=native // // tmp.zig:1:6: error: noalias on non-pointer parameter diff --git a/test/compile_errors/stage1/obj/non-async_function_pointer_eventually_is_inferred_to_become_async.zig b/test/compile_errors/stage1/obj/non-async_function_pointer_eventually_is_inferred_to_become_async.zig index 93391daaefc0dc9f959912ce15e44f0f27fb714b..e18b4200289d80343d38cee2da9101f81916c0f5 100644 --- a/test/compile_errors/stage1/obj/non-async_function_pointer_eventually_is_inferred_to_become_async.zig +++ b/test/compile_errors/stage1/obj/non-async_function_pointer_eventually_is_inferred_to_become_async.zig @@ -6,7 +6,9 @@ fn func() void { suspend {} } -// non-async function pointer eventually is inferred to become async +// error +// backend=stage1 +// target=native // // tmp.zig:5:1: error: 'func' cannot be async // tmp.zig:3:20: note: required to be non-async here diff --git a/test/compile_errors/stage1/obj/non-const_expression_function_call_with_struct_return_value_outside_function.zig b/test/compile_errors/stage1/obj/non-const_expression_function_call_with_struct_return_value_outside_function.zig index d6a463e71fc9e84bbbdaf32dd5d802b1218dab7c..25e33d1435425bb78f249de714ae593ce47d71e5 100644 --- a/test/compile_errors/stage1/obj/non-const_expression_function_call_with_struct_return_value_outside_function.zig +++ b/test/compile_errors/stage1/obj/non-const_expression_function_call_with_struct_return_value_outside_function.zig @@ -10,6 +10,8 @@ var global_side_effect = false; export fn entry() usize { return @sizeOf(@TypeOf(a)); } -// non-const expression function call with struct return value outside function +// error +// backend=stage1 +// target=native // // tmp.zig:6:26: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/non-const_expression_in_struct_literal_outside_function.zig b/test/compile_errors/stage1/obj/non-const_expression_in_struct_literal_outside_function.zig index ef7b1309c3a0d337e56ae52a7bd977ab86449403..46b94f1f96994ad0d1193ba9431c0d0fe13c0cb2 100644 --- a/test/compile_errors/stage1/obj/non-const_expression_in_struct_literal_outside_function.zig +++ b/test/compile_errors/stage1/obj/non-const_expression_in_struct_literal_outside_function.zig @@ -6,6 +6,8 @@ extern fn get_it() i32; export fn entry() usize { return @sizeOf(@TypeOf(a)); } -// non-const expression in struct literal outside function +// error +// backend=stage1 +// target=native // // tmp.zig:4:21: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/non-const_switch_number_literal.zig b/test/compile_errors/stage1/obj/non-const_switch_number_literal.zig index aecaa7dcb69bce8ffe66f6f2d402da44c0c00e51..005db548ed7bbce6cbcedb79491ce64aa288d57a 100644 --- a/test/compile_errors/stage1/obj/non-const_switch_number_literal.zig +++ b/test/compile_errors/stage1/obj/non-const_switch_number_literal.zig @@ -10,6 +10,8 @@ fn bar() i32 { return 2; } -// non-const switch number literal +// error +// backend=stage1 +// target=native // // tmp.zig:5:17: error: cannot store runtime value in type 'comptime_int' diff --git a/test/compile_errors/stage1/obj/non-const_variables_of_things_that_require_const_variables.zig b/test/compile_errors/stage1/obj/non-const_variables_of_things_that_require_const_variables.zig index 0598e04e4bcd07310a3992e6ebcbb3234799cfae..73ef29aa5472a7f619dfa18039665ec9c62ccc3e 100644 --- a/test/compile_errors/stage1/obj/non-const_variables_of_things_that_require_const_variables.zig +++ b/test/compile_errors/stage1/obj/non-const_variables_of_things_that_require_const_variables.zig @@ -35,7 +35,9 @@ const Foo = struct { fn bar(self: *const Foo) void {_ = self;} }; -// non-const variables of things that require const variables +// error +// backend=stage1 +// target=native // // tmp.zig:2:4: error: variable of type '*const comptime_int' must be const or comptime // tmp.zig:6:4: error: variable of type '@Type(.Undefined)' must be const or comptime diff --git a/test/compile_errors/stage1/obj/non-enum_tag_type_passed_to_union.zig b/test/compile_errors/stage1/obj/non-enum_tag_type_passed_to_union.zig index 3161f16b28ea7e8a8d6e531534ce706bee2c8ff9..e188a3f819fd55ac18a82e8ed4b37d36e236898b 100644 --- a/test/compile_errors/stage1/obj/non-enum_tag_type_passed_to_union.zig +++ b/test/compile_errors/stage1/obj/non-enum_tag_type_passed_to_union.zig @@ -6,6 +6,8 @@ export fn entry() void { _ = x; } -// non-enum tag type passed to union +// error +// backend=stage1 +// target=native // // tmp.zig:1:19: error: expected enum tag type, found 'u32' diff --git a/test/compile_errors/stage1/obj/non-extern_function_with_var_args.zig b/test/compile_errors/stage1/obj/non-extern_function_with_var_args.zig index 02b99383c11b7d4ccc7b8ee664803c7607b83514..9e5463d451c92e4a36dfb568df084b9570cd7968 100644 --- a/test/compile_errors/stage1/obj/non-extern_function_with_var_args.zig +++ b/test/compile_errors/stage1/obj/non-extern_function_with_var_args.zig @@ -3,6 +3,8 @@ export fn entry() void { foo(); } -// non-extern function with var args +// error +// backend=stage1 +// target=native // // tmp.zig:1:14: error: expected type expression, found '...' diff --git a/test/compile_errors/stage1/obj/non-inline_for_loop_on_a_type_that_requires_comptime.zig b/test/compile_errors/stage1/obj/non-inline_for_loop_on_a_type_that_requires_comptime.zig index 9190e7cea8910d8e64bd19a40450944b9b5962cf..d2b4e28ea6d2afb7855ac2f1c035e253c2c07812 100644 --- a/test/compile_errors/stage1/obj/non-inline_for_loop_on_a_type_that_requires_comptime.zig +++ b/test/compile_errors/stage1/obj/non-inline_for_loop_on_a_type_that_requires_comptime.zig @@ -7,6 +7,8 @@ export fn entry() void { for (xx) |f| { _ = f;} } -// non-inline for loop on a type that requires comptime +// error +// backend=stage1 +// target=native // // tmp.zig:7:5: error: values of type 'Foo' must be comptime known, but index value is runtime known diff --git a/test/compile_errors/stage1/obj/non-integer_tag_type_to_automatic_union_enum.zig b/test/compile_errors/stage1/obj/non-integer_tag_type_to_automatic_union_enum.zig index a84ca36f6cf15f95471cdc15d9615502f8c50ebb..41d5e1416353753c2d97c8c3e34b93c43d03b008 100644 --- a/test/compile_errors/stage1/obj/non-integer_tag_type_to_automatic_union_enum.zig +++ b/test/compile_errors/stage1/obj/non-integer_tag_type_to_automatic_union_enum.zig @@ -6,6 +6,8 @@ export fn entry() void { _ = x; } -// non-integer tag type to automatic union enum +// error +// backend=stage1 +// target=native // // tmp.zig:1:24: error: expected integer tag type, found 'f32' diff --git a/test/compile_errors/stage1/obj/non-pure_function_returns_type.zig b/test/compile_errors/stage1/obj/non-pure_function_returns_type.zig index 0925207b9f8dc118731ba5b2ed9415e62577a9fa..9d1c642273a5268eb34867626a7095a176a08a1a 100644 --- a/test/compile_errors/stage1/obj/non-pure_function_returns_type.zig +++ b/test/compile_errors/stage1/obj/non-pure_function_returns_type.zig @@ -17,6 +17,8 @@ export fn function_with_return_type_type() void { list.length = 10; } -// non-pure function returns type +// error +// backend=stage1 +// target=native // // tmp.zig:3:7: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/non_async_function_pointer_passed_to_asyncCall.zig b/test/compile_errors/stage1/obj/non_async_function_pointer_passed_to_asyncCall.zig index 73c4fd96ca1f21f9f328b56d7bb90bbaf0c87ce1..d8ab4087e0a32dd2971c7bc51e3b662d30281bb0 100644 --- a/test/compile_errors/stage1/obj/non_async_function_pointer_passed_to_asyncCall.zig +++ b/test/compile_errors/stage1/obj/non_async_function_pointer_passed_to_asyncCall.zig @@ -5,6 +5,8 @@ export fn entry() void { } fn afunc() void { } -// non async function pointer passed to @asyncCall +// error +// backend=stage1 +// target=native // // tmp.zig:4:32: error: expected async function, found 'fn() void' diff --git a/test/compile_errors/stage1/obj/non_compile_time_array_concatenation.zig b/test/compile_errors/stage1/obj/non_compile_time_array_concatenation.zig index c119cc03f7b0a803706841e8d3083e73b6314e67..e70e6daf324fe492660e3da37d4d4655820b2705 100644 --- a/test/compile_errors/stage1/obj/non_compile_time_array_concatenation.zig +++ b/test/compile_errors/stage1/obj/non_compile_time_array_concatenation.zig @@ -4,6 +4,8 @@ fn f() []u8 { var s: [10]u8 = undefined; export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// non compile time array concatenation +// error +// backend=stage1 +// target=native // // tmp.zig:2:12: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/non_constant_expression_in_array_size.zig b/test/compile_errors/stage1/obj/non_constant_expression_in_array_size.zig index fe289212653063052e539f896d3a91107230342f..a0cb8e8ce15cbe6eb7f23917a2ce84d9293853de 100644 --- a/test/compile_errors/stage1/obj/non_constant_expression_in_array_size.zig +++ b/test/compile_errors/stage1/obj/non_constant_expression_in_array_size.zig @@ -6,7 +6,9 @@ fn get() usize { return global_var; } export fn entry() usize { return @sizeOf(@TypeOf(Foo)); } -// non constant expression in array size +// error +// backend=stage1 +// target=native // // tmp.zig:5:25: error: cannot store runtime value in compile time variable // tmp.zig:2:12: note: called from here diff --git a/test/compile_errors/stage1/obj/non_error_sets_used_in_merge_error_sets_operator.zig b/test/compile_errors/stage1/obj/non_error_sets_used_in_merge_error_sets_operator.zig index c600bea8b0cbceec4588e7618de2eefc985e99b9..fc3431820c528574b508a57f984c9807edcb9d7d 100644 --- a/test/compile_errors/stage1/obj/non_error_sets_used_in_merge_error_sets_operator.zig +++ b/test/compile_errors/stage1/obj/non_error_sets_used_in_merge_error_sets_operator.zig @@ -7,7 +7,9 @@ export fn bar() void { _ = Errors; } -// non error sets used in merge error sets operator +// error +// backend=stage1 +// target=native // // tmp.zig:2:20: error: expected error set type, found type 'u8' // tmp.zig:2:23: note: `||` merges error sets; `or` performs boolean OR diff --git a/test/compile_errors/stage1/obj/non_float_passed_to_floatToInt.zig b/test/compile_errors/stage1/obj/non_float_passed_to_floatToInt.zig index cad658ba5a7e564007631f6231f673e08f7f57f0..c91025906a66cfaf91b1cb91072cbe9adbd49f75 100644 --- a/test/compile_errors/stage1/obj/non_float_passed_to_floatToInt.zig +++ b/test/compile_errors/stage1/obj/non_float_passed_to_floatToInt.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// non float passed to @floatToInt +// error +// backend=stage1 +// target=native // // tmp.zig:2:32: error: expected float type, found 'i32' diff --git a/test/compile_errors/stage1/obj/non_int_passed_to_intToFloat.zig b/test/compile_errors/stage1/obj/non_int_passed_to_intToFloat.zig index 8b985c2b0beb305f1b439e86ca356b5cc668b027..8f6acca51e083db32fbbb0a7bf1e90a1a974f069 100644 --- a/test/compile_errors/stage1/obj/non_int_passed_to_intToFloat.zig +++ b/test/compile_errors/stage1/obj/non_int_passed_to_intToFloat.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// non int passed to @intToFloat +// error +// backend=stage1 +// target=native // // tmp.zig:2:32: error: expected int type, found 'comptime_float' diff --git a/test/compile_errors/stage1/obj/non_pointer_given_to_ptrToInt.zig b/test/compile_errors/stage1/obj/non_pointer_given_to_ptrToInt.zig index 1d4d3087da758dff83df11380b693fbdbc2c7885..7824c0f7964f68a586301350a515afc5cd4ac5c7 100644 --- a/test/compile_errors/stage1/obj/non_pointer_given_to_ptrToInt.zig +++ b/test/compile_errors/stage1/obj/non_pointer_given_to_ptrToInt.zig @@ -2,6 +2,8 @@ export fn entry(x: i32) usize { return @ptrToInt(x); } -// non pointer given to @ptrToInt +// error +// backend=stage1 +// target=native // // tmp.zig:2:22: error: expected pointer, found 'i32' diff --git a/test/compile_errors/stage1/obj/normal_string_with_newline.zig b/test/compile_errors/stage1/obj/normal_string_with_newline.zig index dafc041744fdf87cfdd8179bee1373643b641d9b..f6c1d1b1b9b1a47bd26f4f544a35c5b8df64078f 100644 --- a/test/compile_errors/stage1/obj/normal_string_with_newline.zig +++ b/test/compile_errors/stage1/obj/normal_string_with_newline.zig @@ -1,7 +1,9 @@ const foo = "a b"; -// normal string with newline +// error +// backend=stage1 +// target=native // // tmp.zig:1:13: error: expected expression, found 'invalid bytes' // tmp.zig:1:15: note: invalid byte: '\n' diff --git a/test/compile_errors/stage1/obj/offsetOf-bad_field_name.zig b/test/compile_errors/stage1/obj/offsetOf-bad_field_name.zig index 3b301e2677306ddba01b2eedbd08a307d7c7d675..de5b82c22c6c68a7f8d835e421266f5327948859 100644 --- a/test/compile_errors/stage1/obj/offsetOf-bad_field_name.zig +++ b/test/compile_errors/stage1/obj/offsetOf-bad_field_name.zig @@ -5,6 +5,8 @@ export fn foo() usize { return @offsetOf(Foo, "a",); } -// @offsetOf - bad field name +// error +// backend=stage1 +// target=native // // tmp.zig:5:27: error: struct 'Foo' has no field 'a' diff --git a/test/compile_errors/stage1/obj/offsetOf-non_struct.zig b/test/compile_errors/stage1/obj/offsetOf-non_struct.zig index 173119407ab0e9b1c0b0bb28e60cd4ab73580069..15275b827b2fedb3a8c28f17d1957b38d8f013f5 100644 --- a/test/compile_errors/stage1/obj/offsetOf-non_struct.zig +++ b/test/compile_errors/stage1/obj/offsetOf-non_struct.zig @@ -3,6 +3,8 @@ export fn foo() usize { return @offsetOf(Foo, "a",); } -// @offsetOf - non struct +// error +// backend=stage1 +// target=native // // tmp.zig:3:22: error: expected struct type, found 'i32' diff --git a/test/compile_errors/stage1/obj/only_equality_binary_operator_allowed_for_error_sets.zig b/test/compile_errors/stage1/obj/only_equality_binary_operator_allowed_for_error_sets.zig index 58512ef2a6e8e7c86e489b7f969fe08e69ebac84..ff9c4d18a29ccbe9350b203f18ad284e572b9622 100644 --- a/test/compile_errors/stage1/obj/only_equality_binary_operator_allowed_for_error_sets.zig +++ b/test/compile_errors/stage1/obj/only_equality_binary_operator_allowed_for_error_sets.zig @@ -3,6 +3,8 @@ comptime { _ = z; } -// only equality binary operator allowed for error sets +// error +// backend=stage1 +// target=native // // tmp.zig:2:23: error: operator not allowed for errors diff --git a/test/compile_errors/stage1/obj/opaque_type_with_field.zig b/test/compile_errors/stage1/obj/opaque_type_with_field.zig index 748d5c0736b473f36977afe7485c606a0e50516a..0b87091de945bdf3b94fd987de5496ca4336d839 100644 --- a/test/compile_errors/stage1/obj/opaque_type_with_field.zig +++ b/test/compile_errors/stage1/obj/opaque_type_with_field.zig @@ -4,6 +4,8 @@ export fn entry() void { _ = foo; } -// opaque type with field +// error +// backend=stage1 +// target=native // // tmp.zig:1:25: error: opaque types cannot have fields diff --git a/test/compile_errors/stage1/obj/optional_pointer_to_void_in_extern_struct.zig b/test/compile_errors/stage1/obj/optional_pointer_to_void_in_extern_struct.zig index f4ebb577d9ebf0b70d5d861276756c6b6ea96509..552f672ad667b49a7320c60951c59bd77cea699c 100644 --- a/test/compile_errors/stage1/obj/optional_pointer_to_void_in_extern_struct.zig +++ b/test/compile_errors/stage1/obj/optional_pointer_to_void_in_extern_struct.zig @@ -7,6 +7,8 @@ const Bar = extern struct { }; export fn entry(bar: *Bar) void {_ = bar;} -// optional pointer to void in extern struct +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: extern structs cannot contain fields of type '?*const void' diff --git a/test/compile_errors/stage1/obj/or_on_undefined_value.zig b/test/compile_errors/stage1/obj/or_on_undefined_value.zig index ac636bff9ed338bcedb5891b8dc3071c7201fe48..11e6c41deaa52764da050eea129327b3e530550e 100644 --- a/test/compile_errors/stage1/obj/or_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/or_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a or a; } -// or on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/orelse_on_undefined_value.zig b/test/compile_errors/stage1/obj/orelse_on_undefined_value.zig index 28e7c4b425fa1d60cfb6ea138fad350f15c556ae..3042c208eb3fbe2ad65e0ccb95d087147a78cfda 100644 --- a/test/compile_errors/stage1/obj/orelse_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/orelse_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a orelse false; } -// orelse on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:11: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/out_of_range_comptime_int_passed_to_floatToInt.zig b/test/compile_errors/stage1/obj/out_of_range_comptime_int_passed_to_floatToInt.zig index 581bb58ffd86f7b7fe42ffcb28a020cfdd17fc93..1a1dd541c91517a3289bb1b4a9d22bd339cef0ea 100644 --- a/test/compile_errors/stage1/obj/out_of_range_comptime_int_passed_to_floatToInt.zig +++ b/test/compile_errors/stage1/obj/out_of_range_comptime_int_passed_to_floatToInt.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// out of range comptime_int passed to @floatToInt +// error +// backend=stage1 +// target=native // // tmp.zig:2:31: error: integer value 200 cannot be coerced to type 'i8' diff --git a/test/compile_errors/stage1/obj/overflow_in_enum_value_allocation.zig b/test/compile_errors/stage1/obj/overflow_in_enum_value_allocation.zig index 5c737e06a2b8be21ad670bda7e08c68efa3a6def..c5dc5c1dcf8f697da9504f335a5da40150a4fbc1 100644 --- a/test/compile_errors/stage1/obj/overflow_in_enum_value_allocation.zig +++ b/test/compile_errors/stage1/obj/overflow_in_enum_value_allocation.zig @@ -7,6 +7,8 @@ pub fn main() void { _ = y; } -// overflow in enum value allocation +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: enumeration value 256 too large for type 'u8' diff --git a/test/compile_errors/stage1/obj/packed_union_given_enum_tag_type.zig b/test/compile_errors/stage1/obj/packed_union_given_enum_tag_type.zig index f0bc445295d3be72b74d5874aa59502a8d26debf..fceb7af65c7c643273d0b490ef1884042296505e 100644 --- a/test/compile_errors/stage1/obj/packed_union_given_enum_tag_type.zig +++ b/test/compile_errors/stage1/obj/packed_union_given_enum_tag_type.zig @@ -13,6 +13,8 @@ export fn entry() void { _ = a; } -// packed union given enum tag type +// error +// backend=stage1 +// target=native // // tmp.zig:6:30: error: packed union does not support enum tag type diff --git a/test/compile_errors/stage1/obj/packed_union_with_automatic_layout_field.zig b/test/compile_errors/stage1/obj/packed_union_with_automatic_layout_field.zig index 4450531a5ba91e9386dc23b1b87af29c37a9a096..99ad6ca306aaeb666ef9b62cc4fb31c2f045486b 100644 --- a/test/compile_errors/stage1/obj/packed_union_with_automatic_layout_field.zig +++ b/test/compile_errors/stage1/obj/packed_union_with_automatic_layout_field.zig @@ -11,6 +11,8 @@ export fn entry() void { _ = a; } -// packed union with automatic layout field +// error +// backend=stage1 +// target=native // // tmp.zig:6:5: error: non-packed, non-extern struct 'Foo' not allowed in packed union; no guaranteed in-memory representation diff --git a/test/compile_errors/stage1/obj/panic_called_at_compile_time.zig b/test/compile_errors/stage1/obj/panic_called_at_compile_time.zig index 6dd32cdf5914e08ea055b0d8c31312a0f411dbfb..7c169329130519f2c34c03d7040771a2f730b93f 100644 --- a/test/compile_errors/stage1/obj/panic_called_at_compile_time.zig +++ b/test/compile_errors/stage1/obj/panic_called_at_compile_time.zig @@ -4,6 +4,8 @@ export fn entry() void { } } -// @panic called at compile time +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: encountered @panic at compile-time diff --git a/test/compile_errors/stage1/obj/parameter_redeclaration.zig b/test/compile_errors/stage1/obj/parameter_redeclaration.zig index 01fc507afc8ed71f895017cef91cfbe80478ed7d..528eee8374400973c1e1b7dac9927050f2d32bf9 100644 --- a/test/compile_errors/stage1/obj/parameter_redeclaration.zig +++ b/test/compile_errors/stage1/obj/parameter_redeclaration.zig @@ -2,7 +2,9 @@ fn f(a : i32, a : i32) void { } export fn entry() void { f(1, 2); } -// parameter redeclaration +// error +// backend=stage1 +// target=native // // tmp.zig:1:15: error: redeclaration of function parameter 'a' // tmp.zig:1:6: note: previous declaration here diff --git a/test/compile_errors/stage1/obj/parameter_shadowing_global.zig b/test/compile_errors/stage1/obj/parameter_shadowing_global.zig index a58a0b93cedfa7d0679d10d823cc7fa6aac202c2..ce417d7188a1ced348d7a53380acbf285ddb7f11 100644 --- a/test/compile_errors/stage1/obj/parameter_shadowing_global.zig +++ b/test/compile_errors/stage1/obj/parameter_shadowing_global.zig @@ -4,7 +4,9 @@ export fn entry() void { f(1234); } -// parameter shadowing global +// error +// backend=stage1 +// target=native // // tmp.zig:2:6: error: local shadows declaration of 'Foo' // tmp.zig:1:1: note: declared here diff --git a/test/compile_errors/stage1/obj/pass_const_ptr_to_mutable_ptr_fn.zig b/test/compile_errors/stage1/obj/pass_const_ptr_to_mutable_ptr_fn.zig index ff0057bb4876e35b5967476ec98a06b4ec442d00..3209bb73217fce1ed8f6c180ab99a703f5e22420 100644 --- a/test/compile_errors/stage1/obj/pass_const_ptr_to_mutable_ptr_fn.zig +++ b/test/compile_errors/stage1/obj/pass_const_ptr_to_mutable_ptr_fn.zig @@ -10,6 +10,8 @@ fn ptrEql(a: *[]const u8, b: *[]const u8) bool { export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// pass const ptr to mutable ptr fn +// error +// backend=stage1 +// target=native // // tmp.zig:4:19: error: expected type '*[]const u8', found '*const []const u8' diff --git a/test/compile_errors/stage1/obj/passing_a_not-aligned-enough_pointer_to_cmpxchg.zig b/test/compile_errors/stage1/obj/passing_a_not-aligned-enough_pointer_to_cmpxchg.zig index 40564998b7ec41cc94c67b7acc05354e085d335b..c1725f1ee85fa9d7236c598ce30e54fd06d73578 100644 --- a/test/compile_errors/stage1/obj/passing_a_not-aligned-enough_pointer_to_cmpxchg.zig +++ b/test/compile_errors/stage1/obj/passing_a_not-aligned-enough_pointer_to_cmpxchg.zig @@ -5,6 +5,8 @@ export fn entry() bool { return x == 5678; } -// passing a not-aligned-enough pointer to cmpxchg +// error +// backend=stage1 +// target=native // // tmp.zig:4:32: error: expected type '*i32', found '*align(1) i32' diff --git a/test/compile_errors/stage1/obj/passing_an_under-aligned_function_pointer.zig b/test/compile_errors/stage1/obj/passing_an_under-aligned_function_pointer.zig index f6c0e52cc01bcc9cd2740ef2e4fd8b5fe3226216..d67bd42a72909fc074b84ed9de4f197ae388b93f 100644 --- a/test/compile_errors/stage1/obj/passing_an_under-aligned_function_pointer.zig +++ b/test/compile_errors/stage1/obj/passing_an_under-aligned_function_pointer.zig @@ -6,6 +6,8 @@ fn testImplicitlyDecreaseFnAlign(ptr: fn () align(8) i32, answer: i32) void { } fn alignedSmall() align(4) i32 { return 1234; } -// passing an under-aligned function pointer +// error +// backend=stage1 +// target=native // // tmp.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32' diff --git a/test/compile_errors/stage1/obj/peer_cast_then_implicit_cast_const_pointer_to_mutable_C_pointer.zig b/test/compile_errors/stage1/obj/peer_cast_then_implicit_cast_const_pointer_to_mutable_C_pointer.zig index 78f072c0d077032df6b85b6eeb8c78a6b635d273..7d18e760c3045f33062f812bbc86328ec736dfc8 100644 --- a/test/compile_errors/stage1/obj/peer_cast_then_implicit_cast_const_pointer_to_mutable_C_pointer.zig +++ b/test/compile_errors/stage1/obj/peer_cast_then_implicit_cast_const_pointer_to_mutable_C_pointer.zig @@ -3,7 +3,9 @@ export fn func() void { strValue = strValue orelse ""; } -// peer cast then implicit cast const pointer to mutable C pointer +// error +// backend=stage1 +// target=native // // tmp.zig:3:32: error: expected type '[*c]u8', found '*const [0:0]u8' // tmp.zig:3:32: note: cast discards const qualifier diff --git a/test/compile_errors/stage1/obj/pointer_arithmetic_on_pointer-to-array.zig b/test/compile_errors/stage1/obj/pointer_arithmetic_on_pointer-to-array.zig index b293ae2b321b9cd71a92646789aae16f2e1c4511..6542aa69687b243b695ff0344045f0f79097d16e 100644 --- a/test/compile_errors/stage1/obj/pointer_arithmetic_on_pointer-to-array.zig +++ b/test/compile_errors/stage1/obj/pointer_arithmetic_on_pointer-to-array.zig @@ -5,6 +5,8 @@ export fn foo() void { _ = z; } -// pointer arithmetic on pointer-to-array +// error +// backend=stage1 +// target=native // // tmp.zig:4:17: error: integer value 1 cannot be coerced to type '*[10]u8' diff --git a/test/compile_errors/stage1/obj/pointer_attributes_checked_when_coercing_pointer_to_anon_literal.zig b/test/compile_errors/stage1/obj/pointer_attributes_checked_when_coercing_pointer_to_anon_literal.zig index 079844ac7ffa06b5808391b6868475616b3dfeec..8456c8afcb245ed30253136af8c48fc1d22a8029 100644 --- a/test/compile_errors/stage1/obj/pointer_attributes_checked_when_coercing_pointer_to_anon_literal.zig +++ b/test/compile_errors/stage1/obj/pointer_attributes_checked_when_coercing_pointer_to_anon_literal.zig @@ -12,7 +12,9 @@ comptime { _ = c; } -// pointer attributes checked when coercing pointer to anon literal +// error +// backend=stage1 +// target=native // // tmp.zig:2:31: error: cannot cast pointer to array literal to slice type '[][]const u8' // tmp.zig:2:31: note: cast discards const qualifier diff --git a/test/compile_errors/stage1/obj/pointer_to_noreturn.zig b/test/compile_errors/stage1/obj/pointer_to_noreturn.zig index 3b945919fcfe85515e59fff0d820009f5f915eb0..5afcaacaad100e896435d3ae415b11a0b27de036 100644 --- a/test/compile_errors/stage1/obj/pointer_to_noreturn.zig +++ b/test/compile_errors/stage1/obj/pointer_to_noreturn.zig @@ -1,6 +1,8 @@ fn a() *noreturn {} export fn entry() void { _ = a(); } -// pointer to noreturn +// error +// backend=stage1 +// target=native // // tmp.zig:1:9: error: pointer to noreturn not allowed diff --git a/test/compile_errors/stage1/obj/popCount-non-integer.zig b/test/compile_errors/stage1/obj/popCount-non-integer.zig index 694b7949270db70a11f2c5586cb0a3dc72e50f08..a58a98faa336f69afd3229e41055310ef973df47 100644 --- a/test/compile_errors/stage1/obj/popCount-non-integer.zig +++ b/test/compile_errors/stage1/obj/popCount-non-integer.zig @@ -2,6 +2,8 @@ export fn entry(x: f32) u32 { return @popCount(f32, x); } -// @popCount - non-integer +// error +// backend=stage1 +// target=native // // tmp.zig:2:22: error: expected integer type, found 'f32' diff --git a/test/compile_errors/stage1/obj/prevent_bad_implicit_casting_of_anyframe_types.zig b/test/compile_errors/stage1/obj/prevent_bad_implicit_casting_of_anyframe_types.zig index 14bdb9cb1148a12a88bc8de7708ef01149f7a18c..2e21d45c124d65f15c316631a4c2202cb42d6c4b 100644 --- a/test/compile_errors/stage1/obj/prevent_bad_implicit_casting_of_anyframe_types.zig +++ b/test/compile_errors/stage1/obj/prevent_bad_implicit_casting_of_anyframe_types.zig @@ -15,7 +15,9 @@ export fn c() void { } fn func() void {} -// prevent bad implicit casting of anyframe types +// error +// backend=stage1 +// target=native // // tmp.zig:3:28: error: expected type 'anyframe->i32', found 'anyframe' // tmp.zig:8:28: error: expected type 'anyframe->i32', found 'i32' diff --git a/test/compile_errors/stage1/obj/primitives_take_precedence_over_declarations.zig b/test/compile_errors/stage1/obj/primitives_take_precedence_over_declarations.zig index 3517c07917e9ee012afaeb30e461aafcb8050b12..6f6107e88c9829ab12c192c029d9d6d6aed356f8 100644 --- a/test/compile_errors/stage1/obj/primitives_take_precedence_over_declarations.zig +++ b/test/compile_errors/stage1/obj/primitives_take_precedence_over_declarations.zig @@ -4,6 +4,8 @@ export fn entry() void { _ = a; } -// primitives take precedence over declarations +// error +// backend=stage1 +// target=native // // tmp.zig:3:19: error: integer value 300 cannot be coerced to type 'u8' diff --git a/test/compile_errors/stage1/obj/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig b/test/compile_errors/stage1/obj/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig index 63d0656f21a2a5dbe725cb507119dec68398b037..2fc30d4a325a242083d2dc90810f6a0b2fd6e847 100644 --- a/test/compile_errors/stage1/obj/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig +++ b/test/compile_errors/stage1/obj/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig @@ -4,7 +4,9 @@ export fn entry() bool { return p == null; } -// @ptrCast a 0 bit type to a non- 0 bit type +// error +// backend=stage1 +// target=native // // tmp.zig:3:15: error: '*u0' and '?*u0' do not have the same in-memory representation // tmp.zig:3:31: note: '*u0' has no in-memory bits diff --git a/test/compile_errors/stage1/obj/ptrCast_discards_const_qualifier.zig b/test/compile_errors/stage1/obj/ptrCast_discards_const_qualifier.zig index 1517fd4bd8d4a0b13baeeb1b185745a18a72b7af..1a90ff73f8836bd8ce77ab6cacd4a63c84a490c3 100644 --- a/test/compile_errors/stage1/obj/ptrCast_discards_const_qualifier.zig +++ b/test/compile_errors/stage1/obj/ptrCast_discards_const_qualifier.zig @@ -4,6 +4,8 @@ export fn entry() void { _ = y; } -// @ptrCast discards const qualifier +// error +// backend=stage1 +// target=native // // tmp.zig:3:15: error: cast discards const qualifier diff --git a/test/compile_errors/stage1/obj/ptrToInt_0_to_non_optional_pointer.zig b/test/compile_errors/stage1/obj/ptrToInt_0_to_non_optional_pointer.zig index fde1e53c1a4e982eeaaeda4030192f97d48e5515..b8a5d1b0aa48ce8e293fd60d4509875bc82ba817 100644 --- a/test/compile_errors/stage1/obj/ptrToInt_0_to_non_optional_pointer.zig +++ b/test/compile_errors/stage1/obj/ptrToInt_0_to_non_optional_pointer.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = b; } -// @ptrToInt 0 to non optional pointer +// error +// backend=stage1 +// target=native // // tmp.zig:2:13: error: pointer type '*i32' does not allow address zero diff --git a/test/compile_errors/stage1/obj/ptrToInt_on_void.zig b/test/compile_errors/stage1/obj/ptrToInt_on_void.zig index fd43053103e10b37ad2aff5bf0567b62f9427e07..5012be65e076eb0a161fe8e90515df84d17231ca 100644 --- a/test/compile_errors/stage1/obj/ptrToInt_on_void.zig +++ b/test/compile_errors/stage1/obj/ptrToInt_on_void.zig @@ -2,6 +2,8 @@ export fn entry() bool { return @ptrToInt(&{}) == @ptrToInt(&{}); } -// @ptrToInt on *void +// error +// backend=stage1 +// target=native // // tmp.zig:2:23: error: pointer to size 0 type has no address diff --git a/test/compile_errors/stage1/obj/ptrcast_to_non-pointer.zig b/test/compile_errors/stage1/obj/ptrcast_to_non-pointer.zig index 74894d5e8a47722bd3effc6029bf6763ad5a5d36..7e9e9a99b719b2ff978802aec36a08a2e30138bd 100644 --- a/test/compile_errors/stage1/obj/ptrcast_to_non-pointer.zig +++ b/test/compile_errors/stage1/obj/ptrcast_to_non-pointer.zig @@ -2,6 +2,8 @@ export fn entry(a: *i32) usize { return @ptrCast(usize, a); } -// ptrcast to non-pointer +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: expected pointer, found 'usize' diff --git a/test/compile_errors/stage1/obj/range_operator_in_switch_used_on_error_set.zig b/test/compile_errors/stage1/obj/range_operator_in_switch_used_on_error_set.zig index 4f2949c50c478446e9eba29a198ac727c2f71ef0..8108f429792605faa1b8aa85737004b6e71494bb 100644 --- a/test/compile_errors/stage1/obj/range_operator_in_switch_used_on_error_set.zig +++ b/test/compile_errors/stage1/obj/range_operator_in_switch_used_on_error_set.zig @@ -12,6 +12,8 @@ fn foo(x: i32) !void { } } -// range operator in switch used on error set +// error +// backend=stage1 +// target=native // // tmp.zig:3:17: error: operator not allowed for errors diff --git a/test/compile_errors/stage1/obj/reading_past_end_of_pointer_casted_array.zig b/test/compile_errors/stage1/obj/reading_past_end_of_pointer_casted_array.zig index 558797d69bbcf598427a9f174c8e9100da14f947..cece3345c3f17abc3525eeed0733d57d1006ea21 100644 --- a/test/compile_errors/stage1/obj/reading_past_end_of_pointer_casted_array.zig +++ b/test/compile_errors/stage1/obj/reading_past_end_of_pointer_casted_array.zig @@ -6,6 +6,8 @@ comptime { _ = deref; } -// reading past end of pointer casted array +// error +// backend=stage1 +// target=native // // tmp.zig:5:26: error: attempt to read 4 bytes from [4]u8 at index 1 which is 3 bytes diff --git a/test/compile_errors/stage1/obj/recursive_inferred_error_set.zig b/test/compile_errors/stage1/obj/recursive_inferred_error_set.zig index 80598339233e5e8bc4200aa826b03962939a6f15..89a2a54cfae3a8b2f56aaefca83ccfefbe21c570 100644 --- a/test/compile_errors/stage1/obj/recursive_inferred_error_set.zig +++ b/test/compile_errors/stage1/obj/recursive_inferred_error_set.zig @@ -5,6 +5,8 @@ fn foo() !void { try foo(); } -// recursive inferred error set +// error +// backend=stage1 +// target=native // // 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 diff --git a/test/compile_errors/stage1/obj/redefinition_of_enums.zig b/test/compile_errors/stage1/obj/redefinition_of_enums.zig index b4033536c3d7ab3a408c863924f90011647dd72c..a95eb88935a25fc36e4939019c826e96622dbdb3 100644 --- a/test/compile_errors/stage1/obj/redefinition_of_enums.zig +++ b/test/compile_errors/stage1/obj/redefinition_of_enums.zig @@ -1,7 +1,9 @@ const A = enum {x}; const A = enum {x}; -// redefinition of enums +// error +// backend=stage1 +// target=native // // tmp.zig:2:1: error: redeclaration of 'A' // tmp.zig:1:1: note: other declaration here diff --git a/test/compile_errors/stage1/obj/redefinition_of_global_variables.zig b/test/compile_errors/stage1/obj/redefinition_of_global_variables.zig index b2267423b0819193b22e9a594bcf327cdd2a5686..3651946ffefa9fb3c97a39763158b3d11a9f6e6a 100644 --- a/test/compile_errors/stage1/obj/redefinition_of_global_variables.zig +++ b/test/compile_errors/stage1/obj/redefinition_of_global_variables.zig @@ -1,7 +1,9 @@ var a : i32 = 1; var a : i32 = 2; -// redefinition of global variables +// error +// backend=stage1 +// target=native // // tmp.zig:2:1: error: redeclaration of 'a' // tmp.zig:1:1: note: other declaration here diff --git a/test/compile_errors/stage1/obj/redefinition_of_struct.zig b/test/compile_errors/stage1/obj/redefinition_of_struct.zig index 8c169356c90c43d779fb1b402eae4a7f50ff969b..8367a05e43729ca57acd871dd2451a7a91eb5f3a 100644 --- a/test/compile_errors/stage1/obj/redefinition_of_struct.zig +++ b/test/compile_errors/stage1/obj/redefinition_of_struct.zig @@ -1,7 +1,9 @@ const A = struct { x : i32, }; const A = struct { y : i32, }; -// redefinition of struct +// error +// backend=stage1 +// target=native // // tmp.zig:2:1: error: redeclaration of 'A' // tmp.zig:1:1: note: other declaration here diff --git a/test/compile_errors/stage1/obj/refer_to_the_type_of_a_generic_function.zig b/test/compile_errors/stage1/obj/refer_to_the_type_of_a_generic_function.zig index 6e23854cd6ff1627b606b033083a7e001a8d35ad..99ab1da8a3c5c8969af94af66b36f82606f5974e 100644 --- a/test/compile_errors/stage1/obj/refer_to_the_type_of_a_generic_function.zig +++ b/test/compile_errors/stage1/obj/refer_to_the_type_of_a_generic_function.zig @@ -4,6 +4,8 @@ export fn entry() void { f(i32); } -// refer to the type of a generic function +// error +// backend=stage1 +// target=native // // tmp.zig:4:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/referring_to_a_struct_that_is_invalid.zig b/test/compile_errors/stage1/obj/referring_to_a_struct_that_is_invalid.zig index 5f646461d8cc241f05acb26116495e6ee371cfc5..433650cddbb2913b6548105972d3526238eea913 100644 --- a/test/compile_errors/stage1/obj/referring_to_a_struct_that_is_invalid.zig +++ b/test/compile_errors/stage1/obj/referring_to_a_struct_that_is_invalid.zig @@ -10,6 +10,8 @@ fn assert(ok: bool) void { if (!ok) unreachable; } -// referring to a struct that is invalid +// error +// backend=stage1 +// target=native // // tmp.zig:10:14: error: reached unreachable code diff --git a/test/compile_errors/stage1/obj/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig b/test/compile_errors/stage1/obj/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig index a714b10ef63e31aec73a9582b39fede30d6118ba..8be44fbe054f85087c7731c351b1817ff7392ab0 100644 --- a/test/compile_errors/stage1/obj/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig +++ b/test/compile_errors/stage1/obj/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig @@ -14,6 +14,8 @@ export fn entry() void { _ = afoo; } -// regression test #2980: base type u32 is not type checked properly when assigning a value within a struct +// error +// backend=stage1 +// target=native // // 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' diff --git a/test/compile_errors/stage1/obj/reify_type.Fn_with_is_generic_true.zig b/test/compile_errors/stage1/obj/reify_type.Fn_with_is_generic_true.zig index ed331586491ec1de17066455aeba8ee6aa858151..f2849b5eb486fc09843e554ceaf891dbd47e4f04 100644 --- a/test/compile_errors/stage1/obj/reify_type.Fn_with_is_generic_true.zig +++ b/test/compile_errors/stage1/obj/reify_type.Fn_with_is_generic_true.zig @@ -10,6 +10,8 @@ const Foo = @Type(.{ }); comptime { _ = Foo; } -// @Type(.Fn) with is_generic = true +// error +// backend=stage1 +// target=native // // tmp.zig:1:20: error: Type.Fn.is_generic must be false for @Type diff --git a/test/compile_errors/stage1/obj/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig b/test/compile_errors/stage1/obj/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig index a57484075ffb623d5cd614b40ba004603d932c3a..4d449e9eb9e78b92c65f361b19640c805d3dbdc0 100644 --- a/test/compile_errors/stage1/obj/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig +++ b/test/compile_errors/stage1/obj/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig @@ -10,6 +10,8 @@ const Foo = @Type(.{ }); comptime { _ = Foo; } -// @Type(.Fn) with is_var_args = true and non-C callconv +// error +// backend=stage1 +// target=native // // tmp.zig:1:20: error: varargs functions must have C calling convention diff --git a/test/compile_errors/stage1/obj/reify_type.Fn_with_return_type_null.zig b/test/compile_errors/stage1/obj/reify_type.Fn_with_return_type_null.zig index f8ddea52cf27242aa7db5e7c28b7849e0ae29d9e..98cbc37d41d44d86bd7e571fb7cab8fee07cbca2 100644 --- a/test/compile_errors/stage1/obj/reify_type.Fn_with_return_type_null.zig +++ b/test/compile_errors/stage1/obj/reify_type.Fn_with_return_type_null.zig @@ -10,6 +10,8 @@ const Foo = @Type(.{ }); comptime { _ = Foo; } -// @Type(.Fn) with return_type = null +// error +// backend=stage1 +// target=native // // tmp.zig:1:20: error: Type.Fn.return_type must be non-null for @Type diff --git a/test/compile_errors/stage1/obj/reify_type.Pointer_with_invalid_address_space.zig b/test/compile_errors/stage1/obj/reify_type.Pointer_with_invalid_address_space.zig index 78160fae58499725d53c6adc321cc1bda23e0e05..1ca97ce2505eba7d621ace7737485dc70434c79e 100644 --- a/test/compile_errors/stage1/obj/reify_type.Pointer_with_invalid_address_space.zig +++ b/test/compile_errors/stage1/obj/reify_type.Pointer_with_invalid_address_space.zig @@ -11,6 +11,8 @@ export fn entry() void { }}); } -// @Type(.Pointer) with invalid address space +// error +// backend=stage1 +// target=native // // tmp.zig:2:16: error: address space 'gs' not available in stage 1 compiler, must be .generic diff --git a/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig b/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig index e77c2eb6270bac6230a324a83b2b96ff14a99c4b..56d05578be1173d6504127707635c88fc9be0982 100644 --- a/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig +++ b/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig @@ -11,6 +11,8 @@ export fn entry() void { _ = @intToEnum(Tag, 0); } -// @Type for exhaustive enum with non-integer tag type +// error +// backend=stage1 +// target=native // // tmp.zig:1:20: error: Type.Enum.tag_type must be an integer type, not 'bool' diff --git a/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig b/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig index 6a005163876f7b78e03b0725ee7dd6dff05cdfb4..e6454d2ee5a8e71acca500edc3af9278d18db9f6 100644 --- a/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig +++ b/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig @@ -11,6 +11,8 @@ export fn entry() void { _ = @intToEnum(Tag, 0); } -// @Type for exhaustive enum with undefined tag type +// error +// backend=stage1 +// target=native // // tmp.zig:1:20: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_zero_fields.zig b/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_zero_fields.zig index 87689247aa7dbfd7389ea01736e9d839fc78ec58..d3ce70c1b0ab286279f79727d6db6cf41a2e929f 100644 --- a/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_zero_fields.zig +++ b/test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_zero_fields.zig @@ -11,6 +11,8 @@ export fn entry() void { _ = @intToEnum(Tag, 0); } -// @Type for exhaustive enum with zero fields +// error +// backend=stage1 +// target=native // // tmp.zig:1:20: error: enums must have 1 or more fields diff --git a/test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_enum_field.zig b/test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_enum_field.zig index f9155d7161ec200c3ea1fdc30f29fce3fffdd4dc..0c56cb91ea3f20c2a2febf2e06583a097b2456ae 100644 --- a/test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_enum_field.zig +++ b/test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_enum_field.zig @@ -27,6 +27,8 @@ export fn entry() void { tagged = .{ .unsigned = 1 }; } -// @Type for tagged union with extra enum field +// error +// backend=stage1 +// target=native // // tmp.zig:14:23: error: enum field missing: 'arst' diff --git a/test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_union_field.zig b/test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_union_field.zig index 9cd82213df9a91b8f4546cb98fcf39332c29189e..63cf1f178e26db73e4563c161b8ecfdd7655f164 100644 --- a/test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_union_field.zig +++ b/test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_union_field.zig @@ -27,7 +27,9 @@ export fn entry() void { tagged = .{ .unsigned = 1 }; } -// @Type for tagged union with extra union field +// error +// backend=stage1 +// target=native // // tmp.zig:13:23: error: enum field not found: 'arst' // tmp.zig:1:20: note: enum declared here diff --git a/test/compile_errors/stage1/obj/reify_type_for_union_with_opaque_field.zig b/test/compile_errors/stage1/obj/reify_type_for_union_with_opaque_field.zig index 374ccb544b5c1ea19491e8b6920d3b8f4e8c7d06..d3f4f6da4b80e3b69643f5b215ab8f8c224904b0 100644 --- a/test/compile_errors/stage1/obj/reify_type_for_union_with_opaque_field.zig +++ b/test/compile_errors/stage1/obj/reify_type_for_union_with_opaque_field.zig @@ -12,6 +12,8 @@ export fn entry() void { _ = Untagged{}; } -// @Type for union with opaque field +// error +// backend=stage1 +// target=native // // tmp.zig:1:25: error: opaque types have unknown size and therefore cannot be directly embedded in unions diff --git a/test/compile_errors/stage1/obj/reify_type_for_union_with_zero_fields.zig b/test/compile_errors/stage1/obj/reify_type_for_union_with_zero_fields.zig index 8243ff3292652caa96028879cec90fa7f1fec4b2..578f902697597d364a9fdd242afd66890d004ec5 100644 --- a/test/compile_errors/stage1/obj/reify_type_for_union_with_zero_fields.zig +++ b/test/compile_errors/stage1/obj/reify_type_for_union_with_zero_fields.zig @@ -10,6 +10,8 @@ export fn entry() void { _ = Untagged{}; } -// @Type for union with zero fields +// error +// backend=stage1 +// target=native // // tmp.zig:1:25: error: unions must have 1 or more fields diff --git a/test/compile_errors/stage1/obj/reify_type_union_payload_is_undefined.zig b/test/compile_errors/stage1/obj/reify_type_union_payload_is_undefined.zig index 43261dc32fc4c477ba3a57d61595aa2bc2d266b4..47be31c71142271c9022c53aeab4a3e1c8e523b8 100644 --- a/test/compile_errors/stage1/obj/reify_type_union_payload_is_undefined.zig +++ b/test/compile_errors/stage1/obj/reify_type_union_payload_is_undefined.zig @@ -3,6 +3,8 @@ const Foo = @Type(.{ }); comptime { _ = Foo; } -// @Type() union payload is undefined +// error +// backend=stage1 +// target=native // // tmp.zig:1:20: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/reify_type_with_Type.Int.zig b/test/compile_errors/stage1/obj/reify_type_with_Type.Int.zig index cea09d3f190d6efa3e839b838d3bd8269805ee1b..116bd86e0f229e17e8bf4a8a68c66dbeec1b81ba 100644 --- a/test/compile_errors/stage1/obj/reify_type_with_Type.Int.zig +++ b/test/compile_errors/stage1/obj/reify_type_with_Type.Int.zig @@ -6,6 +6,8 @@ export fn entry() void { }); } -// @Type with Type.Int +// error +// backend=stage1 +// target=native // // tmp.zig:3:31: error: expected type 'std.builtin.Type', found 'std.builtin.Type.Int' diff --git a/test/compile_errors/stage1/obj/reify_type_with_non-constant_expression.zig b/test/compile_errors/stage1/obj/reify_type_with_non-constant_expression.zig index a58b2a6b334bf5c5672f98d454f43dacb339d4ea..7eec6b395a81a8972f70c6d6295821bc72d510f4 100644 --- a/test/compile_errors/stage1/obj/reify_type_with_non-constant_expression.zig +++ b/test/compile_errors/stage1/obj/reify_type_with_non-constant_expression.zig @@ -4,6 +4,8 @@ export fn entry() void { _ = @Type(globalTypeInfo); } -// @Type with non-constant expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:15: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/reify_type_with_undefined.zig b/test/compile_errors/stage1/obj/reify_type_with_undefined.zig index 984c9ac555192fac13beff06b6e913e0904cf111..1de93ccdf62d041945319c5a8626af4eea39c2f2 100644 --- a/test/compile_errors/stage1/obj/reify_type_with_undefined.zig +++ b/test/compile_errors/stage1/obj/reify_type_with_undefined.zig @@ -12,7 +12,9 @@ comptime { }); } -// @Type with undefined +// error +// backend=stage1 +// target=native // // tmp.zig:2:16: error: use of undefined value here causes undefined behavior // tmp.zig:5:16: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr.zig b/test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr.zig index a45fd9f41af0c22ce40f77740bf518d8f1cee4f4..18dd6382fcb6f871f637f3ce749a3d1853531882 100644 --- a/test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr.zig +++ b/test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr.zig @@ -11,6 +11,8 @@ pub const Container = struct { not_optional: i32, }; -// result location incompatibility mismatching handle_is_ptr +// error +// backend=stage1 +// target=native // // tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32' diff --git a/test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr_generic_call.zig b/test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr_generic_call.zig index 8b913bd15cb94fd2071adfa93a06e6dcd1d7c84b..75811c58e1e7d118392426a29410b4fe6f770b9b 100644 --- a/test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr_generic_call.zig +++ b/test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr_generic_call.zig @@ -11,6 +11,8 @@ pub const Container = struct { not_optional: i32, }; -// result location incompatibility mismatching handle_is_ptr (generic call) +// error +// backend=stage1 +// target=native // // tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32' diff --git a/test/compile_errors/stage1/obj/return_from_defer_expression.zig b/test/compile_errors/stage1/obj/return_from_defer_expression.zig index 0f4ac8e0716d64c656c4fc288afe1281de4b4d4e..cbe9542176d01eff318e8eda739dc9e7424e8c11 100644 --- a/test/compile_errors/stage1/obj/return_from_defer_expression.zig +++ b/test/compile_errors/stage1/obj/return_from_defer_expression.zig @@ -14,6 +14,8 @@ pub fn maybeInt() ?i32 { export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); } -// return from defer expression +// error +// backend=stage1 +// target=native // // tmp.zig:4:11: error: 'try' not allowed inside defer expression diff --git a/test/compile_errors/stage1/obj/returning_error_from_void_async_function.zig b/test/compile_errors/stage1/obj/returning_error_from_void_async_function.zig index a00422dd126c73b3eaf47d9f594a0490e23b9211..691c89a3478e21324685d27680ec26c13b0fc5f2 100644 --- a/test/compile_errors/stage1/obj/returning_error_from_void_async_function.zig +++ b/test/compile_errors/stage1/obj/returning_error_from_void_async_function.zig @@ -5,6 +5,8 @@ fn amain() callconv(.Async) void { return error.ShouldBeCompileError; } -// returning error from void async function +// error +// backend=stage1 +// target=native // // tmp.zig:5:17: error: expected type 'void', found 'error{ShouldBeCompileError}' diff --git a/test/compile_errors/stage1/obj/runtime-known_async_function_called.zig b/test/compile_errors/stage1/obj/runtime-known_async_function_called.zig index 52afd83a11ebf15f9bc272a140d8cdb5688b6fa9..90685ce566297391b6924ec1a56cddc2db28aa9a 100644 --- a/test/compile_errors/stage1/obj/runtime-known_async_function_called.zig +++ b/test/compile_errors/stage1/obj/runtime-known_async_function_called.zig @@ -7,6 +7,8 @@ fn amain() void { } fn afunc() callconv(.Async) void {} -// runtime-known async function called +// error +// backend=stage1 +// target=native // // tmp.zig:6:12: error: function is not comptime-known; @asyncCall required diff --git a/test/compile_errors/stage1/obj/runtime-known_function_called_with_async_keyword.zig b/test/compile_errors/stage1/obj/runtime-known_function_called_with_async_keyword.zig index 79f0420a830739cc9c64c9713201110712c889f3..c66d0f9cbb557517b1e02bfd271871d2b229243e 100644 --- a/test/compile_errors/stage1/obj/runtime-known_function_called_with_async_keyword.zig +++ b/test/compile_errors/stage1/obj/runtime-known_function_called_with_async_keyword.zig @@ -5,6 +5,8 @@ export fn entry() void { fn afunc() callconv(.Async) void { } -// runtime-known function called with async keyword +// error +// backend=stage1 +// target=native // // tmp.zig:3:15: error: function is not comptime-known; @asyncCall required diff --git a/test/compile_errors/stage1/obj/runtime_assignment_to_comptime_struct_type.zig b/test/compile_errors/stage1/obj/runtime_assignment_to_comptime_struct_type.zig index f8a3fd3ba106c40432e77eef16dbd5515bf76fa8..62b09673eb9479c3fe9fe75f50543a25a3bdd220 100644 --- a/test/compile_errors/stage1/obj/runtime_assignment_to_comptime_struct_type.zig +++ b/test/compile_errors/stage1/obj/runtime_assignment_to_comptime_struct_type.zig @@ -8,6 +8,8 @@ export fn f() void { _ = foo; } -// runtime assignment to comptime struct type +// error +// backend=stage1 +// target=native // // tmp.zig:7:23: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/runtime_assignment_to_comptime_union_type.zig b/test/compile_errors/stage1/obj/runtime_assignment_to_comptime_union_type.zig index bc4f093b0de8f94f333653ab6864d2048d453e90..af13f8b8ce9068c97a8015a39fca9be4cf6b8569 100644 --- a/test/compile_errors/stage1/obj/runtime_assignment_to_comptime_union_type.zig +++ b/test/compile_errors/stage1/obj/runtime_assignment_to_comptime_union_type.zig @@ -8,6 +8,8 @@ export fn f() void { _ = foo; } -// runtime assignment to comptime union type +// error +// backend=stage1 +// target=native // // tmp.zig:7:23: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/obj/runtime_cast_to_union_which_has_non-void_fields.zig b/test/compile_errors/stage1/obj/runtime_cast_to_union_which_has_non-void_fields.zig index 8be361f2fe6fbe16d94e1f10b9a0a8393fe0578d..d25c815c7e01d6df0b4bda73c3727b2f06ef6e8b 100644 --- a/test/compile_errors/stage1/obj/runtime_cast_to_union_which_has_non-void_fields.zig +++ b/test/compile_errors/stage1/obj/runtime_cast_to_union_which_has_non-void_fields.zig @@ -12,7 +12,9 @@ fn foo(l: Letter) void { _ = x; } -// runtime cast to union which has non-void fields +// error +// backend=stage1 +// target=native // // tmp.zig:11:20: error: runtime cast to union 'Value' which has non-void fields // tmp.zig:3:5: note: field 'A' has type 'i32' diff --git a/test/compile_errors/stage1/obj/runtime_index_into_comptime_type_slice.zig b/test/compile_errors/stage1/obj/runtime_index_into_comptime_type_slice.zig index 4b9538c1a1b4625ec12a43473e497fb3790a4f0c..379767c7f36801b29114092c460883cdf21e45c1 100644 --- a/test/compile_errors/stage1/obj/runtime_index_into_comptime_type_slice.zig +++ b/test/compile_errors/stage1/obj/runtime_index_into_comptime_type_slice.zig @@ -10,6 +10,8 @@ export fn entry() void { _ = field; } -// runtime index into comptime type slice +// error +// backend=stage1 +// target=native // // tmp.zig:9:51: error: values of type 'std.builtin.Type.StructField' must be comptime known, but index value is runtime known diff --git a/test/compile_errors/stage1/obj/saturating_arithmetic_does_not_allow_floats.zig b/test/compile_errors/stage1/obj/saturating_arithmetic_does_not_allow_floats.zig index 57ee724e743138e8d037682d7b81d6a186fb7b6f..7bda134af6106e249610d83810afd6a74f26eff6 100644 --- a/test/compile_errors/stage1/obj/saturating_arithmetic_does_not_allow_floats.zig +++ b/test/compile_errors/stage1/obj/saturating_arithmetic_does_not_allow_floats.zig @@ -2,6 +2,8 @@ export fn a() void { _ = @as(f32, 1.0) +| @as(f32, 1.0); } -// saturating arithmetic does not allow floats +// error +// backend=stage1 +// target=native // // error: invalid operands to binary expression: 'f32' and 'f32' diff --git a/test/compile_errors/stage1/obj/saturating_shl_assign_does_not_allow_negative_rhs_at_comptime.zig b/test/compile_errors/stage1/obj/saturating_shl_assign_does_not_allow_negative_rhs_at_comptime.zig index 9a46367ae56888d273d79fa811193393f5e3af37..7b94f8e832b9f9f53eaac1e2964c5c523a4bf003 100644 --- a/test/compile_errors/stage1/obj/saturating_shl_assign_does_not_allow_negative_rhs_at_comptime.zig +++ b/test/compile_errors/stage1/obj/saturating_shl_assign_does_not_allow_negative_rhs_at_comptime.zig @@ -5,6 +5,8 @@ export fn a() void { } } -// saturating shl assign does not allow negative rhs at comptime +// error +// backend=stage1 +// target=native // // error: shift by negative value -2 diff --git a/test/compile_errors/stage1/obj/saturating_shl_does_not_allow_negative_rhs_at_comptime.zig b/test/compile_errors/stage1/obj/saturating_shl_does_not_allow_negative_rhs_at_comptime.zig index ffe715a8e3eb09cc03323b7e899fca6e498f3582..ac1ce7d3a0e14088a7a15a674a755ef1a15145e6 100644 --- a/test/compile_errors/stage1/obj/saturating_shl_does_not_allow_negative_rhs_at_comptime.zig +++ b/test/compile_errors/stage1/obj/saturating_shl_does_not_allow_negative_rhs_at_comptime.zig @@ -2,6 +2,8 @@ export fn a() void { _ = @as(i32, 1) <<| @as(i32, -2); } -// saturating shl does not allow negative rhs at comptime +// error +// backend=stage1 +// target=native // // error: shift by negative value -2 diff --git a/test/compile_errors/stage1/obj/setAlignStack_in_inline_function.zig b/test/compile_errors/stage1/obj/setAlignStack_in_inline_function.zig index 9261ecdb186b2037947e5d79aeb15c3877d7f0d7..8490298aa37c081db7e9a2fd58cb00e8ce877471 100644 --- a/test/compile_errors/stage1/obj/setAlignStack_in_inline_function.zig +++ b/test/compile_errors/stage1/obj/setAlignStack_in_inline_function.zig @@ -5,6 +5,8 @@ fn foo() callconv(.Inline) void { @setAlignStack(16); } -// @setAlignStack in inline function +// error +// backend=stage1 +// target=native // // tmp.zig:5:5: error: @setAlignStack in inline function diff --git a/test/compile_errors/stage1/obj/setAlignStack_in_naked_function.zig b/test/compile_errors/stage1/obj/setAlignStack_in_naked_function.zig index d7146625c5a35c8a2d2d5c523d073486eebe8b37..b9adc84ed540f1a0c4a1c10bc9b34c3017fc5ae5 100644 --- a/test/compile_errors/stage1/obj/setAlignStack_in_naked_function.zig +++ b/test/compile_errors/stage1/obj/setAlignStack_in_naked_function.zig @@ -2,6 +2,8 @@ export fn entry() callconv(.Naked) void { @setAlignStack(16); } -// @setAlignStack in naked function +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: @setAlignStack in naked function diff --git a/test/compile_errors/stage1/obj/setAlignStack_outside_function.zig b/test/compile_errors/stage1/obj/setAlignStack_outside_function.zig index c9ac12e6e05ca40c2311dd6850c19ebfae668f52..754756012b4fd77e4dadfeca2175ac923712739a 100644 --- a/test/compile_errors/stage1/obj/setAlignStack_outside_function.zig +++ b/test/compile_errors/stage1/obj/setAlignStack_outside_function.zig @@ -2,6 +2,8 @@ comptime { @setAlignStack(16); } -// @setAlignStack outside function +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: @setAlignStack outside function diff --git a/test/compile_errors/stage1/obj/setAlignStack_set_twice.zig b/test/compile_errors/stage1/obj/setAlignStack_set_twice.zig index de8cde7c011b6963d246431b93b6a557353a4fb0..244db9d96208061e2cd1540cab696bf5634b3945 100644 --- a/test/compile_errors/stage1/obj/setAlignStack_set_twice.zig +++ b/test/compile_errors/stage1/obj/setAlignStack_set_twice.zig @@ -3,7 +3,9 @@ export fn entry() void { @setAlignStack(16); } -// @setAlignStack set twice +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: alignstack set twice // tmp.zig:2:5: note: first set here diff --git a/test/compile_errors/stage1/obj/setAlignStack_too_big.zig b/test/compile_errors/stage1/obj/setAlignStack_too_big.zig index 669ec452042c2c7bab9f90848fa96ab9787d456e..601631e15840ec7c1360190b0dcbab78734ae679 100644 --- a/test/compile_errors/stage1/obj/setAlignStack_too_big.zig +++ b/test/compile_errors/stage1/obj/setAlignStack_too_big.zig @@ -2,6 +2,8 @@ export fn entry() void { @setAlignStack(511 + 1); } -// @setAlignStack too big +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: attempt to @setAlignStack(512); maximum is 256 diff --git a/test/compile_errors/stage1/obj/setFloatMode_twice_for_same_scope.zig b/test/compile_errors/stage1/obj/setFloatMode_twice_for_same_scope.zig index 3e556040307c21ca19cb3918c85c690b699b94f7..41fe6d4d6c4e9d78c5fea3055843a76355d6b061 100644 --- a/test/compile_errors/stage1/obj/setFloatMode_twice_for_same_scope.zig +++ b/test/compile_errors/stage1/obj/setFloatMode_twice_for_same_scope.zig @@ -3,7 +3,9 @@ export fn foo() void { @setFloatMode(@import("std").builtin.FloatMode.Optimized); } -// @setFloatMode twice for same scope +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: float mode set twice for same scope // tmp.zig:2:5: note: first set here diff --git a/test/compile_errors/stage1/obj/setRuntimeSafety_twice_for_same_scope.zig b/test/compile_errors/stage1/obj/setRuntimeSafety_twice_for_same_scope.zig index 741a214cde0fa4e6b07834135fac650e3a48946d..03a93b68d55ffb08d1c185a5d5cbf33e5ecbdd50 100644 --- a/test/compile_errors/stage1/obj/setRuntimeSafety_twice_for_same_scope.zig +++ b/test/compile_errors/stage1/obj/setRuntimeSafety_twice_for_same_scope.zig @@ -3,7 +3,9 @@ export fn foo() void { @setRuntimeSafety(false); } -// @setRuntimeSafety twice for same scope +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: runtime safety set twice for same scope // tmp.zig:2:5: note: first set here diff --git a/test/compile_errors/stage1/obj/setting_a_section_on_a_local_variable.zig b/test/compile_errors/stage1/obj/setting_a_section_on_a_local_variable.zig index eb3df0e214b4278c20d2b349cc9d8a9e6deafae2..90d605dc40215c54d6ac969cc96c1a55c549a2c2 100644 --- a/test/compile_errors/stage1/obj/setting_a_section_on_a_local_variable.zig +++ b/test/compile_errors/stage1/obj/setting_a_section_on_a_local_variable.zig @@ -3,6 +3,8 @@ export fn entry() i32 { return foo; } -// setting a section on a local variable +// error +// backend=stage1 +// target=native // // tmp.zig:2:30: error: cannot set section of local variable 'foo' diff --git a/test/compile_errors/stage1/obj/shift_amount_has_to_be_an_integer_type.zig b/test/compile_errors/stage1/obj/shift_amount_has_to_be_an_integer_type.zig index 6e54405619c886339882aa42dc21052bff8e7946..53794dba1b80a07067305abb27fe5224d30a2710 100644 --- a/test/compile_errors/stage1/obj/shift_amount_has_to_be_an_integer_type.zig +++ b/test/compile_errors/stage1/obj/shift_amount_has_to_be_an_integer_type.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// shift amount has to be an integer type +// error +// backend=stage1 +// target=native // // tmp.zig:2:21: error: shift amount has to be an integer type, but found '*const u8' diff --git a/test/compile_errors/stage1/obj/shift_by_negative_comptime_integer.zig b/test/compile_errors/stage1/obj/shift_by_negative_comptime_integer.zig index 41f0ff80aa859ba3563ffd022fd95127d9abea0c..3425cf565ebe8e92485bef9f93d44dbd56d3110a 100644 --- a/test/compile_errors/stage1/obj/shift_by_negative_comptime_integer.zig +++ b/test/compile_errors/stage1/obj/shift_by_negative_comptime_integer.zig @@ -3,6 +3,8 @@ comptime { _ = a; } -// shift by negative comptime integer +// error +// backend=stage1 +// target=native // // tmp.zig:2:18: error: shift by negative value -1 diff --git a/test/compile_errors/stage1/obj/shift_left_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/shift_left_assign_on_undefined_value.zig index a23d0e190c3d6ec612ec4f3a58dc689aeb7963ca..575bf0ee6b60cd3bc30b6b520773dfaee5fe3b56 100644 --- a/test/compile_errors/stage1/obj/shift_left_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/shift_left_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a >>= 2; } -// shift left assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/shift_left_on_undefined_value.zig b/test/compile_errors/stage1/obj/shift_left_on_undefined_value.zig index aa0891133bcd27b0d3d8cac6995b627272f1d712..abd06fbbabebfe422aee08e3ab758b13c028f7da 100644 --- a/test/compile_errors/stage1/obj/shift_left_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/shift_left_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a << 2; } -// shift left on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/shift_right_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/shift_right_assign_on_undefined_value.zig index 65f4fe50b89b878b10f504e19316d9b6370069ee..575bf0ee6b60cd3bc30b6b520773dfaee5fe3b56 100644 --- a/test/compile_errors/stage1/obj/shift_right_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/shift_right_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a >>= 2; } -// shift right assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/shift_right_on_undefined_value.zig b/test/compile_errors/stage1/obj/shift_right_on_undefined_value.zig index ccd2563c8422b56d3aacbddcec1e8a951c1d1b15..e24cbe473a09a23618353883e9458d632939918d 100644 --- a/test/compile_errors/stage1/obj/shift_right_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/shift_right_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a >> 2; } -// shift right on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/shifting_RHS_is_log2_of_LHS_int_bit_width.zig b/test/compile_errors/stage1/obj/shifting_RHS_is_log2_of_LHS_int_bit_width.zig index 8a5d6cfee48c58bd7ce7d41338b6d55b92ba0992..d9b9bbfce36755bf318250d73451fc61c6012983 100644 --- a/test/compile_errors/stage1/obj/shifting_RHS_is_log2_of_LHS_int_bit_width.zig +++ b/test/compile_errors/stage1/obj/shifting_RHS_is_log2_of_LHS_int_bit_width.zig @@ -2,6 +2,8 @@ export fn entry(x: u8, y: u8) u8 { return x << y; } -// shifting RHS is log2 of LHS int bit width +// error +// backend=stage1 +// target=native // // tmp.zig:2:17: error: expected type 'u3', found 'u8' diff --git a/test/compile_errors/stage1/obj/shifting_without_int_type_or_comptime_known.zig b/test/compile_errors/stage1/obj/shifting_without_int_type_or_comptime_known.zig index 380a08a95ce6f3fa914b346d9e34209cc91b5a1a..4d875575d016505922129b062d5c922be6786395 100644 --- a/test/compile_errors/stage1/obj/shifting_without_int_type_or_comptime_known.zig +++ b/test/compile_errors/stage1/obj/shifting_without_int_type_or_comptime_known.zig @@ -2,6 +2,8 @@ export fn entry(x: u8) u8 { return 0x11 << x; } -// shifting without int type or comptime known +// error +// backend=stage1 +// target=native // // tmp.zig:2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be compile-time known diff --git a/test/compile_errors/stage1/obj/shlExact_shifts_out_1_bits.zig b/test/compile_errors/stage1/obj/shlExact_shifts_out_1_bits.zig index bd6e48f25ca43be21f55f24c2cbef8576a8b5c48..953c5fec50199c59dd2669b4e8601d026f4d70f8 100644 --- a/test/compile_errors/stage1/obj/shlExact_shifts_out_1_bits.zig +++ b/test/compile_errors/stage1/obj/shlExact_shifts_out_1_bits.zig @@ -3,6 +3,8 @@ comptime { _ = x; } -// @shlExact shifts out 1 bits +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: operation caused overflow diff --git a/test/compile_errors/stage1/obj/shrExact_shifts_out_1_bits.zig b/test/compile_errors/stage1/obj/shrExact_shifts_out_1_bits.zig index 004bf0c1c32a38a1869f6a38f757d9acf02cad51..223db7663042f98a32ff416c5e513d806e6e155a 100644 --- a/test/compile_errors/stage1/obj/shrExact_shifts_out_1_bits.zig +++ b/test/compile_errors/stage1/obj/shrExact_shifts_out_1_bits.zig @@ -3,6 +3,8 @@ comptime { _ = x; } -// @shrExact shifts out 1 bits +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: exact shift shifted out 1 bits diff --git a/test/compile_errors/stage1/obj/signed_integer_division.zig b/test/compile_errors/stage1/obj/signed_integer_division.zig index 524f9fe1db2c10e2aa4fa2f7e1eddbb22a68d0f0..3eebbf2248dbb2acd204d755c00346e2abbbdf6a 100644 --- a/test/compile_errors/stage1/obj/signed_integer_division.zig +++ b/test/compile_errors/stage1/obj/signed_integer_division.zig @@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 { return a / b; } -// signed integer division +// error +// backend=stage1 +// target=native // // tmp.zig:2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact diff --git a/test/compile_errors/stage1/obj/signed_integer_remainder_division.zig b/test/compile_errors/stage1/obj/signed_integer_remainder_division.zig index e060b780d0affe5c6d5c7b8f2114220edd71baeb..58776729543830b4850da0851947441810a0a33f 100644 --- a/test/compile_errors/stage1/obj/signed_integer_remainder_division.zig +++ b/test/compile_errors/stage1/obj/signed_integer_remainder_division.zig @@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 { return a % b; } -// signed integer remainder division +// error +// backend=stage1 +// target=native // // tmp.zig:2:14: error: remainder division with 'i32' and 'i32': signed integers and floats must use @rem or @mod diff --git a/test/compile_errors/stage1/obj/sizeOf_bad_type.zig b/test/compile_errors/stage1/obj/sizeOf_bad_type.zig index 1b336cf65786987dd0948a162b7100e9fdec9d44..f8c397f768620b7a0fb480a2c68c78c3dcf72f75 100644 --- a/test/compile_errors/stage1/obj/sizeOf_bad_type.zig +++ b/test/compile_errors/stage1/obj/sizeOf_bad_type.zig @@ -2,6 +2,8 @@ export fn entry() usize { return @sizeOf(@TypeOf(null)); } -// @sizeOf bad type +// error +// backend=stage1 +// target=native // // tmp.zig:2:20: error: no size available for type '@Type(.Null)' diff --git a/test/compile_errors/stage1/obj/slice_cannot_have_its_bytes_reinterpreted.zig b/test/compile_errors/stage1/obj/slice_cannot_have_its_bytes_reinterpreted.zig index 4f7670ba741e4b45c0c7a2c3f7c301ec023cf5e0..8fcf4f505c94690e48ba2a0b6cfe559068423bc4 100644 --- a/test/compile_errors/stage1/obj/slice_cannot_have_its_bytes_reinterpreted.zig +++ b/test/compile_errors/stage1/obj/slice_cannot_have_its_bytes_reinterpreted.zig @@ -4,6 +4,8 @@ export fn foo() void { _ = value; } -// slice cannot have its bytes reinterpreted +// error +// backend=stage1 +// target=native // // :3:52: error: slice '[]const u8' cannot have its bytes reinterpreted diff --git a/test/compile_errors/stage1/obj/slice_passed_as_array_init_type.zig b/test/compile_errors/stage1/obj/slice_passed_as_array_init_type.zig index 0d29120ca44ddab63c6671690dedc6573d37f785..7ad29b1900b98546ce17377f2b77d71e6e794bec 100644 --- a/test/compile_errors/stage1/obj/slice_passed_as_array_init_type.zig +++ b/test/compile_errors/stage1/obj/slice_passed_as_array_init_type.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// slice passed as array init type +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8' diff --git a/test/compile_errors/stage1/obj/slice_passed_as_array_init_type_with_elems.zig b/test/compile_errors/stage1/obj/slice_passed_as_array_init_type_with_elems.zig index 375ed55a723291fb20170ade15a66a357d95a7b1..0da4b3fc9de8de87465ca09d7ddb2b6c57b37c34 100644 --- a/test/compile_errors/stage1/obj/slice_passed_as_array_init_type_with_elems.zig +++ b/test/compile_errors/stage1/obj/slice_passed_as_array_init_type_with_elems.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// slice passed as array init type with elems +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8' diff --git a/test/compile_errors/stage1/obj/slice_sentinel_mismatch-1.zig b/test/compile_errors/stage1/obj/slice_sentinel_mismatch-1.zig index 1e3c2450cb19d8c0a1e6a5f1cf92fb92b0ab062c..d0c47097da9b677bab22ff8cfe0f2f5c7d6de733 100644 --- a/test/compile_errors/stage1/obj/slice_sentinel_mismatch-1.zig +++ b/test/compile_errors/stage1/obj/slice_sentinel_mismatch-1.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = y; } -// slice sentinel mismatch - 1 +// error +// backend=stage1 +// target=native // // tmp.zig:2:37: error: expected type '[:1]const u8', found '*const [2:2]u8' diff --git a/test/compile_errors/stage1/obj/slice_sentinel_mismatch-2.zig b/test/compile_errors/stage1/obj/slice_sentinel_mismatch-2.zig index f1d73eb9df78bc918ce95e9a33220b8e5657a8d0..5f8d312a3c74dc031861ffb300beb641145e95a8 100644 --- a/test/compile_errors/stage1/obj/slice_sentinel_mismatch-2.zig +++ b/test/compile_errors/stage1/obj/slice_sentinel_mismatch-2.zig @@ -4,7 +4,9 @@ fn foo() [:0]u8 { } comptime { _ = foo; } -// slice sentinel mismatch - 2 +// error +// backend=stage1 +// target=native // // tmp.zig:3:12: error: expected type '[:0]u8', found '[]u8' // tmp.zig:3:12: note: destination pointer requires a terminating '0' sentinel diff --git a/test/compile_errors/stage1/obj/slicing_of_global_undefined_pointer.zig b/test/compile_errors/stage1/obj/slicing_of_global_undefined_pointer.zig index d52bfdf6a5118dbf574234c5e6fef3fb5b4cc071..8bbc0f85ebb7a4249e54f56f16b0710d02004705 100644 --- a/test/compile_errors/stage1/obj/slicing_of_global_undefined_pointer.zig +++ b/test/compile_errors/stage1/obj/slicing_of_global_undefined_pointer.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = buf[0..1]; } -// slicing of global undefined pointer +// error +// backend=stage1 +// target=native // // tmp.zig:3:12: error: non-zero length slice of undefined pointer diff --git a/test/compile_errors/stage1/obj/slicing_single-item_pointer.zig b/test/compile_errors/stage1/obj/slicing_single-item_pointer.zig index f6bbe752b1bd72db33d58d7a9b2e8baf76e0a3da..d8c82fa3aff677a450d0505c102816c97c468c22 100644 --- a/test/compile_errors/stage1/obj/slicing_single-item_pointer.zig +++ b/test/compile_errors/stage1/obj/slicing_single-item_pointer.zig @@ -3,6 +3,8 @@ export fn entry(ptr: *i32) void { _ = slice; } -// slicing single-item pointer +// error +// backend=stage1 +// target=native // // tmp.zig:2:22: error: slice of single-item pointer diff --git a/test/compile_errors/stage1/obj/specify_enum_tag_type_that_is_too_small.zig b/test/compile_errors/stage1/obj/specify_enum_tag_type_that_is_too_small.zig index ca7c305d38d4713ca6327a97162ee7efcd71bc08..dc7077c8f84d0f1b21aabc89d896b3737aad7a79 100644 --- a/test/compile_errors/stage1/obj/specify_enum_tag_type_that_is_too_small.zig +++ b/test/compile_errors/stage1/obj/specify_enum_tag_type_that_is_too_small.zig @@ -11,6 +11,8 @@ export fn entry() void { _ = x; } -// specify enum tag type that is too small +// error +// backend=stage1 +// target=native // // tmp.zig:6:5: error: enumeration value 4 too large for type 'u2' diff --git a/test/compile_errors/stage1/obj/specify_non-integer_enum_tag_type.zig b/test/compile_errors/stage1/obj/specify_non-integer_enum_tag_type.zig index 095a0812c13dae1815ec8b4c762fa051c8183fe0..333647e1e392afb22f7596385ceace2d6a01a48c 100644 --- a/test/compile_errors/stage1/obj/specify_non-integer_enum_tag_type.zig +++ b/test/compile_errors/stage1/obj/specify_non-integer_enum_tag_type.zig @@ -9,6 +9,8 @@ export fn entry() void { _ = x; } -// specify non-integer enum tag type +// error +// backend=stage1 +// target=native // // tmp.zig:1:21: error: expected integer, found 'f32' diff --git a/test/compile_errors/stage1/obj/src_outside_function.zig b/test/compile_errors/stage1/obj/src_outside_function.zig index 53591350665ee4f456a86ffa7929eb69d6a4dba8..7f8c7ae72fbd6e5f35777c91815591b18d75a32e 100644 --- a/test/compile_errors/stage1/obj/src_outside_function.zig +++ b/test/compile_errors/stage1/obj/src_outside_function.zig @@ -2,6 +2,8 @@ comptime { @src(); } -// @src outside function +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: @src outside function diff --git a/test/compile_errors/stage1/obj/std.fmt_error_for_unused_arguments.zig b/test/compile_errors/stage1/obj/std.fmt_error_for_unused_arguments.zig index 68299c2177bbccd3f13bc9debccd52760676bd92..21603ab3d314c69482b08fd9c2038ad9d489223f 100644 --- a/test/compile_errors/stage1/obj/std.fmt_error_for_unused_arguments.zig +++ b/test/compile_errors/stage1/obj/std.fmt_error_for_unused_arguments.zig @@ -2,6 +2,8 @@ export fn entry() void { @import("std").debug.print("{d} {d} {d} {d} {d}", .{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}); } -// std.fmt error for unused arguments +// error +// backend=stage1 +// target=native // // ?:?:?: error: 10 unused arguments in '{d} {d} {d} {d} {d}' diff --git a/test/compile_errors/stage1/obj/store_vector_pointer_with_unknown_runtime_index.zig b/test/compile_errors/stage1/obj/store_vector_pointer_with_unknown_runtime_index.zig index 6ef71c863a91ff4172627c3290f637002a32b3d1..57e91631b1173af253233d4621f00069232be958 100644 --- a/test/compile_errors/stage1/obj/store_vector_pointer_with_unknown_runtime_index.zig +++ b/test/compile_errors/stage1/obj/store_vector_pointer_with_unknown_runtime_index.zig @@ -9,6 +9,8 @@ fn storev(ptr: anytype, val: i32) void { ptr.* = val; } -// store vector pointer with unknown runtime index +// error +// backend=stage1 +// target=native // // tmp.zig:9:8: error: unable to determine vector element index of type '*align(16:0:4:?) i32 diff --git a/test/compile_errors/stage1/obj/storing_runtime_value_in_compile_time_variable_then_using_it.zig b/test/compile_errors/stage1/obj/storing_runtime_value_in_compile_time_variable_then_using_it.zig index 318db771d54cbe75e18ab343e64ca366f313479a..2d85209358de870aedd0cca812642ce672c1baa7 100644 --- a/test/compile_errors/stage1/obj/storing_runtime_value_in_compile_time_variable_then_using_it.zig +++ b/test/compile_errors/stage1/obj/storing_runtime_value_in_compile_time_variable_then_using_it.zig @@ -42,6 +42,8 @@ export fn entry() void { } } -// storing runtime value in compile time variable then using it +// error +// backend=stage1 +// target=native // // tmp.zig:38:29: error: cannot store runtime value in compile time variable diff --git a/test/compile_errors/stage1/obj/struct_depends_on_itself_via_optional_field.zig b/test/compile_errors/stage1/obj/struct_depends_on_itself_via_optional_field.zig index 13ee95155dce740db3290697d4290fa93f754167..46086172f77b635fefc79407f275504634848248 100644 --- a/test/compile_errors/stage1/obj/struct_depends_on_itself_via_optional_field.zig +++ b/test/compile_errors/stage1/obj/struct_depends_on_itself_via_optional_field.zig @@ -10,7 +10,9 @@ export fn entry() void { _ = obj; } -// struct depends on itself via optional field +// error +// backend=stage1 +// target=native // // tmp.zig:1:17: error: struct 'LhsExpr' depends on itself // tmp.zig:5:5: note: while checking this field diff --git a/test/compile_errors/stage1/obj/struct_field_missing_type.zig b/test/compile_errors/stage1/obj/struct_field_missing_type.zig index 669718a3d47a71197814e8f4c00757906ae1184e..175f1c7df771210fc691b14ffda9aa57bc38e516 100644 --- a/test/compile_errors/stage1/obj/struct_field_missing_type.zig +++ b/test/compile_errors/stage1/obj/struct_field_missing_type.zig @@ -6,6 +6,8 @@ export fn entry() void { _ = a; } -// struct field missing type +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: struct field missing type diff --git a/test/compile_errors/stage1/obj/struct_init_syntax_for_array.zig b/test/compile_errors/stage1/obj/struct_init_syntax_for_array.zig index 4eda9622ab42810e8d396aed6197e154eb85fced..6362e05114651cc82838d8e9a0295a0bceec3a00 100644 --- a/test/compile_errors/stage1/obj/struct_init_syntax_for_array.zig +++ b/test/compile_errors/stage1/obj/struct_init_syntax_for_array.zig @@ -3,6 +3,8 @@ comptime { _ = foo; } -// struct init syntax for array +// error +// backend=stage1 +// target=native // // tmp.zig:1:13: error: initializing array with struct syntax diff --git a/test/compile_errors/stage1/obj/struct_with_declarations_unavailable_for_reify_type.zig b/test/compile_errors/stage1/obj/struct_with_declarations_unavailable_for_reify_type.zig index 656a9b9f62b8aebcaaa079036eef5d803fc341d7..409020ca257f480a5ccbb16b4fdb8147d3fef35c 100644 --- a/test/compile_errors/stage1/obj/struct_with_declarations_unavailable_for_reify_type.zig +++ b/test/compile_errors/stage1/obj/struct_with_declarations_unavailable_for_reify_type.zig @@ -2,6 +2,8 @@ export fn entry() void { _ = @Type(@typeInfo(struct { const foo = 1; })); } -// struct with declarations unavailable for @Type +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: Type.Struct.decls must be empty for @Type diff --git a/test/compile_errors/stage1/obj/struct_with_invalid_field.zig b/test/compile_errors/stage1/obj/struct_with_invalid_field.zig index a2a632fbd942bb36072dac1fd8c314db4c3e3796..dcc9d26f65bae996f07fdcde1aab66b1266f593f 100644 --- a/test/compile_errors/stage1/obj/struct_with_invalid_field.zig +++ b/test/compile_errors/stage1/obj/struct_with_invalid_field.zig @@ -23,6 +23,8 @@ export fn entry() void { _ = a; } -// struct with invalid field +// error +// backend=stage1 +// target=native // // tmp.zig:14:17: error: use of undeclared identifier 'HeaderValue' diff --git a/test/compile_errors/stage1/obj/sub_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/sub_assign_on_undefined_value.zig index 01ef9313e542f2de63f733e68557b09e38876b54..74b705a154bfbd141d5e538c8bd09c113700421e 100644 --- a/test/compile_errors/stage1/obj/sub_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/sub_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a -= a; } -// sub assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/sub_on_undefined_value.zig b/test/compile_errors/stage1/obj/sub_on_undefined_value.zig index 80746abf0e7771b80729af60d7b48a3a90d2efc7..08c590ee3ff3bf66c3e2dbe838bc8ecc215e9f33 100644 --- a/test/compile_errors/stage1/obj/sub_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/sub_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a - a; } -// sub on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/sub_overflow_in_function_evaluation.zig b/test/compile_errors/stage1/obj/sub_overflow_in_function_evaluation.zig index 1084f1a1119d2060e1e82fecdaaabbf67674d206..dc259e6dcfcac7fc474487a4a65d394ff74f5d2f 100644 --- a/test/compile_errors/stage1/obj/sub_overflow_in_function_evaluation.zig +++ b/test/compile_errors/stage1/obj/sub_overflow_in_function_evaluation.zig @@ -5,6 +5,8 @@ fn sub(a: u16, b: u16) u16 { export fn entry() usize { return @sizeOf(@TypeOf(y)); } -// sub overflow in function evaluation +// error +// backend=stage1 +// target=native // // tmp.zig:3:14: error: operation caused overflow diff --git a/test/compile_errors/stage1/obj/sub_wrap_assign_on_undefined_value.zig b/test/compile_errors/stage1/obj/sub_wrap_assign_on_undefined_value.zig index 3c7fd4faa5f84d6df43b71e40d1298817f2a6c6c..41aa1ca14b08c74891486a50150d0a09ad3b1715 100644 --- a/test/compile_errors/stage1/obj/sub_wrap_assign_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/sub_wrap_assign_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { a -%= a; } -// sub wrap assign on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/sub_wrap_on_undefined_value.zig b/test/compile_errors/stage1/obj/sub_wrap_on_undefined_value.zig index 367b4c9c0e5d94e494ef24fe0aa102c815558444..68e4e78512f47387e83c7f20340829bca1003814 100644 --- a/test/compile_errors/stage1/obj/sub_wrap_on_undefined_value.zig +++ b/test/compile_errors/stage1/obj/sub_wrap_on_undefined_value.zig @@ -3,6 +3,8 @@ comptime { _ = a -% a; } -// sub wrap on undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/suspend_inside_suspend_block.zig b/test/compile_errors/stage1/obj/suspend_inside_suspend_block.zig index 2e807268cee028b68dccfd1a4ed8c966787a667c..4adffd2f2574b7f7216e3c2e93151779773978c4 100644 --- a/test/compile_errors/stage1/obj/suspend_inside_suspend_block.zig +++ b/test/compile_errors/stage1/obj/suspend_inside_suspend_block.zig @@ -8,7 +8,9 @@ fn foo() void { } } -// suspend inside suspend block +// error +// backend=stage1 +// target=native // // tmp.zig:6:9: error: cannot suspend inside suspend block // tmp.zig:5:5: note: other suspend block here diff --git a/test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong.zig b/test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong.zig index c5db39f5b23f055a9df416ba8fac66c1055af11b..056aebe3dd415d5b069aaa62f1bd7da083120d89 100644 --- a/test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong.zig +++ b/test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong.zig @@ -16,7 +16,9 @@ fn f(n: Number) i32 { export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// switch expression - duplicate enumeration prong +// error +// backend=stage1 +// target=native // // tmp.zig:13:15: error: duplicate switch value // tmp.zig:10:15: note: other value here diff --git a/test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong_when_else_present.zig b/test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong_when_else_present.zig index 22a0c189c173c70ec9e580a00b2d026604b23dbb..4d891c3917f19c9ea21418cea7461c509a803d86 100644 --- a/test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong_when_else_present.zig +++ b/test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong_when_else_present.zig @@ -17,7 +17,9 @@ fn f(n: Number) i32 { export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// switch expression - duplicate enumeration prong when else present +// error +// backend=stage1 +// target=native // // tmp.zig:13:15: error: duplicate switch value // tmp.zig:10:15: note: other value here diff --git a/test/compile_errors/stage1/obj/switch_expression-duplicate_or_overlapping_integer_value.zig b/test/compile_errors/stage1/obj/switch_expression-duplicate_or_overlapping_integer_value.zig index 06ef7de62e90e2513049cc57653afad29a65a9e5..2810bc13e1eefe5ee620fcbc25fd0ea78f2f4254 100644 --- a/test/compile_errors/stage1/obj/switch_expression-duplicate_or_overlapping_integer_value.zig +++ b/test/compile_errors/stage1/obj/switch_expression-duplicate_or_overlapping_integer_value.zig @@ -8,7 +8,9 @@ fn foo(x: u8) u8 { } export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// switch expression - duplicate or overlapping integer value +// error +// backend=stage1 +// target=native // // tmp.zig:6:9: error: duplicate switch value // tmp.zig:5:14: note: previous value here diff --git a/test/compile_errors/stage1/obj/switch_expression-duplicate_type.zig b/test/compile_errors/stage1/obj/switch_expression-duplicate_type.zig index 9ac9feaeaf1598149a8892a60c6b7bdbb05e48bf..b84c4622a2e0c55cb74aa8935a91e1b406286c70 100644 --- a/test/compile_errors/stage1/obj/switch_expression-duplicate_type.zig +++ b/test/compile_errors/stage1/obj/switch_expression-duplicate_type.zig @@ -9,7 +9,9 @@ fn foo(comptime T: type, x: T) u8 { } export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } -// switch expression - duplicate type +// error +// backend=stage1 +// target=native // // tmp.zig:6:9: error: duplicate switch value // tmp.zig:4:9: note: previous value here diff --git a/test/compile_errors/stage1/obj/switch_expression-duplicate_type_struct_alias.zig b/test/compile_errors/stage1/obj/switch_expression-duplicate_type_struct_alias.zig index b92336cac5b54d39c06295ef59364a6840bffb85..057e674e5a97623c9518c24fc6f93f159738ddad 100644 --- a/test/compile_errors/stage1/obj/switch_expression-duplicate_type_struct_alias.zig +++ b/test/compile_errors/stage1/obj/switch_expression-duplicate_type_struct_alias.zig @@ -13,7 +13,9 @@ fn foo(comptime T: type, x: T) u8 { } export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } -// switch expression - duplicate type (struct alias) +// error +// backend=stage1 +// target=native // // tmp.zig:10:9: error: duplicate switch value // tmp.zig:8:9: note: previous value here diff --git a/test/compile_errors/stage1/obj/switch_expression-missing_enumeration_prong.zig b/test/compile_errors/stage1/obj/switch_expression-missing_enumeration_prong.zig index b6cd60c22b0ecbbeaea49fd91b8ec96b49a398e7..1a13730223b9ee9a1a7f7930f311e64956b1b31d 100644 --- a/test/compile_errors/stage1/obj/switch_expression-missing_enumeration_prong.zig +++ b/test/compile_errors/stage1/obj/switch_expression-missing_enumeration_prong.zig @@ -14,6 +14,8 @@ fn f(n: Number) i32 { export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// switch expression - missing enumeration prong +// error +// backend=stage1 +// target=native // // tmp.zig:8:5: error: enumeration value 'Number.Four' not handled in switch diff --git a/test/compile_errors/stage1/obj/switch_expression-multiple_else_prongs.zig b/test/compile_errors/stage1/obj/switch_expression-multiple_else_prongs.zig index 6a7e274b5687f0f105635277322f8c2829f2a460..82672220925567bcb41f41d0f38bffb7cafbbae7 100644 --- a/test/compile_errors/stage1/obj/switch_expression-multiple_else_prongs.zig +++ b/test/compile_errors/stage1/obj/switch_expression-multiple_else_prongs.zig @@ -9,6 +9,8 @@ export fn entry() void { f(1234); } -// switch expression - multiple else prongs +// error +// backend=stage1 +// target=native // // tmp.zig:5:9: error: multiple else prongs in switch expression diff --git a/test/compile_errors/stage1/obj/switch_expression-non_exhaustive_integer_prongs.zig b/test/compile_errors/stage1/obj/switch_expression-non_exhaustive_integer_prongs.zig index 88fb8548de80301efbf67d3136f8c4b90e753ae6..940338edb98e409668a53bb63990a9f10c99b2a2 100644 --- a/test/compile_errors/stage1/obj/switch_expression-non_exhaustive_integer_prongs.zig +++ b/test/compile_errors/stage1/obj/switch_expression-non_exhaustive_integer_prongs.zig @@ -5,6 +5,8 @@ fn foo(x: u8) void { } export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// switch expression - non exhaustive integer prongs +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: switch must handle all possibilities diff --git a/test/compile_errors/stage1/obj/switch_expression-switch_on_pointer_type_with_no_else.zig b/test/compile_errors/stage1/obj/switch_expression-switch_on_pointer_type_with_no_else.zig index ec7565b8826a0057d8572a1d9090c9f1998095df..6a357beabed5d55f8c18205e08182b340dee5bfd 100644 --- a/test/compile_errors/stage1/obj/switch_expression-switch_on_pointer_type_with_no_else.zig +++ b/test/compile_errors/stage1/obj/switch_expression-switch_on_pointer_type_with_no_else.zig @@ -6,6 +6,8 @@ fn foo(x: *u8) void { const y: u8 = 100; export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// switch expression - switch on pointer type with no else +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: else prong required when switching on type '*u8' diff --git a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_bool.zig b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_bool.zig index 8c36a3c2891c42e16343f9647f6cc1c07eb5e8d4..2ee39f153187e00ed113cbaab9f01cd16e320182 100644 --- a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_bool.zig +++ b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_bool.zig @@ -7,6 +7,8 @@ fn foo(x: bool) void { } export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// switch expression - unreachable else prong (bool) +// error +// backend=stage1 +// target=native // // tmp.zig:5:9: error: unreachable else prong, all cases already handled diff --git a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_enum.zig b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_enum.zig index 8207d0523465f77293ac75a2ca43c7f889bfbcf5..bcf840ab97769c77b5521a5d40cca55544db9973 100644 --- a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_enum.zig +++ b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_enum.zig @@ -17,6 +17,8 @@ fn foo(x: u8) void { export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// switch expression - unreachable else prong (enum) +// error +// backend=stage1 +// target=native // // tmp.zig:14:9: error: unreachable else prong, all cases already handled diff --git a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_i8.zig b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_i8.zig index 8750e57fae21f9d4a01fcf72629cda8b87889706..f0c9d7a08a3b32fa33f0663abc152ef3649e11c4 100644 --- a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_i8.zig +++ b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_i8.zig @@ -10,6 +10,8 @@ fn foo(x: i8) void { } export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// switch expression - unreachable else prong (range i8) +// error +// backend=stage1 +// target=native // // tmp.zig:8:9: error: unreachable else prong, all cases already handled diff --git a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_u8.zig b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_u8.zig index 280663ae51b0f47f887e317dedb8749e2e249672..9342ce8c32f26b8939b01f3db0d642b4dde0b32b 100644 --- a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_u8.zig +++ b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_u8.zig @@ -10,6 +10,8 @@ fn foo(x: u8) void { } export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// switch expression - unreachable else prong (range u8) +// error +// backend=stage1 +// target=native // // tmp.zig:8:9: error: unreachable else prong, all cases already handled diff --git a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u1.zig b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u1.zig index 58c4f378bf473c5799d03a21b60e69130d1aa257..90abf5074bebd8bf5c411d0c75752a6f2c4c2d48 100644 --- a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u1.zig +++ b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u1.zig @@ -7,6 +7,8 @@ fn foo(x: u1) void { } export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// switch expression - unreachable else prong (u1) +// error +// backend=stage1 +// target=native // // tmp.zig:5:9: error: unreachable else prong, all cases already handled diff --git a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u2.zig b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u2.zig index ec1804316e38d156dc4710695d65f9a647e852d6..a523046e162008ce1eff29ce29396b7060e90f0c 100644 --- a/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u2.zig +++ b/test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u2.zig @@ -9,6 +9,8 @@ fn foo(x: u2) void { } export fn entry() usize { return @sizeOf(@TypeOf(foo)); } -// switch expression - unreachable else prong (u2) +// error +// backend=stage1 +// target=native // // tmp.zig:7:9: error: unreachable else prong, all cases already handled diff --git a/test/compile_errors/stage1/obj/switch_on_enum_with_1_field_with_no_prongs.zig b/test/compile_errors/stage1/obj/switch_on_enum_with_1_field_with_no_prongs.zig index fbfc039f59c248a575ae5d1437931accfab46c1a..97f7de121d69086f701c4eb986ec7329d6449c8d 100644 --- a/test/compile_errors/stage1/obj/switch_on_enum_with_1_field_with_no_prongs.zig +++ b/test/compile_errors/stage1/obj/switch_on_enum_with_1_field_with_no_prongs.zig @@ -5,6 +5,8 @@ export fn entry() void { switch (f) {} } -// switch on enum with 1 field with no prongs +// error +// backend=stage1 +// target=native // // tmp.zig:5:5: error: enumeration value 'Foo.M' not handled in switch diff --git a/test/compile_errors/stage1/obj/switch_on_union_with_no_attached_enum.zig b/test/compile_errors/stage1/obj/switch_on_union_with_no_attached_enum.zig index f1ae750b4b89f9aa846a68e2c32f87c70828667d..684861a898d769124f3c2a6c6e5ed15c319db442 100644 --- a/test/compile_errors/stage1/obj/switch_on_union_with_no_attached_enum.zig +++ b/test/compile_errors/stage1/obj/switch_on_union_with_no_attached_enum.zig @@ -14,7 +14,9 @@ fn foo(a: *const Payload) void { } } -// switch on union with no attached enum +// error +// backend=stage1 +// target=native // // tmp.zig:11:14: error: switch on union which has no attached enum // tmp.zig:1:17: note: consider 'union(enum)' here diff --git a/test/compile_errors/stage1/obj/switch_with_invalid_expression_parameter.zig b/test/compile_errors/stage1/obj/switch_with_invalid_expression_parameter.zig index f65879bc7a7cb7cdadd72aac143488c7972e8e92..1eb74519f50fb197b25a5bf4fc843b3c83b3c52b 100644 --- a/test/compile_errors/stage1/obj/switch_with_invalid_expression_parameter.zig +++ b/test/compile_errors/stage1/obj/switch_with_invalid_expression_parameter.zig @@ -10,6 +10,8 @@ fn Test(comptime T: type) void { _ = x; } -// switch with invalid expression parameter +// error +// backend=stage1 +// target=native // // tmp.zig:7:17: error: switch on type 'type' provides no expression parameter diff --git a/test/compile_errors/stage1/obj/switch_with_overlapping_case_ranges.zig b/test/compile_errors/stage1/obj/switch_with_overlapping_case_ranges.zig index 2818d766a717b916821e999b78021b4d5d2b9bfb..1b03d3fe54078d85b6109bbbf916f0f637ba5d6a 100644 --- a/test/compile_errors/stage1/obj/switch_with_overlapping_case_ranges.zig +++ b/test/compile_errors/stage1/obj/switch_with_overlapping_case_ranges.zig @@ -6,6 +6,8 @@ export fn entry() void { } } -// switch with overlapping case ranges +// error +// backend=stage1 +// target=native // // tmp.zig:5:9: error: duplicate switch value diff --git a/test/compile_errors/stage1/obj/tagName_used_on_union_with_no_associated_enum_tag.zig b/test/compile_errors/stage1/obj/tagName_used_on_union_with_no_associated_enum_tag.zig index bd03a97cfdd3ec391ab706ab18d579ebd3cc676e..efd9b8ceefc944bc02f8cd65f808771bc712bd70 100644 --- a/test/compile_errors/stage1/obj/tagName_used_on_union_with_no_associated_enum_tag.zig +++ b/test/compile_errors/stage1/obj/tagName_used_on_union_with_no_associated_enum_tag.zig @@ -8,7 +8,9 @@ export fn entry() void { _ = tagName; } -// @tagName used on union with no associated enum tag +// error +// backend=stage1 +// target=native // // tmp.zig:7:19: error: union has no associated enum // tmp.zig:1:18: note: declared here diff --git a/test/compile_errors/stage1/obj/take_slice_of_invalid_dereference.zig b/test/compile_errors/stage1/obj/take_slice_of_invalid_dereference.zig index 9beda30e2f0dcafe92161bc994e77d6b343927fb..c039be373778354fee485a624a66d1e34aade8c6 100644 --- a/test/compile_errors/stage1/obj/take_slice_of_invalid_dereference.zig +++ b/test/compile_errors/stage1/obj/take_slice_of_invalid_dereference.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// take slice of invalid dereference +// error +// backend=stage1 +// target=native // // tmp.zig:2:18: error: attempt to dereference non-pointer type 'comptime_int' diff --git a/test/compile_errors/stage1/obj/taking_bit_offset_of_void_field_in_struct.zig b/test/compile_errors/stage1/obj/taking_bit_offset_of_void_field_in_struct.zig index 936a110a6170ea429b34309642938d841b5794a9..e404c3bdd698fe4b4fa42774a841ebe7191c68c9 100644 --- a/test/compile_errors/stage1/obj/taking_bit_offset_of_void_field_in_struct.zig +++ b/test/compile_errors/stage1/obj/taking_bit_offset_of_void_field_in_struct.zig @@ -6,6 +6,8 @@ export fn foo() void { _ = fieldOffset; } -// taking bit offset of void field in struct +// error +// backend=stage1 +// target=native // // tmp.zig:5:45: error: zero-bit field 'val' in struct 'Empty' has no offset diff --git a/test/compile_errors/stage1/obj/taking_byte_offset_of_void_field_in_struct.zig b/test/compile_errors/stage1/obj/taking_byte_offset_of_void_field_in_struct.zig index d71dbc15020ea888f441adda6b9fcc5ccdaf36d7..eb7d83efff7c9049cc68118178b5dd3d29a78506 100644 --- a/test/compile_errors/stage1/obj/taking_byte_offset_of_void_field_in_struct.zig +++ b/test/compile_errors/stage1/obj/taking_byte_offset_of_void_field_in_struct.zig @@ -6,6 +6,8 @@ export fn foo() void { _ = fieldOffset; } -// taking byte offset of void field in struct +// error +// backend=stage1 +// target=native // // tmp.zig:5:42: error: zero-bit field 'val' in struct 'Empty' has no offset diff --git a/test/compile_errors/stage1/obj/threadlocal_qualifier_on_const.zig b/test/compile_errors/stage1/obj/threadlocal_qualifier_on_const.zig index fa99e592aea728f021935ed3e68a6cec63e8f864..d34ba06879c2d6b0107941a1e4bbdd97bcf7ab7d 100644 --- a/test/compile_errors/stage1/obj/threadlocal_qualifier_on_const.zig +++ b/test/compile_errors/stage1/obj/threadlocal_qualifier_on_const.zig @@ -3,6 +3,8 @@ export fn entry() i32 { return x; } -// threadlocal qualifier on const +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: threadlocal variable cannot be constant diff --git a/test/compile_errors/stage1/obj/top_level_decl_dependency_loop.zig b/test/compile_errors/stage1/obj/top_level_decl_dependency_loop.zig index 4ecdc6f67dd09c9d00218c7d8cbca6785c963347..ac70285c9ca3d275b281d1898a8a59dced06511f 100644 --- a/test/compile_errors/stage1/obj/top_level_decl_dependency_loop.zig +++ b/test/compile_errors/stage1/obj/top_level_decl_dependency_loop.zig @@ -5,6 +5,8 @@ export fn entry() void { _ = c; } -// top level decl dependency loop +// error +// backend=stage1 +// target=native // // tmp.zig:2:19: error: dependency loop detected diff --git a/test/compile_errors/stage1/obj/truncate_sign_mismatch.zig b/test/compile_errors/stage1/obj/truncate_sign_mismatch.zig index a60ca4bc7ac02f64efd6edd58f7a4e00400eecbd..8434d9ed16da32a0f0052227d147a1ca94dbe715 100644 --- a/test/compile_errors/stage1/obj/truncate_sign_mismatch.zig +++ b/test/compile_errors/stage1/obj/truncate_sign_mismatch.zig @@ -15,7 +15,9 @@ export fn entry4() u8 { return @truncate(u8, x); } -// truncate sign mismatch +// error +// backend=stage1 +// target=native // // tmp.zig:3:26: error: expected signed integer type, found 'u32' // tmp.zig:7:26: error: expected unsigned integer type, found 'i32' diff --git a/test/compile_errors/stage1/obj/truncate_undefined_value.zig b/test/compile_errors/stage1/obj/truncate_undefined_value.zig index 9d3913f9c3b78619363174f96b6af5fe50559d7a..67a1f17ba783dfbd83c79483ba8f78e7ea0f1f47 100644 --- a/test/compile_errors/stage1/obj/truncate_undefined_value.zig +++ b/test/compile_errors/stage1/obj/truncate_undefined_value.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = z; } -// @truncate undefined value +// error +// backend=stage1 +// target=native // // tmp.zig:2:27: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/try_in_function_with_non_error_return_type.zig b/test/compile_errors/stage1/obj/try_in_function_with_non_error_return_type.zig index d799f769b6537d2df15baf6064f8b90daa80497b..c00fa2709f726bfe0b8da730520e9b3fa546c9ba 100644 --- a/test/compile_errors/stage1/obj/try_in_function_with_non_error_return_type.zig +++ b/test/compile_errors/stage1/obj/try_in_function_with_non_error_return_type.zig @@ -3,6 +3,8 @@ export fn f() void { } fn something() anyerror!void { } -// try in function with non error return type +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: expected type 'void', found 'anyerror' diff --git a/test/compile_errors/stage1/obj/type_checking_function_pointers.zig b/test/compile_errors/stage1/obj/type_checking_function_pointers.zig index d9bcde6babc7ee48370969694ef2e9c283a743a7..b88b6bdb520883c4019119306e8ae18c58d1d09d 100644 --- a/test/compile_errors/stage1/obj/type_checking_function_pointers.zig +++ b/test/compile_errors/stage1/obj/type_checking_function_pointers.zig @@ -6,6 +6,8 @@ export fn entry() void { a(c); } -// type checking function pointers +// error +// backend=stage1 +// target=native // // tmp.zig:6:7: error: expected type 'fn(*const u8) void', found 'fn(u8) void' diff --git a/test/compile_errors/stage1/obj/type_variables_must_be_constant.zig b/test/compile_errors/stage1/obj/type_variables_must_be_constant.zig index 33846d6da8861dae584d6361318e86eefe54e80c..f8cadf8520e55f99c3c8d1e623bc22dc91ff0494 100644 --- a/test/compile_errors/stage1/obj/type_variables_must_be_constant.zig +++ b/test/compile_errors/stage1/obj/type_variables_must_be_constant.zig @@ -3,6 +3,8 @@ export fn entry() foo { return 1; } -// type variables must be constant +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: variable of type 'type' must be constant diff --git a/test/compile_errors/stage1/obj/undeclared_identifier.zig b/test/compile_errors/stage1/obj/undeclared_identifier.zig index 36f46a22f4c82dc2d3f4c2dde3e9cd727ba2164a..297a618eb8978af2398460dfaeea449a6af0ca7e 100644 --- a/test/compile_errors/stage1/obj/undeclared_identifier.zig +++ b/test/compile_errors/stage1/obj/undeclared_identifier.zig @@ -4,6 +4,8 @@ export fn a() void { c; } -// undeclared identifier +// error +// backend=stage1 +// target=native // // tmp.zig:3:5: error: use of undeclared identifier 'b' diff --git a/test/compile_errors/stage1/obj/undeclared_identifier_error_should_mark_fn_as_impure.zig b/test/compile_errors/stage1/obj/undeclared_identifier_error_should_mark_fn_as_impure.zig index fa629bdcb8771389bb5e66d94430afb3addd84e5..697b7ccb55db0f3ff23265d131f2584e2f8cb0b9 100644 --- a/test/compile_errors/stage1/obj/undeclared_identifier_error_should_mark_fn_as_impure.zig +++ b/test/compile_errors/stage1/obj/undeclared_identifier_error_should_mark_fn_as_impure.zig @@ -5,6 +5,8 @@ fn test_a_thing() void { bad_fn_call(); } -// undeclared identifier error should mark fn as impure +// error +// backend=stage1 +// target=native // // tmp.zig:5:5: error: use of undeclared identifier 'bad_fn_call' diff --git a/test/compile_errors/stage1/obj/undeclared_identifier_in_unanalyzed_branch.zig b/test/compile_errors/stage1/obj/undeclared_identifier_in_unanalyzed_branch.zig index 55d952e0fd8890179342a77d7d4105ed762eccc8..2efa8ca115ac96fb9b91edfc07cd81c22957ce69 100644 --- a/test/compile_errors/stage1/obj/undeclared_identifier_in_unanalyzed_branch.zig +++ b/test/compile_errors/stage1/obj/undeclared_identifier_in_unanalyzed_branch.zig @@ -4,6 +4,8 @@ export fn a() void { } } -// undeclared identifier in unanalyzed branch +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: use of undeclared identifier 'lol_this_doesnt_exist' diff --git a/test/compile_errors/stage1/obj/undefined_as_field_type_is_rejected.zig b/test/compile_errors/stage1/obj/undefined_as_field_type_is_rejected.zig index 4035955387bb6bc40f0e1bde8fd71e0fc604ca44..b6eb059661c10877af4c38e0e120196ae482960e 100644 --- a/test/compile_errors/stage1/obj/undefined_as_field_type_is_rejected.zig +++ b/test/compile_errors/stage1/obj/undefined_as_field_type_is_rejected.zig @@ -6,6 +6,8 @@ export fn entry1() void { _ = foo; } -// undefined as field type is rejected +// error +// backend=stage1 +// target=native // // tmp.zig:2:8: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/undefined_function_call.zig b/test/compile_errors/stage1/obj/undefined_function_call.zig index ebf76aafbd5310328015ddb418d757b4bdc48623..a9627961fe514824e433319bc959dc413b108aff 100644 --- a/test/compile_errors/stage1/obj/undefined_function_call.zig +++ b/test/compile_errors/stage1/obj/undefined_function_call.zig @@ -2,6 +2,8 @@ export fn a() void { b(); } -// undefined function call +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: use of undeclared identifier 'b' diff --git a/test/compile_errors/stage1/obj/underscore_is_not_a_declarable_symbol.zig b/test/compile_errors/stage1/obj/underscore_is_not_a_declarable_symbol.zig index bfcfbc3bcc5bc8f972add81c48de59256db7088f..f4318af8fd085db48ca01898965fe29a25d3fb28 100644 --- a/test/compile_errors/stage1/obj/underscore_is_not_a_declarable_symbol.zig +++ b/test/compile_errors/stage1/obj/underscore_is_not_a_declarable_symbol.zig @@ -3,6 +3,8 @@ export fn f1() usize { return _; } -// `_` is not a declarable symbol +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: '_' used as an identifier without @"_" syntax diff --git a/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_for.zig b/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_for.zig index be2ae559f30bfa89eb150c26bb9285c65a18c65c..fe89c8372d6fa93d84df83f5dc0b9bd422a01cfa 100644 --- a/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_for.zig +++ b/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_for.zig @@ -6,6 +6,8 @@ export fn returns() void { } } -// `_` should not be usable inside for +// error +// backend=stage1 +// target=native // // tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax diff --git a/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while.zig b/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while.zig index d93ed28c9e8e4c2ea349a9d7de1e3000c3e0b537..7f694e06031349b551bdc3bd2f21136e05c59f55 100644 --- a/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while.zig +++ b/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while.zig @@ -9,6 +9,8 @@ fn optionalReturn() ?u32 { return 1; } -// `_` should not be usable inside while +// error +// backend=stage1 +// target=native // // tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax diff --git a/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while_else.zig b/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while_else.zig index e1e4c7b4c11322d5031727efa191f04fc3dbe7c8..87a705ee698afa010defbdc94d540c3f6e41910f 100644 --- a/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while_else.zig +++ b/test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while_else.zig @@ -11,6 +11,8 @@ fn optionalReturnError() !?u32 { return error.optionalReturnError; } -// `_` should not be usable inside while else +// error +// backend=stage1 +// target=native // // tmp.zig:6:17: error: '_' used as an identifier without @"_" syntax diff --git a/test/compile_errors/stage1/obj/union_auto-enum_value_already_taken.zig b/test/compile_errors/stage1/obj/union_auto-enum_value_already_taken.zig index 377290bd7e3222adb86334c4944dbd57eeab6c87..3b00f95ff953f51e464a35e0468fa40bdde282c7 100644 --- a/test/compile_errors/stage1/obj/union_auto-enum_value_already_taken.zig +++ b/test/compile_errors/stage1/obj/union_auto-enum_value_already_taken.zig @@ -10,7 +10,9 @@ export fn entry() void { _ = x; } -// union auto-enum value already taken +// error +// backend=stage1 +// target=native // // tmp.zig:6:9: error: enum tag value 60 already taken // tmp.zig:4:9: note: other occurrence here diff --git a/test/compile_errors/stage1/obj/union_enum_field_does_not_match_enum.zig b/test/compile_errors/stage1/obj/union_enum_field_does_not_match_enum.zig index a924932c9f4cb90039c831598ede6cf566db2eb1..38260091dc4a249657cdae7af6184db042b34177 100644 --- a/test/compile_errors/stage1/obj/union_enum_field_does_not_match_enum.zig +++ b/test/compile_errors/stage1/obj/union_enum_field_does_not_match_enum.zig @@ -14,7 +14,9 @@ export fn entry() void { _ = a; } -// union enum field does not match enum +// error +// backend=stage1 +// target=native // // tmp.zig:10:5: error: enum field not found: 'D' // tmp.zig:1:16: note: enum declared here diff --git a/test/compile_errors/stage1/obj/union_fields_with_value_assignments.zig b/test/compile_errors/stage1/obj/union_fields_with_value_assignments.zig index 0cf67a0eca14e05aa88526af2648ba9a19d72204..94568d55c3aef0032243009e50ae8d598b2bf7c3 100644 --- a/test/compile_errors/stage1/obj/union_fields_with_value_assignments.zig +++ b/test/compile_errors/stage1/obj/union_fields_with_value_assignments.zig @@ -6,7 +6,9 @@ export fn entry() void { _ = x; } -// union fields with value assignments +// error +// backend=stage1 +// target=native // // tmp.zig:1:24: error: explicitly valued tagged union missing integer tag type // tmp.zig:2:14: note: tag value specified here diff --git a/test/compile_errors/stage1/obj/union_with_0_fields.zig b/test/compile_errors/stage1/obj/union_with_0_fields.zig index 36086e8ccec09a91a2dc6ff6d19445e582602655..a6f3d69faa49f63d86a2d7fac6b480fdad0a5286 100644 --- a/test/compile_errors/stage1/obj/union_with_0_fields.zig +++ b/test/compile_errors/stage1/obj/union_with_0_fields.zig @@ -1,5 +1,7 @@ const Foo = union {}; -// union with 0 fields +// error +// backend=stage1 +// target=native // // tmp.zig:1:13: error: union declarations must have at least one tag diff --git a/test/compile_errors/stage1/obj/union_with_specified_enum_omits_field.zig b/test/compile_errors/stage1/obj/union_with_specified_enum_omits_field.zig index c1c1d38f02e08235d3b42e18972d1edad30646e5..0bb677a18cdb128090acdbcdcba57079bbc3fdef 100644 --- a/test/compile_errors/stage1/obj/union_with_specified_enum_omits_field.zig +++ b/test/compile_errors/stage1/obj/union_with_specified_enum_omits_field.zig @@ -11,7 +11,9 @@ export fn entry() usize { return @sizeOf(Payload); } -// union with specified enum omits field +// error +// backend=stage1 +// target=native // // tmp.zig:6:17: error: enum field missing: 'C' // tmp.zig:4:5: note: declared here diff --git a/test/compile_errors/stage1/obj/union_with_too_small_explicit_signed_tag_type.zig b/test/compile_errors/stage1/obj/union_with_too_small_explicit_signed_tag_type.zig index a3e75c25f65032091ed79ff80f7d944445e6f323..97f4d48f6b84cc8dbf16ee1715a97a8c81b7ceab 100644 --- a/test/compile_errors/stage1/obj/union_with_too_small_explicit_signed_tag_type.zig +++ b/test/compile_errors/stage1/obj/union_with_too_small_explicit_signed_tag_type.zig @@ -8,7 +8,9 @@ export fn entry() void { _ = U{ .D = 1 }; } -// union with too small explicit signed tag type +// error +// backend=stage1 +// target=native // // tmp.zig:1:22: error: specified integer tag type cannot represent every field // tmp.zig:1:22: note: type i2 cannot fit values in range 0...3 diff --git a/test/compile_errors/stage1/obj/union_with_too_small_explicit_unsigned_tag_type.zig b/test/compile_errors/stage1/obj/union_with_too_small_explicit_unsigned_tag_type.zig index 6f13dcda8a78f3c1af900d22f54126fda5905444..c1496ade86dc5e8bb1b8173dd6afe22602568c7c 100644 --- a/test/compile_errors/stage1/obj/union_with_too_small_explicit_unsigned_tag_type.zig +++ b/test/compile_errors/stage1/obj/union_with_too_small_explicit_unsigned_tag_type.zig @@ -9,7 +9,9 @@ export fn entry() void { _ = U{ .E = 1 }; } -// union with too small explicit unsigned tag type +// error +// backend=stage1 +// target=native // // tmp.zig:1:22: error: specified integer tag type cannot represent every field // tmp.zig:1:22: note: type u2 cannot fit values in range 0...4 diff --git a/test/compile_errors/stage1/obj/unknown_length_pointer_to_opaque.zig b/test/compile_errors/stage1/obj/unknown_length_pointer_to_opaque.zig index a847bae59971378284c64919bba2c6afa79159e2..d155b986d718b90b2f09febfc1a6dd7134c2c114 100644 --- a/test/compile_errors/stage1/obj/unknown_length_pointer_to_opaque.zig +++ b/test/compile_errors/stage1/obj/unknown_length_pointer_to_opaque.zig @@ -1,5 +1,7 @@ export const T = [*]opaque {}; -// unknown length pointer to opaque +// error +// backend=stage1 +// target=native // // tmp.zig:1:21: error: unknown-length pointer to opaque diff --git a/test/compile_errors/stage1/obj/unreachable_code-double_break.zig b/test/compile_errors/stage1/obj/unreachable_code-double_break.zig index b030c1d24dd292359d727feed40cdc102f00924f..0a19337af844a7fae0915f4d8ac9fbf64c7b47a1 100644 --- a/test/compile_errors/stage1/obj/unreachable_code-double_break.zig +++ b/test/compile_errors/stage1/obj/unreachable_code-double_break.zig @@ -4,7 +4,9 @@ export fn a() void { }; } -// unreachable code - double break +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: unreachable code // tmp.zig:3:20: note: control flow is diverted here diff --git a/test/compile_errors/stage1/obj/unreachable_code-nested_returns.zig b/test/compile_errors/stage1/obj/unreachable_code-nested_returns.zig index 7bfa8eef64594f9e78f48c8d70184c5f30e07028..8a80fcd161c2d5c7f18c6398d5bd59a20dd7bf02 100644 --- a/test/compile_errors/stage1/obj/unreachable_code-nested_returns.zig +++ b/test/compile_errors/stage1/obj/unreachable_code-nested_returns.zig @@ -2,7 +2,9 @@ export fn a() i32 { return return 1; } -// unreachable code - nested returns +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: unreachable code // tmp.zig:2:12: note: control flow is diverted here diff --git a/test/compile_errors/stage1/obj/unreachable_code.zig b/test/compile_errors/stage1/obj/unreachable_code.zig index 779cd903792cc7e8cbde79fea8a23a82a47a0f39..30a92d06bf6f48883da302015a404e381cf0476f 100644 --- a/test/compile_errors/stage1/obj/unreachable_code.zig +++ b/test/compile_errors/stage1/obj/unreachable_code.zig @@ -5,7 +5,9 @@ export fn a() void { fn b() void {} -// unreachable code +// error +// backend=stage1 +// target=native // // tmp.zig:3:6: error: unreachable code // tmp.zig:2:5: note: control flow is diverted here diff --git a/test/compile_errors/stage1/obj/unreachable_executed_at_comptime.zig b/test/compile_errors/stage1/obj/unreachable_executed_at_comptime.zig index 857ab0417fe4a4f11709073fa0c8db9f6db52336..34cb354e941656f8dd8790da9c1e40a71ed456e5 100644 --- a/test/compile_errors/stage1/obj/unreachable_executed_at_comptime.zig +++ b/test/compile_errors/stage1/obj/unreachable_executed_at_comptime.zig @@ -8,7 +8,9 @@ export fn entry() void { _ = foo(-42); } -// unreachable executed at comptime +// error +// backend=stage1 +// target=native // // tmp.zig:4:9: error: reached unreachable code // tmp.zig:8:12: note: called from here diff --git a/test/compile_errors/stage1/obj/unreachable_parameter.zig b/test/compile_errors/stage1/obj/unreachable_parameter.zig index 3feed62a1e43b1e32af9f308b377a61c63acafcd..296194f7e33dbd4e59d0fbb6831664b8fe586426 100644 --- a/test/compile_errors/stage1/obj/unreachable_parameter.zig +++ b/test/compile_errors/stage1/obj/unreachable_parameter.zig @@ -1,6 +1,8 @@ fn f(a: noreturn) void { _ = a; } export fn entry() void { f(); } -// unreachable parameter +// error +// backend=stage1 +// target=native // // tmp.zig:1:9: error: parameter of type 'noreturn' not allowed diff --git a/test/compile_errors/stage1/obj/unreachable_variable.zig b/test/compile_errors/stage1/obj/unreachable_variable.zig index 8e053acd068860060cfc905e94318f4526c036df..7f822a8bceb9fe50102f6a50c9f9849ac047de15 100644 --- a/test/compile_errors/stage1/obj/unreachable_variable.zig +++ b/test/compile_errors/stage1/obj/unreachable_variable.zig @@ -3,6 +3,8 @@ export fn f() void { _ = a; } -// unreachable variable +// error +// backend=stage1 +// target=native // // tmp.zig:2:25: error: expected type 'noreturn', found 'void' diff --git a/test/compile_errors/stage1/obj/unreachable_with_return.zig b/test/compile_errors/stage1/obj/unreachable_with_return.zig index ac9ecc93e330f3d751f6a2562d0a359a93dffc41..6410d24913a4ad88416b445dbd87600eb352b6e5 100644 --- a/test/compile_errors/stage1/obj/unreachable_with_return.zig +++ b/test/compile_errors/stage1/obj/unreachable_with_return.zig @@ -1,6 +1,8 @@ fn a() noreturn {return;} export fn entry() void { a(); } -// unreachable with return +// error +// backend=stage1 +// target=native // // tmp.zig:1:18: error: expected type 'noreturn', found 'void' diff --git a/test/compile_errors/stage1/obj/unsupported_modifier_at_start_of_asm_output_constraint.zig b/test/compile_errors/stage1/obj/unsupported_modifier_at_start_of_asm_output_constraint.zig index c85850a61bfa99bec798e3ec5399d11c4d26df8f..7c70fc509528aa9ef19f024d606cf8c507f8457f 100644 --- a/test/compile_errors/stage1/obj/unsupported_modifier_at_start_of_asm_output_constraint.zig +++ b/test/compile_errors/stage1/obj/unsupported_modifier_at_start_of_asm_output_constraint.zig @@ -3,6 +3,8 @@ export fn foo() void { asm volatile ("" : [baz]"+r"(bar) : : ""); } -// unsupported modifier at start of asm output constraint +// error +// backend=stage1 +// target=native // // 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 diff --git a/test/compile_errors/stage1/obj/unused_variable_error_on_errdefer.zig b/test/compile_errors/stage1/obj/unused_variable_error_on_errdefer.zig index eb92776938819e7692342cead53c7fdc2cfbecab..b85d5729dcf8f62c23cdee35a1a3fa873ff42768 100644 --- a/test/compile_errors/stage1/obj/unused_variable_error_on_errdefer.zig +++ b/test/compile_errors/stage1/obj/unused_variable_error_on_errdefer.zig @@ -6,6 +6,8 @@ export fn entry() void { foo() catch unreachable; } -// unused variable error on errdefer +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: unused variable: 'a' diff --git a/test/compile_errors/stage1/obj/use_anyopaque_as_return_type_of_fn_ptr.zig b/test/compile_errors/stage1/obj/use_anyopaque_as_return_type_of_fn_ptr.zig index f54bc149142cb8f5689ea9501ac36b3fd4601962..ef2787ca75abc320a298bdabe29065ab350b2c48 100644 --- a/test/compile_errors/stage1/obj/use_anyopaque_as_return_type_of_fn_ptr.zig +++ b/test/compile_errors/stage1/obj/use_anyopaque_as_return_type_of_fn_ptr.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = a; } -// use anyopaque as return type of fn ptr +// error +// backend=stage1 +// target=native // // tmp.zig:2:20: error: return type cannot be opaque diff --git a/test/compile_errors/stage1/obj/use_implicit_casts_to_assign_null_to_non-nullable_pointer.zig b/test/compile_errors/stage1/obj/use_implicit_casts_to_assign_null_to_non-nullable_pointer.zig index a8e01dbde0a0925bd21b4a415bcfca03f988f61d..4263f38e3e8c56d9bc77513de039fef49060c39a 100644 --- a/test/compile_errors/stage1/obj/use_implicit_casts_to_assign_null_to_non-nullable_pointer.zig +++ b/test/compile_errors/stage1/obj/use_implicit_casts_to_assign_null_to_non-nullable_pointer.zig @@ -7,6 +7,8 @@ export fn entry() void { _ = y; } -// use implicit casts to assign null to non-nullable pointer +// error +// backend=stage1 +// target=native // // tmp.zig:4:23: error: expected type '*?*i32', found '**i32' diff --git a/test/compile_errors/stage1/obj/use_invalid_number_literal_as_array_index.zig b/test/compile_errors/stage1/obj/use_invalid_number_literal_as_array_index.zig index 5ec655737e4c0a29c8c2c3930cfa50828f1818de..b1d0aaa6f47ec8ccdd11f73a53d58ae8c351386c 100644 --- a/test/compile_errors/stage1/obj/use_invalid_number_literal_as_array_index.zig +++ b/test/compile_errors/stage1/obj/use_invalid_number_literal_as_array_index.zig @@ -4,6 +4,8 @@ export fn entry() void { _ = arr; } -// use invalid number literal as array index +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: unable to infer variable type diff --git a/test/compile_errors/stage1/obj/use_of_comptime-known_undefined_function_value.zig b/test/compile_errors/stage1/obj/use_of_comptime-known_undefined_function_value.zig index 5facc7e753ca1b11f882024c57cf3e4c9bfbf9d6..3500b13dfc21df3fa6fe0eab59da94cf47884da7 100644 --- a/test/compile_errors/stage1/obj/use_of_comptime-known_undefined_function_value.zig +++ b/test/compile_errors/stage1/obj/use_of_comptime-known_undefined_function_value.zig @@ -6,6 +6,8 @@ export fn entry() void { command.exec(); } -// use of comptime-known undefined function value +// error +// backend=stage1 +// target=native // // tmp.zig:6:12: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/use_of_undeclared_identifier.zig b/test/compile_errors/stage1/obj/use_of_undeclared_identifier.zig index e36453acc7836329be33dee3191089bf96940e47..c1297731a30de29d0538068a391507011a99c383 100644 --- a/test/compile_errors/stage1/obj/use_of_undeclared_identifier.zig +++ b/test/compile_errors/stage1/obj/use_of_undeclared_identifier.zig @@ -2,6 +2,8 @@ export fn f() void { b = 3; } -// use of undeclared identifier +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: use of undeclared identifier 'b' diff --git a/test/compile_errors/stage1/obj/using_an_unknown_len_ptr_type_instead_of_array.zig b/test/compile_errors/stage1/obj/using_an_unknown_len_ptr_type_instead_of_array.zig index 983995b0981cd1b09c4603bfef923d3839feb768..3124b057a81d365e0bf47552bc15be21f8d14bf3 100644 --- a/test/compile_errors/stage1/obj/using_an_unknown_len_ptr_type_instead_of_array.zig +++ b/test/compile_errors/stage1/obj/using_an_unknown_len_ptr_type_instead_of_array.zig @@ -6,6 +6,8 @@ comptime { _ = resolutions; } -// using an unknown len ptr type instead of array +// error +// backend=stage1 +// target=native // // tmp.zig:1:21: error: expected array type or [_], found '[*][*]const u8' diff --git a/test/compile_errors/stage1/obj/using_invalid_types_in_function_call_raises_an_error.zig b/test/compile_errors/stage1/obj/using_invalid_types_in_function_call_raises_an_error.zig index 182b5c59b05cb85ba8858502798a656d4fa32da1..f1fda15ea75a7395f3f9316fbf7ccda770c02fe8 100644 --- a/test/compile_errors/stage1/obj/using_invalid_types_in_function_call_raises_an_error.zig +++ b/test/compile_errors/stage1/obj/using_invalid_types_in_function_call_raises_an_error.zig @@ -4,6 +4,8 @@ export fn entry() void { func(MenuEffect.ThisDoesNotExist); } -// using invalid types in function call raises an error +// error +// backend=stage1 +// target=native // // tmp.zig:1:20: error: enum declarations must have at least one tag diff --git a/test/compile_errors/stage1/obj/usingnamespace_with_wrong_type.zig b/test/compile_errors/stage1/obj/usingnamespace_with_wrong_type.zig index a74a8e61243032a68a3747e698bc8a94566818c3..86b5f0dcfb3daa295b711d20871b595b68a75331 100644 --- a/test/compile_errors/stage1/obj/usingnamespace_with_wrong_type.zig +++ b/test/compile_errors/stage1/obj/usingnamespace_with_wrong_type.zig @@ -1,5 +1,7 @@ usingnamespace void; -// usingnamespace with wrong type +// error +// backend=stage1 +// target=native // // tmp.zig:1:1: error: expected struct, enum, or union; found 'void' diff --git a/test/compile_errors/stage1/obj/variable_has_wrong_type.zig b/test/compile_errors/stage1/obj/variable_has_wrong_type.zig index 1e20dde26954a6c7f8a9974bece00baae8f0afc0..52dcf150de0e57ad064cc6c702a9d06d221e06e7 100644 --- a/test/compile_errors/stage1/obj/variable_has_wrong_type.zig +++ b/test/compile_errors/stage1/obj/variable_has_wrong_type.zig @@ -3,6 +3,8 @@ export fn f() i32 { return a; } -// variable has wrong type +// error +// backend=stage1 +// target=native // // tmp.zig:3:12: error: expected type 'i32', found '*const [1:0]u8' diff --git a/test/compile_errors/stage1/obj/variable_in_inline_assembly_template_cannot_be_found.zig b/test/compile_errors/stage1/obj/variable_in_inline_assembly_template_cannot_be_found.zig new file mode 100644 index 0000000000000000000000000000000000000000..7636b501fd0237702050f200014cd065a85a602c --- /dev/null +++ b/test/compile_errors/stage1/obj/variable_in_inline_assembly_template_cannot_be_found.zig @@ -0,0 +1,12 @@ +export fn entry() void { + var sp = asm volatile ("mov %[foo], sp" + : [bar] "=r" (-> usize), + ); + _ = sp; +} + +// error +// backend=stage1 +// target=x86_64-linux-gnu +// +// tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs diff --git a/test/compile_errors/stage1/obj/variable_initialization_compile_error_then_referenced.zig b/test/compile_errors/stage1/obj/variable_initialization_compile_error_then_referenced.zig index d96b67bc3f249fba585a8fb4fd2a574b2baec065..91b70481a1955cb6c9b77f59e502c1ca1ca7406c 100644 --- a/test/compile_errors/stage1/obj/variable_initialization_compile_error_then_referenced.zig +++ b/test/compile_errors/stage1/obj/variable_initialization_compile_error_then_referenced.zig @@ -12,6 +12,8 @@ export fn entry() void { _ = S; } -// variable initialization compile error then referenced +// error +// backend=stage1 +// target=native // // tmp.zig:2:12: error: use of undeclared identifier 'T' diff --git a/test/compile_errors/stage1/obj/variable_with_type_noreturn.zig b/test/compile_errors/stage1/obj/variable_with_type_noreturn.zig index b6cc65593bd3f5ec33076d27bb997b1e066107a6..e2ba9183be83259ca69bc9f3fe4309189c59ffbe 100644 --- a/test/compile_errors/stage1/obj/variable_with_type_noreturn.zig +++ b/test/compile_errors/stage1/obj/variable_with_type_noreturn.zig @@ -2,7 +2,9 @@ export fn entry9() void { var z: noreturn = return; } -// variable with type 'noreturn' +// error +// backend=stage1 +// target=native // // tmp.zig:2:5: error: unreachable code // tmp.zig:2:23: note: control flow is diverted here diff --git a/test/compile_errors/stage1/obj/vector_index_out_of_bounds.zig b/test/compile_errors/stage1/obj/vector_index_out_of_bounds.zig index efdd8b5fe98e482b0d4226e3fe264e11568b0a9c..fdffd8b45567777d9dc61263f24a724d019a9431 100644 --- a/test/compile_errors/stage1/obj/vector_index_out_of_bounds.zig +++ b/test/compile_errors/stage1/obj/vector_index_out_of_bounds.zig @@ -3,6 +3,8 @@ export fn entry() void { _ = x; } -// vector index out of bounds +// error +// backend=stage1 +// target=native // // tmp.zig:2:62: error: index 3 outside vector of size 3 diff --git a/test/compile_errors/stage1/obj/volatile_on_global_assembly.zig b/test/compile_errors/stage1/obj/volatile_on_global_assembly.zig index 8fc7ddfcc2d3153130f40b129021481e68d92bf5..2157fe6a71f5f1542665f595bd7ba9b17350d658 100644 --- a/test/compile_errors/stage1/obj/volatile_on_global_assembly.zig +++ b/test/compile_errors/stage1/obj/volatile_on_global_assembly.zig @@ -2,6 +2,8 @@ comptime { asm volatile (""); } -// volatile on global assembly +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: volatile is meaningless on global assembly diff --git a/test/compile_errors/stage1/obj/wasmMemoryGrow_is_a_compile_error_in_non-Wasm_targets.zig b/test/compile_errors/stage1/obj/wasmMemoryGrow_is_a_compile_error_in_non-Wasm_targets.zig index 363b36a0af084145cb79f59d020cdf04ca0a5ca0..6eda076f1228d801fabb8332ebf29ab7aa206c68 100644 --- a/test/compile_errors/stage1/obj/wasmMemoryGrow_is_a_compile_error_in_non-Wasm_targets.zig +++ b/test/compile_errors/stage1/obj/wasmMemoryGrow_is_a_compile_error_in_non-Wasm_targets.zig @@ -3,6 +3,8 @@ export fn foo() void { return; } -// wasmMemoryGrow is a compile error in non-Wasm targets +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: @wasmMemoryGrow is a wasm32 feature only diff --git a/test/compile_errors/stage1/obj/wasmMemorySize_is_a_compile_error_in_non-Wasm_targets.zig b/test/compile_errors/stage1/obj/wasmMemorySize_is_a_compile_error_in_non-Wasm_targets.zig index 419173bd01195d23ad04fb1a79486400c42a4776..9bdf81073f755cf1f8365da1e3a08548104de45c 100644 --- a/test/compile_errors/stage1/obj/wasmMemorySize_is_a_compile_error_in_non-Wasm_targets.zig +++ b/test/compile_errors/stage1/obj/wasmMemorySize_is_a_compile_error_in_non-Wasm_targets.zig @@ -3,6 +3,8 @@ export fn foo() void { return; } -// wasmMemorySize is a compile error in non-Wasm targets +// error +// backend=stage1 +// target=native // // tmp.zig:2:9: error: @wasmMemorySize is a wasm32 feature only diff --git a/test/compile_errors/stage1/obj/while_expected_bool_got_error_union.zig b/test/compile_errors/stage1/obj/while_expected_bool_got_error_union.zig index e79296694d3221f11aacfa29e9d775230e4b935b..9fc327e6c9b24a4052063387e1406b6f38dc1b73 100644 --- a/test/compile_errors/stage1/obj/while_expected_bool_got_error_union.zig +++ b/test/compile_errors/stage1/obj/while_expected_bool_got_error_union.zig @@ -3,6 +3,8 @@ export fn foo() void { } fn bar() anyerror!i32 { return 1; } -// while expected bool, got error union +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expected type 'bool', found 'anyerror!i32' diff --git a/test/compile_errors/stage1/obj/while_expected_bool_got_optional.zig b/test/compile_errors/stage1/obj/while_expected_bool_got_optional.zig index 7a3d184a1d771d26ab91ccb8a009debc1cb3a529..5948d627867a3b3f7dd97a58d2de58d1bbca4f91 100644 --- a/test/compile_errors/stage1/obj/while_expected_bool_got_optional.zig +++ b/test/compile_errors/stage1/obj/while_expected_bool_got_optional.zig @@ -3,6 +3,8 @@ export fn foo() void { } fn bar() ?i32 { return 1; } -// while expected bool, got optional +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expected type 'bool', found '?i32' diff --git a/test/compile_errors/stage1/obj/while_expected_error_union_got_bool.zig b/test/compile_errors/stage1/obj/while_expected_error_union_got_bool.zig index 8f92276af65949080c13889ac3d068db82ef8113..b8a72e97937e454aa404e0c744fef8549d33d4ce 100644 --- a/test/compile_errors/stage1/obj/while_expected_error_union_got_bool.zig +++ b/test/compile_errors/stage1/obj/while_expected_error_union_got_bool.zig @@ -3,6 +3,8 @@ export fn foo() void { } fn bar() bool { return true; } -// while expected error union, got bool +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expected error union type, found 'bool' diff --git a/test/compile_errors/stage1/obj/while_expected_error_union_got_optional.zig b/test/compile_errors/stage1/obj/while_expected_error_union_got_optional.zig index a67bf1ae1642f1001f11ec88f8feecc012caf222..c933dc95092aa2bc4637f9dd9498cfe8771496a1 100644 --- a/test/compile_errors/stage1/obj/while_expected_error_union_got_optional.zig +++ b/test/compile_errors/stage1/obj/while_expected_error_union_got_optional.zig @@ -3,6 +3,8 @@ export fn foo() void { } fn bar() ?i32 { return 1; } -// while expected error union, got optional +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expected error union type, found '?i32' diff --git a/test/compile_errors/stage1/obj/while_expected_optional_got_bool.zig b/test/compile_errors/stage1/obj/while_expected_optional_got_bool.zig index 6fc0d880ce6d67c9d458fb9ff45274fc061ad4dd..0458d1ba0179951341bfbbf6e2d78df4ab315a02 100644 --- a/test/compile_errors/stage1/obj/while_expected_optional_got_bool.zig +++ b/test/compile_errors/stage1/obj/while_expected_optional_got_bool.zig @@ -3,6 +3,8 @@ export fn foo() void { } fn bar() bool { return true; } -// while expected optional, got bool +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expected optional type, found 'bool' diff --git a/test/compile_errors/stage1/obj/while_expected_optional_got_error_union.zig b/test/compile_errors/stage1/obj/while_expected_optional_got_error_union.zig index 472b3b81bc61c0dd685fbb7f2d6993230a74d92a..7cdbd2cccf69ad800659f21f13eabaa6177f6757 100644 --- a/test/compile_errors/stage1/obj/while_expected_optional_got_error_union.zig +++ b/test/compile_errors/stage1/obj/while_expected_optional_got_error_union.zig @@ -3,6 +3,8 @@ export fn foo() void { } fn bar() anyerror!i32 { return 1; } -// while expected optional, got error union +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expected optional type, found 'anyerror!i32' diff --git a/test/compile_errors/stage1/obj/while_loop_body_expression_ignored.zig b/test/compile_errors/stage1/obj/while_loop_body_expression_ignored.zig index 621c0d41d7ee32d5edf4c57d9ed728a903eb6f9c..9542cbc62f00cb6e3473f6b546ac06c9ac82f0b4 100644 --- a/test/compile_errors/stage1/obj/while_loop_body_expression_ignored.zig +++ b/test/compile_errors/stage1/obj/while_loop_body_expression_ignored.zig @@ -13,7 +13,9 @@ export fn f3() void { while (x) |_| returns() else |_| unreachable; } -// while loop body expression ignored +// error +// backend=stage1 +// target=native // // tmp.zig:5:25: error: expression value is ignored // tmp.zig:9:26: error: expression value is ignored diff --git a/test/compile_errors/stage1/obj/write_to_const_global_variable.zig b/test/compile_errors/stage1/obj/write_to_const_global_variable.zig index 327b3d02d02fc8b7c48766bbba1dbe5e11f70889..4ce93e6b519fe0f52971bb42b3bb44b8908daa9c 100644 --- a/test/compile_errors/stage1/obj/write_to_const_global_variable.zig +++ b/test/compile_errors/stage1/obj/write_to_const_global_variable.zig @@ -4,6 +4,8 @@ fn f() void { } export fn entry() void { f(); } -// write to const global variable +// error +// backend=stage1 +// target=native // // tmp.zig:3:9: error: cannot assign to constant diff --git a/test/compile_errors/stage1/obj/wrong_frame_type_used_for_async_call.zig b/test/compile_errors/stage1/obj/wrong_frame_type_used_for_async_call.zig index ba150c45cc4fed8d3792394797bb0ece3bfcebf3..c02c20f495d8760272493a144f2054264cf474f6 100644 --- a/test/compile_errors/stage1/obj/wrong_frame_type_used_for_async_call.zig +++ b/test/compile_errors/stage1/obj/wrong_frame_type_used_for_async_call.zig @@ -9,6 +9,8 @@ fn bar() void { suspend {} } -// wrong frame type used for async call +// error +// backend=stage1 +// target=native // // tmp.zig:3:13: error: expected type '*@Frame(bar)', found '*@Frame(foo)' diff --git a/test/compile_errors/stage1/obj/wrong_function_type.zig b/test/compile_errors/stage1/obj/wrong_function_type.zig index c2238bb64974f7cc01f354385ecd462384a48e87..58f4477601d3fe33c7d688e8597adff387a5641c 100644 --- a/test/compile_errors/stage1/obj/wrong_function_type.zig +++ b/test/compile_errors/stage1/obj/wrong_function_type.zig @@ -4,6 +4,8 @@ fn b() i32 {return 1;} fn c() i32 {return 2;} export fn entry() usize { return @sizeOf(@TypeOf(fns)); } -// wrong function type +// error +// backend=stage1 +// target=native // // tmp.zig:1:28: error: expected type 'fn() void', found 'fn() i32' diff --git a/test/compile_errors/stage1/obj/wrong_initializer_for_union_payload_of_type_type.zig b/test/compile_errors/stage1/obj/wrong_initializer_for_union_payload_of_type_type.zig index 1d56094b6d4e59499a97ac333ed6c50ec0771db4..2e7b8f2e40ac0f918a473303c60fd78a0778d7bd 100644 --- a/test/compile_errors/stage1/obj/wrong_initializer_for_union_payload_of_type_type.zig +++ b/test/compile_errors/stage1/obj/wrong_initializer_for_union_payload_of_type_type.zig @@ -9,6 +9,8 @@ export fn entry() void { v.u.A = U{ .A = i32 }; } -// wrong initializer for union payload of type 'type' +// error +// backend=stage1 +// target=native // // tmp.zig:9:8: error: use of undefined value here causes undefined behavior diff --git a/test/compile_errors/stage1/obj/wrong_number_of_arguments.zig b/test/compile_errors/stage1/obj/wrong_number_of_arguments.zig index 4cb13fdd12f2d852d138f9c9078b95c271185a5e..f25c9dae083d800541c3dec579c466a504fd04cb 100644 --- a/test/compile_errors/stage1/obj/wrong_number_of_arguments.zig +++ b/test/compile_errors/stage1/obj/wrong_number_of_arguments.zig @@ -3,6 +3,8 @@ export fn a() void { } fn c(d: i32, e: i32, f: i32) void { _ = d; _ = e; _ = f; } -// wrong number of arguments +// error +// backend=stage1 +// target=native // // tmp.zig:2:6: error: expected 3 argument(s), found 1 diff --git a/test/compile_errors/stage1/obj/wrong_number_of_arguments_for_method_fn_call.zig b/test/compile_errors/stage1/obj/wrong_number_of_arguments_for_method_fn_call.zig index 25449feb22e668638fff1ae63aa6157c66f35f04..7371223863c0f43a33a8bd1ae068053cbd691e32 100644 --- a/test/compile_errors/stage1/obj/wrong_number_of_arguments_for_method_fn_call.zig +++ b/test/compile_errors/stage1/obj/wrong_number_of_arguments_for_method_fn_call.zig @@ -7,6 +7,8 @@ fn f(foo: *const Foo) void { } export fn entry() usize { return @sizeOf(@TypeOf(f)); } -// wrong number of arguments for method fn call +// error +// backend=stage1 +// target=native // // tmp.zig:6:15: error: expected 2 argument(s), found 3 diff --git a/test/compile_errors/stage1/obj/wrong_panic_signature_generic_function.zig b/test/compile_errors/stage1/obj/wrong_panic_signature_generic_function.zig index faaa24ba60affc935b5ea4719645435a02aa6272..45de2fc6cbc56d23259efb73993207e1c44841a5 100644 --- a/test/compile_errors/stage1/obj/wrong_panic_signature_generic_function.zig +++ b/test/compile_errors/stage1/obj/wrong_panic_signature_generic_function.zig @@ -4,7 +4,9 @@ pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace) } const builtin = @import("std").builtin; -// wrong panic signature, generic function +// error +// backend=stage1 +// target=native // // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype' // note: only one of the functions is generic diff --git a/test/compile_errors/stage1/obj/wrong_panic_signature_runtime_function.zig b/test/compile_errors/stage1/obj/wrong_panic_signature_runtime_function.zig index 92553c3104430b34ee8ea765c42c86994b1c9bce..5cf224c4a8d8fb8fcc1b380d8995b348d0efdfe4 100644 --- a/test/compile_errors/stage1/obj/wrong_panic_signature_runtime_function.zig +++ b/test/compile_errors/stage1/obj/wrong_panic_signature_runtime_function.zig @@ -3,6 +3,8 @@ test "" {} pub fn panic() void {} -// wrong panic signature, runtime function +// error +// backend=stage1 +// target=native // // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn() void' diff --git a/test/compile_errors/stage1/obj/wrong_pointer_coerced_to_pointer_to_opaque_{}.zig b/test/compile_errors/stage1/obj/wrong_pointer_coerced_to_pointer_to_opaque_{}.zig index ed88e3be288f591fd0c3c8a78c5ba5227fedc1ea..3f6b0e750bd7ecfef3f70d548b102e06a431ef23 100644 --- a/test/compile_errors/stage1/obj/wrong_pointer_coerced_to_pointer_to_opaque_{}.zig +++ b/test/compile_errors/stage1/obj/wrong_pointer_coerced_to_pointer_to_opaque_{}.zig @@ -5,6 +5,8 @@ export fn foo() void { bar(@ptrCast(*anyopaque, &x)); } -// wrong pointer coerced to pointer to opaque {} +// error +// backend=stage1 +// target=native // // tmp.zig:5:9: error: expected type '*Derp', found '*anyopaque' diff --git a/test/compile_errors/stage1/obj/wrong_return_type_for_main.zig b/test/compile_errors/stage1/obj/wrong_return_type_for_main.zig index bf335874db8c8b71a55aaf3a0b53a22b1dfc8004..218ef0b65d254c68884b6c9f8032874ccbddce9c 100644 --- a/test/compile_errors/stage1/obj/wrong_return_type_for_main.zig +++ b/test/compile_errors/stage1/obj/wrong_return_type_for_main.zig @@ -1,5 +1,7 @@ pub fn main() f32 { } -// wrong return type for main +// error +// backend=stage1 +// target=native // // error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8' diff --git a/test/compile_errors/stage1/obj/wrong_size_to_an_array_literal.zig b/test/compile_errors/stage1/obj/wrong_size_to_an_array_literal.zig index 68cb2632127691c4618809b9a0bcef4b1839385f..909d89458728e960b4034e434ddf2844e8a3ca9a 100644 --- a/test/compile_errors/stage1/obj/wrong_size_to_an_array_literal.zig +++ b/test/compile_errors/stage1/obj/wrong_size_to_an_array_literal.zig @@ -3,6 +3,8 @@ comptime { _ = array; } -// wrong size to an array literal +// error +// backend=stage1 +// target=native // // tmp.zig:2:31: error: index 2 outside array of size 2 diff --git a/test/compile_errors/stage1/obj/wrong_type_for_argument_tuple_to_asyncCall.zig b/test/compile_errors/stage1/obj/wrong_type_for_argument_tuple_to_asyncCall.zig index d9e45a69b7f440dce32cd2e2bf6aaabb9d062f85..7a9be0a8cc6e9123a0beb597d4be2683aa7546ff 100644 --- a/test/compile_errors/stage1/obj/wrong_type_for_argument_tuple_to_asyncCall.zig +++ b/test/compile_errors/stage1/obj/wrong_type_for_argument_tuple_to_asyncCall.zig @@ -7,6 +7,8 @@ fn foo() i32 { return 0; } -// wrong type for argument tuple to @asyncCall +// error +// backend=stage1 +// target=native // // tmp.zig:3:33: error: expected tuple or struct, found 'void' diff --git a/test/compile_errors/stage1/obj/wrong_type_for_reify_type.zig b/test/compile_errors/stage1/obj/wrong_type_for_reify_type.zig index 2d8ea02326640b246762986d3db52fec47e13ced..b0c1d92659d8c73fa2656ad280b0c66829876d7d 100644 --- a/test/compile_errors/stage1/obj/wrong_type_for_reify_type.zig +++ b/test/compile_errors/stage1/obj/wrong_type_for_reify_type.zig @@ -2,6 +2,8 @@ export fn entry() void { _ = @Type(0); } -// wrong type for @Type +// error +// backend=stage1 +// target=native // // tmp.zig:2:15: error: expected type 'std.builtin.Type', found 'comptime_int' diff --git a/test/compile_errors/stage1/obj/wrong_type_for_result_ptr_to_asyncCall.zig b/test/compile_errors/stage1/obj/wrong_type_for_result_ptr_to_asyncCall.zig index 07c5ae8a0b651f58ee50d0273b263c0f637e73be..b4193d4de11d50385900de8afa2b18c4ee2d3f74 100644 --- a/test/compile_errors/stage1/obj/wrong_type_for_result_ptr_to_asyncCall.zig +++ b/test/compile_errors/stage1/obj/wrong_type_for_result_ptr_to_asyncCall.zig @@ -9,6 +9,8 @@ fn foo() i32 { return 1234; } -// wrong type for result ptr to @asyncCall +// error +// backend=stage1 +// target=native // // tmp.zig:6:37: error: expected type '*i32', found 'bool' diff --git a/test/compile_errors/stage1/obj/wrong_type_passed_to_panic.zig b/test/compile_errors/stage1/obj/wrong_type_passed_to_panic.zig index b16d563571e7ed6fe88ec256ddb4da3f4d1a4ef3..ed237f81dfcee0c19e9ab3c0042323b3ae03bcae 100644 --- a/test/compile_errors/stage1/obj/wrong_type_passed_to_panic.zig +++ b/test/compile_errors/stage1/obj/wrong_type_passed_to_panic.zig @@ -3,6 +3,8 @@ export fn entry() void { @panic(e); } -// wrong type passed to @panic +// error +// backend=stage1 +// target=native // // tmp.zig:3:12: error: expected type '[]const u8', found 'error{Foo}' diff --git a/test/compile_errors/stage1/obj/wrong_type_to_hasField.zig b/test/compile_errors/stage1/obj/wrong_type_to_hasField.zig index a79fec2a218df2ac24a58c2b023362e73b3976ed..680c19a6fbaa10e038d56f89bd6b63efb8cbfd7a 100644 --- a/test/compile_errors/stage1/obj/wrong_type_to_hasField.zig +++ b/test/compile_errors/stage1/obj/wrong_type_to_hasField.zig @@ -2,6 +2,8 @@ export fn entry() bool { return @hasField(i32, "hi"); } -// wrong type to @hasField +// error +// backend=stage1 +// target=native // // tmp.zig:2:22: error: type 'i32' does not support @hasField diff --git a/test/compile_errors/stage1/obj/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig b/test/compile_errors/stage1/obj/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig index 47cdaa372f1c76e307b5bdfebe6c736ab77f445d..b0f484e2fd07868c7d4f11ffa5a1227e611bce46 100644 --- a/test/compile_errors/stage1/obj/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig +++ b/test/compile_errors/stage1/obj/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig @@ -3,6 +3,8 @@ export fn entry() void { while (!@cmpxchgWeak(i32, &x, 1234, 5678, @as(u32, 1234), @as(u32, 1234))) {} } -// wrong types given to atomic order args in cmpxchg +// error +// backend=stage1 +// target=native // // tmp.zig:3:47: error: expected type 'std.builtin.AtomicOrder', found 'u32' diff --git a/test/compile_errors/stage1/obj/wrong_types_given_to_export.zig b/test/compile_errors/stage1/obj/wrong_types_given_to_export.zig index cdd7ab46313a54bcc7000d409f25a931976ff750..c06116204f00b04abc3b4b4da4dd941d130f48c4 100644 --- a/test/compile_errors/stage1/obj/wrong_types_given_to_export.zig +++ b/test/compile_errors/stage1/obj/wrong_types_given_to_export.zig @@ -3,6 +3,8 @@ comptime { @export(entry, .{.name = "entry", .linkage = @as(u32, 1234) }); } -// wrong types given to @export +// error +// backend=stage1 +// target=native // // tmp.zig:3:59: error: expected type 'std.builtin.GlobalLinkage', found 'comptime_int' diff --git a/test/compile_errors/stage1/test/access_invalid_typeInfo_decl.zig b/test/compile_errors/stage1/test/access_invalid_typeInfo_decl.zig index 2fc5730af02b6d08197133d049a4df1906dd98e6..40e31a085505b75ca9b0842868bf5f8c2bdb5e85 100644 --- a/test/compile_errors/stage1/test/access_invalid_typeInfo_decl.zig +++ b/test/compile_errors/stage1/test/access_invalid_typeInfo_decl.zig @@ -3,6 +3,9 @@ test "Crash" { _ = @typeInfo(@This()).Struct.decls[0]; } -// access invalid @typeInfo decl +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:1:11: error: use of undeclared identifier 'B' diff --git a/test/compile_errors/stage1/test/alignCast_of_zero_sized_types.zig b/test/compile_errors/stage1/test/alignCast_of_zero_sized_types.zig index 4c05571202b48c5ee09381bd9d0b1704028d8a97..f83d22759cac095e9052141c74b10b7c11b49cef 100644 --- a/test/compile_errors/stage1/test/alignCast_of_zero_sized_types.zig +++ b/test/compile_errors/stage1/test/alignCast_of_zero_sized_types.zig @@ -17,7 +17,10 @@ export fn qux() void { _ = @alignCast(2, a); } -// @alignCast of zero sized types +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:23: error: cannot adjust alignment of zero sized type '*void' // tmp.zig:7:23: error: cannot adjust alignment of zero sized type '?*void' diff --git a/test/compile_errors/stage1/test/bad_splat_type.zig b/test/compile_errors/stage1/test/bad_splat_type.zig index 9a16bbc73d88de9b6ce199f4f529e0e0d623bf3d..94e3d052a6cd8b2de19c239b1aa3e9f65c6d1df2 100644 --- a/test/compile_errors/stage1/test/bad_splat_type.zig +++ b/test/compile_errors/stage1/test/bad_splat_type.zig @@ -4,6 +4,9 @@ export fn entry() void { _ = v; } -// bad @splat type +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; 'comptime_int' is invalid diff --git a/test/compile_errors/stage1/test/binary_OR_operator_on_error_sets.zig b/test/compile_errors/stage1/test/binary_OR_operator_on_error_sets.zig index d9894a32a040c5b8e23280d0bf4951c40a810881..eb2d21c6eddcc44b2e9571dff3f19ec9cb9e67ff 100644 --- a/test/compile_errors/stage1/test/binary_OR_operator_on_error_sets.zig +++ b/test/compile_errors/stage1/test/binary_OR_operator_on_error_sets.zig @@ -5,6 +5,9 @@ export fn entry() void { _ = x; } -// binary OR operator on error sets +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:2:18: error: invalid operands to binary expression: 'error{A}' and 'error{B}' diff --git a/test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-always_inline.zig b/test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-always_inline.zig index ea822f8d915ce67a15d433f3fb90c6af8c7917a1..a010414a57ad349bf2b9065ddc4f08d29c6491fe 100644 --- a/test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-always_inline.zig +++ b/test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-always_inline.zig @@ -3,6 +3,9 @@ pub export fn entry() void { @call(.{ .modifier = .always_inline }, call_me, .{}); } -// @call rejects non comptime-known fn - always_inline +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:5: error: the specified modifier requires a comptime-known function diff --git a/test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-compile_time.zig b/test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-compile_time.zig index 3c50830787ab442a95ae556b3f39550c6a394137..b3ffcc6ec2bb77169efd68539817c9f80e7b6e11 100644 --- a/test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-compile_time.zig +++ b/test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-compile_time.zig @@ -3,6 +3,9 @@ pub export fn entry() void { @call(.{ .modifier = .compile_time }, call_me, .{}); } -// @call rejects non comptime-known fn - compile_time +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:5: error: the specified modifier requires a comptime-known function diff --git a/test/compile_errors/stage1/test/cast_between_optional_T_where_T_is_not_a_pointer.zig b/test/compile_errors/stage1/test/cast_between_optional_T_where_T_is_not_a_pointer.zig index 8f5ca1c25dea130aaed32ec80e48a1557414e599..b8392ff5db5ce80306a649fd4486c2bfdde3e606 100644 --- a/test/compile_errors/stage1/test/cast_between_optional_T_where_T_is_not_a_pointer.zig +++ b/test/compile_errors/stage1/test/cast_between_optional_T_where_T_is_not_a_pointer.zig @@ -6,7 +6,10 @@ export fn entry() void { a = b; } -// cast between ?T where T is not a pointer +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:6:9: error: expected type '?fn(i8) void', found '?fn(u64) void' // tmp.zig:6:9: note: optional type child 'fn(u64) void' cannot cast into optional type child 'fn(i8) void' diff --git a/test/compile_errors/stage1/test/combination_of_nosuspend_and_async.zig b/test/compile_errors/stage1/test/combination_of_nosuspend_and_async.zig index a164fb621b234dbd66a6226b1ed0b9f462448110..43731c964861741e99c353de416ed6b7c4544d4f 100644 --- a/test/compile_errors/stage1/test/combination_of_nosuspend_and_async.zig +++ b/test/compile_errors/stage1/test/combination_of_nosuspend_and_async.zig @@ -7,7 +7,10 @@ export fn entry() void { } fn foo() void {} -// combination of nosuspend and async +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:4:9: error: suspend inside nosuspend block // tmp.zig:2:5: note: nosuspend block here diff --git a/test/compile_errors/stage1/test/comparison_of_non-tagged_union_and_enum_literal.zig b/test/compile_errors/stage1/test/comparison_of_non-tagged_union_and_enum_literal.zig index b3c15067057942f8249fa22e9d1995aed8def1ab..4898ac744ca97c646e04cb59ea1c9fce85ada31b 100644 --- a/test/compile_errors/stage1/test/comparison_of_non-tagged_union_and_enum_literal.zig +++ b/test/compile_errors/stage1/test/comparison_of_non-tagged_union_and_enum_literal.zig @@ -5,7 +5,10 @@ export fn entry() void { _ = ok; } -// comparison of non-tagged union and enum literal +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:4:16: error: comparison of union and enum literal is only valid for tagged union types // tmp.zig:2:15: note: type U is not a tagged union diff --git a/test/compile_errors/stage1/test/comptime_vector_overflow_shows_the_index.zig b/test/compile_errors/stage1/test/comptime_vector_overflow_shows_the_index.zig index a638c05b3bf37878006157d50a38ee86b003617d..a1f026ab70ca4ea344aa7ea8a213e83fde32ca74 100644 --- a/test/compile_errors/stage1/test/comptime_vector_overflow_shows_the_index.zig +++ b/test/compile_errors/stage1/test/comptime_vector_overflow_shows_the_index.zig @@ -5,7 +5,10 @@ comptime { _ = x; } -// comptime vector overflow shows the index +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:4:15: error: operation caused overflow // tmp.zig:4:15: note: when computing vector element at index 2 diff --git a/test/compile_errors/stage1/test/duplicate_field_in_anonymous_struct_literal.zig b/test/compile_errors/stage1/test/duplicate_field_in_anonymous_struct_literal.zig index 1b671d2ad3213a2f138102e31050b0f87f238ce4..7b6821d6691b97ce557be4041f0ce1de220c2453 100644 --- a/test/compile_errors/stage1/test/duplicate_field_in_anonymous_struct_literal.zig +++ b/test/compile_errors/stage1/test/duplicate_field_in_anonymous_struct_literal.zig @@ -10,7 +10,10 @@ export fn entry() void { _ = anon; } -// duplicate field in anonymous struct literal +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:7:13: error: duplicate field // tmp.zig:4:13: note: other field here diff --git a/test/compile_errors/stage1/test/error_in_struct_initializer_doesnt_crash_the_compiler.zig b/test/compile_errors/stage1/test/error_in_struct_initializer_doesnt_crash_the_compiler.zig index e37b887121fe0af5fa3d98de89bcfd385b0f3c48..2858fd6a0115c33210172a4e34d6bf0548260e39 100644 --- a/test/compile_errors/stage1/test/error_in_struct_initializer_doesnt_crash_the_compiler.zig +++ b/test/compile_errors/stage1/test/error_in_struct_initializer_doesnt_crash_the_compiler.zig @@ -7,6 +7,9 @@ pub export fn entry() void { _ = a; } -// error in struct initializer doesn't crash the compiler +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:4:9: error: duplicate struct field: 'e' diff --git a/test/compile_errors/stage1/test/errors_in_for_loop_bodies_are_propagated.zig b/test/compile_errors/stage1/test/errors_in_for_loop_bodies_are_propagated.zig index 32e99cf4106df948fc536c769ae8463dab12e5ca..d8be29e39b453032ffd09d38c2452bd88b13eaac 100644 --- a/test/compile_errors/stage1/test/errors_in_for_loop_bodies_are_propagated.zig +++ b/test/compile_errors/stage1/test/errors_in_for_loop_bodies_are_propagated.zig @@ -3,6 +3,9 @@ pub export fn entry() void { for (arr) |bits| _ = @popCount(bits); } -// errors in for loop bodies are propagated +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:26: error: expected 2 arguments, found 1 diff --git a/test/compile_errors/stage1/test/export_with_empty_name_string.zig b/test/compile_errors/stage1/test/export_with_empty_name_string.zig index 424ee6e4b5effd5b44ae7ba09d04787fb9e71fc1..b882d11723afefc50ae5d605b36e200276b82525 100644 --- a/test/compile_errors/stage1/test/export_with_empty_name_string.zig +++ b/test/compile_errors/stage1/test/export_with_empty_name_string.zig @@ -3,6 +3,9 @@ comptime { @export(entry, .{ .name = "" }); } -// @export with empty name string +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:5: error: exported symbol name cannot be empty diff --git a/test/compile_errors/stage1/test/helpful_return_type_error_message.zig b/test/compile_errors/stage1/test/helpful_return_type_error_message.zig index 6f1f9639da60e0af9eddcc254b6eb0835667105c..0e97c09de210885dac3f8b91ba4897b817007fbc 100644 --- a/test/compile_errors/stage1/test/helpful_return_type_error_message.zig +++ b/test/compile_errors/stage1/test/helpful_return_type_error_message.zig @@ -15,7 +15,10 @@ export fn quux() u32 { buf = bar(); } -// helpful return type error message +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}' // tmp.zig:1:17: note: function cannot return an error diff --git a/test/compile_errors/stage1/test/int-float_conversion_to_comptime_int-float.zig b/test/compile_errors/stage1/test/int-float_conversion_to_comptime_int-float.zig index eeb2e4798efd58e72fff750534ae56fefade8f4e..de439168ae36788f367d1ceeb70d3cad065c4f19 100644 --- a/test/compile_errors/stage1/test/int-float_conversion_to_comptime_int-float.zig +++ b/test/compile_errors/stage1/test/int-float_conversion_to_comptime_int-float.zig @@ -7,7 +7,10 @@ export fn bar() void { _ = @intToFloat(comptime_float, a); } -// int/float conversion to comptime_int/float +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:35: error: unable to evaluate constant expression // tmp.zig:7:37: error: unable to evaluate constant expression diff --git a/test/compile_errors/stage1/test/invalid_assignments.zig b/test/compile_errors/stage1/test/invalid_assignments.zig index 203784c554ac4c8762f3336178bcb45e7d231e92..75f45a8bcb94e526334a65f466beb80ceb625a07 100644 --- a/test/compile_errors/stage1/test/invalid_assignments.zig +++ b/test/compile_errors/stage1/test/invalid_assignments.zig @@ -10,7 +10,10 @@ export fn entry4() void { 2 + 2 = 3; } -// invalid assignments +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:6: error: invalid left-hand side to assignment // tmp.zig:7:7: error: invalid left-hand side to assignment diff --git a/test/compile_errors/stage1/test/invalid_float_casts.zig b/test/compile_errors/stage1/test/invalid_float_casts.zig index 0e2509dcaf4b190cd690abd5bd3b0858bebd8c15..2fe8003728e0e74131f66725c2b596f5f0151d50 100644 --- a/test/compile_errors/stage1/test/invalid_float_casts.zig +++ b/test/compile_errors/stage1/test/invalid_float_casts.zig @@ -15,7 +15,10 @@ export fn qux() void { _ = @floatCast(f32, a); } -// invalid float casts +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:36: error: unable to evaluate constant expression // tmp.zig:7:21: error: expected integer type, found 'f32' diff --git a/test/compile_errors/stage1/test/invalid_int_casts.zig b/test/compile_errors/stage1/test/invalid_int_casts.zig index 6870ecc723e2c1aee3a9dc85d167854855f1be72..9945751ef5765baab60e2afe8f47ee2c5725f643 100644 --- a/test/compile_errors/stage1/test/invalid_int_casts.zig +++ b/test/compile_errors/stage1/test/invalid_int_casts.zig @@ -15,7 +15,10 @@ export fn qux() void { _ = @intCast(u32, a); } -// invalid int casts +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:32: error: unable to evaluate constant expression // tmp.zig:7:21: error: expected float type, found 'u32' diff --git a/test/compile_errors/stage1/test/invalid_non-exhaustive_enum_to_union.zig b/test/compile_errors/stage1/test/invalid_non-exhaustive_enum_to_union.zig index f78a9e62ffbe5e3b671e1cb79892d231617e687e..804e83a66aab2642a9191c21c7bdf52f3a64ed88 100644 --- a/test/compile_errors/stage1/test/invalid_non-exhaustive_enum_to_union.zig +++ b/test/compile_errors/stage1/test/invalid_non-exhaustive_enum_to_union.zig @@ -18,7 +18,10 @@ export fn bar() void { _ = u; } -// invalid non-exhaustive enum to union +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:12:16: error: runtime cast to union 'U' from non-exhaustive enum // tmp.zig:17:16: error: no tag by value 15 diff --git a/test/compile_errors/stage1/test/invalid_pointer_with_reify_type.zig b/test/compile_errors/stage1/test/invalid_pointer_with_reify_type.zig index febf9685fd744f68f1f73de87452f75428fdf436..bf1cf6bd6f97e716677cf542bcfec45d166ab042 100644 --- a/test/compile_errors/stage1/test/invalid_pointer_with_reify_type.zig +++ b/test/compile_errors/stage1/test/invalid_pointer_with_reify_type.zig @@ -11,6 +11,9 @@ export fn entry() void { }}); } -// invalid pointer with @Type +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:2:16: error: sentinels are only allowed on slices and unknown-length pointers diff --git a/test/compile_errors/stage1/test/nested_vectors.zig b/test/compile_errors/stage1/test/nested_vectors.zig index a05e9b0c5b121de03dd47b93961c20decaa24d4c..9e87ac814b2f21d33add49e6e89405837f17c8c2 100644 --- a/test/compile_errors/stage1/test/nested_vectors.zig +++ b/test/compile_errors/stage1/test/nested_vectors.zig @@ -5,6 +5,9 @@ export fn entry() void { _ = v; } -// nested vectors +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid diff --git a/test/compile_errors/stage1/test/non-exhaustive_enum_marker_assigned_a_value.zig b/test/compile_errors/stage1/test/non-exhaustive_enum_marker_assigned_a_value.zig index 53037ff18111bc64cc302cadc6faee0bc9d80984..609af248dfcc2e7ead10dc39ecd4a865202bfc0b 100644 --- a/test/compile_errors/stage1/test/non-exhaustive_enum_marker_assigned_a_value.zig +++ b/test/compile_errors/stage1/test/non-exhaustive_enum_marker_assigned_a_value.zig @@ -10,7 +10,10 @@ const B = enum { }; comptime { _ = A; _ = B; } -// non-exhaustive enum marker assigned a value +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:4:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value // tmp.zig:6:11: error: non-exhaustive enum missing integer tag type diff --git a/test/compile_errors/stage1/test/non-exhaustive_enums.zig b/test/compile_errors/stage1/test/non-exhaustive_enums.zig index 49ceff3178d56b046c0f835c1044abe195e0d066..3b5f8af7cbb7f51d9a6e78a2bd59e683f5622851 100644 --- a/test/compile_errors/stage1/test/non-exhaustive_enums.zig +++ b/test/compile_errors/stage1/test/non-exhaustive_enums.zig @@ -13,7 +13,10 @@ pub export fn entry() void { _ = C; } -// non-exhaustive enums +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:5: error: '_' field of non-exhaustive enum must be last // tmp.zig:6:11: error: non-exhaustive enum specifies every value diff --git a/test/compile_errors/stage1/test/not_an_enum_type.zig b/test/compile_errors/stage1/test/not_an_enum_type.zig index f92c3d44e1c9a07b4ddb55209f6b21ff71075626..99c733b4d02a10727e88195105bc7e631f34d0c8 100644 --- a/test/compile_errors/stage1/test/not_an_enum_type.zig +++ b/test/compile_errors/stage1/test/not_an_enum_type.zig @@ -12,6 +12,9 @@ const Error = union(enum) { const InvalidToken = struct {}; const ExpectedVarDeclOrFn = struct {}; -// not an enum type +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:4:9: error: expected type '@typeInfo(Error).Union.tag_type.?', found 'type' diff --git a/test/compile_errors/stage1/test/packed_struct_with_fields_of_not_allowed_types.zig b/test/compile_errors/stage1/test/packed_struct_with_fields_of_not_allowed_types.zig index dc156342f4a4ad4e0d980d7f4a86a43df9ad4ca5..2951d26c52b434368eac60f6111c8df95a13ff6f 100644 --- a/test/compile_errors/stage1/test/packed_struct_with_fields_of_not_allowed_types.zig +++ b/test/compile_errors/stage1/test/packed_struct_with_fields_of_not_allowed_types.zig @@ -59,7 +59,10 @@ const Enum = enum { B, }; -// packed struct with fields of not allowed types +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:2:5: error: type 'anyerror' not allowed in packed struct; no guaranteed in-memory representation // 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) diff --git a/test/compile_errors/stage1/test/ptrToInt_with_pointer_to_zero-sized_type.zig b/test/compile_errors/stage1/test/ptrToInt_with_pointer_to_zero-sized_type.zig index 63ba217247d57365c6a39b26c31f45713e849d73..7c2ba184c4246887e970e69e17f2b7d92b9b5190 100644 --- a/test/compile_errors/stage1/test/ptrToInt_with_pointer_to_zero-sized_type.zig +++ b/test/compile_errors/stage1/test/ptrToInt_with_pointer_to_zero-sized_type.zig @@ -4,6 +4,9 @@ export fn entry() void { _ = x; } -// @ptrToInt with pointer to zero-sized type +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:23: error: pointer to size 0 type has no address diff --git a/test/compile_errors/stage1/test/reassign_to_array_parameter.zig b/test/compile_errors/stage1/test/reassign_to_array_parameter.zig index a222150a2c5db2631dfc78d2a2e273fdbb5c7136..f3b51d2c0fd742aae14e5287a013144e04e0bfcd 100644 --- a/test/compile_errors/stage1/test/reassign_to_array_parameter.zig +++ b/test/compile_errors/stage1/test/reassign_to_array_parameter.zig @@ -5,6 +5,9 @@ export fn entry() void { reassign(.{1, 2, 3}); } -// reassign to array parameter +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:2:15: error: cannot assign to constant diff --git a/test/compile_errors/stage1/test/reassign_to_slice_parameter.zig b/test/compile_errors/stage1/test/reassign_to_slice_parameter.zig index a8e555182a0746882813450872dfe1eb1d8f750b..34bd5541a15e391ecd3bd9a7c93cf874e15200fb 100644 --- a/test/compile_errors/stage1/test/reassign_to_slice_parameter.zig +++ b/test/compile_errors/stage1/test/reassign_to_slice_parameter.zig @@ -5,6 +5,9 @@ export fn entry() void { reassign("foo"); } -// reassign to slice parameter +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:2:10: error: cannot assign to constant diff --git a/test/compile_errors/stage1/test/reassign_to_struct_parameter.zig b/test/compile_errors/stage1/test/reassign_to_struct_parameter.zig index 018548ab32d00dcb61f9d552f18753d347a9b4f8..994833d989bfe0687d02feebbb3770427ee7c6ca 100644 --- a/test/compile_errors/stage1/test/reassign_to_struct_parameter.zig +++ b/test/compile_errors/stage1/test/reassign_to_struct_parameter.zig @@ -8,6 +8,9 @@ export fn entry() void { reassign(S{.x = 3}); } -// reassign to struct parameter +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:5:10: error: cannot assign to constant diff --git a/test/compile_errors/stage1/test/reference_to_const_data.zig b/test/compile_errors/stage1/test/reference_to_const_data.zig index d785eb648ed5f35a03812d25b7a970a44a4fe195..6c98aefd7abd452725c2bdbaedbc52199ee5ba33 100644 --- a/test/compile_errors/stage1/test/reference_to_const_data.zig +++ b/test/compile_errors/stage1/test/reference_to_const_data.zig @@ -19,7 +19,10 @@ export fn qux() void { ptr.x = 2; } -// reference to const data +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:14: error: cannot assign to constant // tmp.zig:7:13: error: cannot assign to constant diff --git a/test/compile_errors/stage1/test/reify_typeOf_with_incompatible_arguments.zig b/test/compile_errors/stage1/test/reify_typeOf_with_incompatible_arguments.zig index 97ee7aaf1b023737aeafe5787632605d5943ce01..2013a07e536d199827132902c0c5c24adc6f7f91 100644 --- a/test/compile_errors/stage1/test/reify_typeOf_with_incompatible_arguments.zig +++ b/test/compile_errors/stage1/test/reify_typeOf_with_incompatible_arguments.zig @@ -4,6 +4,9 @@ export fn entry() void { _ = @TypeOf(var_1, var_2); } -// @TypeOf with incompatible arguments +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:4:9: error: incompatible types: 'f32' and 'u32' diff --git a/test/compile_errors/stage1/test/reify_typeOf_with_no_arguments.zig b/test/compile_errors/stage1/test/reify_typeOf_with_no_arguments.zig index e18b9e66b7c3db5f2452f658f51440bc40226115..0626d453936f615271824bcdc93d5c6b405b37e2 100644 --- a/test/compile_errors/stage1/test/reify_typeOf_with_no_arguments.zig +++ b/test/compile_errors/stage1/test/reify_typeOf_with_no_arguments.zig @@ -2,6 +2,9 @@ export fn entry() void { _ = @TypeOf(); } -// @TypeOf with no arguments +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:2:9: error: expected at least 1 argument, found 0 diff --git a/test/compile_errors/stage1/test/reject_extern_function_definitions_with_body.zig b/test/compile_errors/stage1/test/reject_extern_function_definitions_with_body.zig index 024080a6bcd2469ff08208349a29cc5acf181797..a7b92e8399e3992b08b4c8ffcc887286bf0f560e 100644 --- a/test/compile_errors/stage1/test/reject_extern_function_definitions_with_body.zig +++ b/test/compile_errors/stage1/test/reject_extern_function_definitions_with_body.zig @@ -2,6 +2,9 @@ extern "c" fn definitelyNotInLibC(a: i32, b: i32) i32 { return a + b; } -// reject extern function definitions with body +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:1:1: error: extern functions have no body diff --git a/test/compile_errors/stage1/test/reject_extern_variables_with_initializers.zig b/test/compile_errors/stage1/test/reject_extern_variables_with_initializers.zig index d3f65ff0cb762fdf275f4b6f048b726599d84542..54239e0948e93fafaa3555ebe7c10c8c09a0ab07 100644 --- a/test/compile_errors/stage1/test/reject_extern_variables_with_initializers.zig +++ b/test/compile_errors/stage1/test/reject_extern_variables_with_initializers.zig @@ -1,5 +1,8 @@ extern var foo: int = 2; -// reject extern variables with initializers +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:1:23: error: extern variables have no initializers diff --git a/test/compile_errors/stage1/test/repeated_invalid_field_access_to_generic_function_returning_type_crashes_compiler_2655.zig b/test/compile_errors/stage1/test/repeated_invalid_field_access_to_generic_function_returning_type_crashes_compiler_2655.zig index c419a6ae836861f12f9e17a407763c47dfa9a759..7499939b4a1bbd979861be1dcd8fc3fd17e5207f 100644 --- a/test/compile_errors/stage1/test/repeated_invalid_field_access_to_generic_function_returning_type_crashes_compiler_2655.zig +++ b/test/compile_errors/stage1/test/repeated_invalid_field_access_to_generic_function_returning_type_crashes_compiler_2655.zig @@ -6,6 +6,9 @@ test "1" { _ = A().a; } -// repeated invalid field access to generic function returning type crashes compiler. #2655 +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:2:12: error: use of undeclared identifier 'Q' diff --git a/test/compile_errors/stage1/test/return_invalid_type_from_test.zig b/test/compile_errors/stage1/test/return_invalid_type_from_test.zig index e7aeab3be7f0e47eec8c1386a41c39ec1b6d1d10..590ac3091860b3177105ede28ff9f39e20631a36 100644 --- a/test/compile_errors/stage1/test/return_invalid_type_from_test.zig +++ b/test/compile_errors/stage1/test/return_invalid_type_from_test.zig @@ -1,5 +1,8 @@ test "example" { return 1; } -// return invalid type from test +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:1:25: error: expected type 'void', found 'comptime_int' diff --git a/test/compile_errors/stage1/test/shift_on_type_with_non-power-of-two_size.zig b/test/compile_errors/stage1/test/shift_on_type_with_non-power-of-two_size.zig index d76406223df030d738edec63be43b24e020af60f..222cb2256308bec4cca5475a28ffdf7eadf1520a 100644 --- a/test/compile_errors/stage1/test/shift_on_type_with_non-power-of-two_size.zig +++ b/test/compile_errors/stage1/test/shift_on_type_with_non-power-of-two_size.zig @@ -23,7 +23,10 @@ export fn entry() void { S.d(); } -// shift on type with non-power-of-two size +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:5:19: error: RHS of shift is too large for LHS type // tmp.zig:9:19: error: RHS of shift is too large for LHS type diff --git a/test/compile_errors/stage1/test/shuffle_with_selected_index_past_first_vector_length.zig b/test/compile_errors/stage1/test/shuffle_with_selected_index_past_first_vector_length.zig index c45eb4a0e21f5145fba2bbae81a07dd3189bbc0b..8b0c5ba780b12c79cdffca4edc911835bcd3a48f 100644 --- a/test/compile_errors/stage1/test/shuffle_with_selected_index_past_first_vector_length.zig +++ b/test/compile_errors/stage1/test/shuffle_with_selected_index_past_first_vector_length.zig @@ -5,7 +5,10 @@ export fn entry() void { _ = z; } -// @shuffle with selected index past first vector length +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:4:39: error: mask index '4' has out-of-bounds selection // tmp.zig:4:27: note: selected index '7' out of bounds of @Vector(4, u32) diff --git a/test/compile_errors/stage1/test/switch_ranges_endpoints_are_validated.zig b/test/compile_errors/stage1/test/switch_ranges_endpoints_are_validated.zig index 4c0545ea923e47ff56d3aae7af7092bd37a0e1ed..a44d59feedfdadc80c4f2a4b7335ce9d02400f64 100644 --- a/test/compile_errors/stage1/test/switch_ranges_endpoints_are_validated.zig +++ b/test/compile_errors/stage1/test/switch_ranges_endpoints_are_validated.zig @@ -7,7 +7,10 @@ pub export fn entry() void { } } -// switch ranges endpoints are validated +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:4:9: error: range start value is greater than the end value // tmp.zig:5:9: error: range start value is greater than the end value diff --git a/test/compile_errors/stage1/test/switching_with_exhaustive_enum_has___prong_.zig b/test/compile_errors/stage1/test/switching_with_exhaustive_enum_has___prong_.zig index b132b7834efc86ad7d3fbc1345eef7c667e33049..0ca489bdb82f78134b0e18ecb3e0fa6f319033b5 100644 --- a/test/compile_errors/stage1/test/switching_with_exhaustive_enum_has___prong_.zig +++ b/test/compile_errors/stage1/test/switching_with_exhaustive_enum_has___prong_.zig @@ -11,6 +11,9 @@ pub export fn entry() void { } } -// switching with exhaustive enum has '_' prong +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:7:5: error: switch on exhaustive enum has `_` prong diff --git a/test/compile_errors/stage1/test/switching_with_non-exhaustive_enums.zig b/test/compile_errors/stage1/test/switching_with_non-exhaustive_enums.zig index 53cd88e68c7734cc6e193d08179d07ec12921070..ed46c5f2f14337e7d1e87ed2ca90861bf20bae00 100644 --- a/test/compile_errors/stage1/test/switching_with_non-exhaustive_enums.zig +++ b/test/compile_errors/stage1/test/switching_with_non-exhaustive_enums.zig @@ -25,7 +25,10 @@ pub export fn entry() void { } } -// switching with non-exhaustive enums +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:12:5: error: enumeration value 'E.b' not handled in switch // tmp.zig:16:5: error: switch on non-exhaustive enum must include `else` or `_` prong diff --git a/test/compile_errors/stage1/test/tagName_on_invalid_value_of_non-exhaustive_enum.zig b/test/compile_errors/stage1/test/tagName_on_invalid_value_of_non-exhaustive_enum.zig index 139c7c7a23396fed7ba7289f62f3679ce0c65e38..a98470b681adf87d7f725d128ef3a88d5948d89a 100644 --- a/test/compile_errors/stage1/test/tagName_on_invalid_value_of_non-exhaustive_enum.zig +++ b/test/compile_errors/stage1/test/tagName_on_invalid_value_of_non-exhaustive_enum.zig @@ -3,6 +3,9 @@ test "enum" { _ = @tagName(@intToEnum(E, 5)); } -// @tagName on invalid value of non-exhaustive enum +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:18: error: no tag by value 5 diff --git a/test/compile_errors/stage1/test/type_mismatch_in_C_prototype_with_varargs.zig b/test/compile_errors/stage1/test/type_mismatch_in_C_prototype_with_varargs.zig index 437cca8772f372d9a3d99b82df264685dfac332d..1f78ef3999716b4f6ed7d4086cebc466a64902ec 100644 --- a/test/compile_errors/stage1/test/type_mismatch_in_C_prototype_with_varargs.zig +++ b/test/compile_errors/stage1/test/type_mismatch_in_C_prototype_with_varargs.zig @@ -6,6 +6,9 @@ export fn main() void { _ = x; } -// type mismatch in C prototype with varargs +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:5:22: error: expected type 'fn([*c]u8, ...) callconv(.C) void', found 'fn([*:0]u8, ...) callconv(.C) void' diff --git a/test/compile_errors/stage1/test/type_mismatch_with_tuple_concatenation.zig b/test/compile_errors/stage1/test/type_mismatch_with_tuple_concatenation.zig index ce5e4d4629dc85b13a92b8f9d253cb283e5863ff..5983224676fd805903614b5e78e0252175ff7382 100644 --- a/test/compile_errors/stage1/test/type_mismatch_with_tuple_concatenation.zig +++ b/test/compile_errors/stage1/test/type_mismatch_with_tuple_concatenation.zig @@ -3,6 +3,9 @@ export fn entry() void { x = x ++ .{ 1, 2, 3 }; } -// type mismatch with tuple concatenation +// error +// backend=stage1 +// target=native +// is_test=1 // // tmp.zig:3:11: error: expected type 'struct:2:14', found 'struct:3:11' diff --git a/test/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig b/test/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig index 969b73713f8b5b7f59983bafaf9517cbfe2eadb2..2b67390b05b2ec7e22608045d5e658810a4b596d 100644 --- a/test/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig +++ b/test/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig @@ -14,7 +14,8 @@ export fn entry() void { _ = allocator; } -// constant inside comptime function has compile error +// error +// target=native // // :4:5: error: unreachable code // :4:25: note: control flow is diverted here diff --git a/test/compile_errors/stage2/duplicate-unused_labels.zig b/test/compile_errors/stage2/duplicate-unused_labels.zig index 82afe4e85455fe8b1c0683ebcb325a6f6c955632..4bfc6c596012082af8e971d5ab932f86a01c8c5c 100644 --- a/test/compile_errors/stage2/duplicate-unused_labels.zig +++ b/test/compile_errors/stage2/duplicate-unused_labels.zig @@ -17,7 +17,8 @@ comptime { blk: for(@as([0]void, undefined)) |_| {} } -// duplicate/unused labels +// error +// target=native // // :2:12: error: redefinition of label 'blk' // :2:5: note: previous definition here diff --git a/test/compile_errors/stage2/embed_outside_package.zig b/test/compile_errors/stage2/embed_outside_package.zig index 8df6b3d9af2acefaa07e5f97fea93b8722556725..2003adb06199e8df8136ea6941d4ac346219f6bb 100644 --- a/test/compile_errors/stage2/embed_outside_package.zig +++ b/test/compile_errors/stage2/embed_outside_package.zig @@ -2,6 +2,7 @@ export fn a() usize { return @embedFile("/root/foo").len; } -// embed outside package +// error +// target=native // //:2:23: error: embed of file outside package path: '/root/foo' diff --git a/test/compile_errors/stage2/import_outside_package.zig b/test/compile_errors/stage2/import_outside_package.zig index f9de9202de3e271c3c305e7784ac1c6a0c6f8efd..59a75e2745a22d2f1b84d40d0555c4e7dc1ae881 100644 --- a/test/compile_errors/stage2/import_outside_package.zig +++ b/test/compile_errors/stage2/import_outside_package.zig @@ -2,6 +2,7 @@ export fn a() usize { return @import("../../above.zig").len; } -// import outside package +// error +// target=native // // :2:20: error: import of file outside package path: '../../above.zig' diff --git a/test/compile_errors/stage2/out_of_bounds_index.zig b/test/compile_errors/stage2/out_of_bounds_index.zig index 3c34bb5d0fa49c87b4e2727ef63b38765d10ee34..ea9bc6521d136e0aacf5ee7c69307f50c6bef577 100644 --- a/test/compile_errors/stage2/out_of_bounds_index.zig +++ b/test/compile_errors/stage2/out_of_bounds_index.zig @@ -20,7 +20,8 @@ comptime { _ = slice; } -// out of bounds indexing +// error +// target=native // // :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel) // :9:22: error: end index 6 out of bounds for array of length 4 +1 (sentinel) diff --git a/test/compile_errors/stage2/slice_of_null_pointer.zig b/test/compile_errors/stage2/slice_of_null_pointer.zig index 1e3f0d6aee0e0e2d36926220ce02c081ff56b9c1..7f2c74a8a62bfc65116889043afdcd75e1d04ddd 100644 --- a/test/compile_errors/stage2/slice_of_null_pointer.zig +++ b/test/compile_errors/stage2/slice_of_null_pointer.zig @@ -5,6 +5,7 @@ comptime { _ = y; } -// slice of null C pointer +// error +// target=native // // :4:14: error: slice of null pointer diff --git a/test/compile_errors/stage2/struct_duplicate_field_name.zig b/test/compile_errors/stage2/struct_duplicate_field_name.zig index 274dce4e4a0517c7bbc5e90b9e779c2339c7bf54..7e4434f1d92fa353d9fccff5f2c403fae90c9978 100644 --- a/test/compile_errors/stage2/struct_duplicate_field_name.zig +++ b/test/compile_errors/stage2/struct_duplicate_field_name.zig @@ -8,7 +8,8 @@ export fn entry() void { _ = s; } -// duplicate struct field name +// error +// target=native // // :3:5: error: duplicate struct field: 'foo' // :2:5: note: other field here diff --git a/test/compile_errors/stage2/union_access_of_inactive_field.zig b/test/compile_errors/stage2/union_access_of_inactive_field.zig index 34fa661d799a2d937b242769cdb362f644347c20..4f72914216fce157fc689d84d177add5ade64fcc 100644 --- a/test/compile_errors/stage2/union_access_of_inactive_field.zig +++ b/test/compile_errors/stage2/union_access_of_inactive_field.zig @@ -3,12 +3,13 @@ const U = union { b: u64, }; comptime { - var u: U = .{.a = {}}; + var u: U = .{ .a = {} }; const v = u.b; _ = v; } -// access of inactive union field +// error +// target=native // // :7:16: error: access of union field 'b' while field 'a' is active // :1:11: note: union declared here diff --git a/test/compile_errors/stage2/union_duplicate_enum_field.zig b/test/compile_errors/stage2/union_duplicate_enum_field.zig index 9044f9e97eb682da9bacc1078eb5f4ad15bf9ad7..44eb58e01449d22d53bf6382c8e61d0cc69b9cb9 100644 --- a/test/compile_errors/stage2/union_duplicate_enum_field.zig +++ b/test/compile_errors/stage2/union_duplicate_enum_field.zig @@ -1,4 +1,4 @@ -const E = enum {a, b}; +const E = enum { a, b }; const U = union(E) { a: u32, a: u32, @@ -9,7 +9,8 @@ export fn foo() void { _ = u; } -// union with enum and duplicate fields +// error +// target=native // // :4:5: error: duplicate union field: 'a' // :3:5: note: other field here diff --git a/test/compile_errors/stage2/union_duplicate_field_definition.zig b/test/compile_errors/stage2/union_duplicate_field_definition.zig index 6ad2ae4f4e7a7c7d9adcb97edfd4600596e3c280..7993f27141f54f163bc29e32dfe0ed46054c67c4 100644 --- a/test/compile_errors/stage2/union_duplicate_field_definition.zig +++ b/test/compile_errors/stage2/union_duplicate_field_definition.zig @@ -8,7 +8,8 @@ export fn entry() void { _ = u; } -// duplicate union field name +// error +// target=native // // :3:5: error: duplicate union field: 'foo' // :2:5: note: other field here diff --git a/test/compile_errors/stage2/union_enum_field_missing.zig b/test/compile_errors/stage2/union_enum_field_missing.zig index b29ca83d3a69c30b8ec5ff24dc9f02bb7b5caafe..25ec477894be5813bdfa6498309e0861cde49820 100644 --- a/test/compile_errors/stage2/union_enum_field_missing.zig +++ b/test/compile_errors/stage2/union_enum_field_missing.zig @@ -13,7 +13,8 @@ export fn entry() usize { return @sizeOf(U); } -// enum field missing in union +// error +// target=native // // :7:1: error: enum field(s) missing in union // :4:5: note: field 'c' missing, declared here diff --git a/test/compile_errors/stage2/union_extra_field.zig b/test/compile_errors/stage2/union_extra_field.zig index e8ba581aad91a43bc27c00df1bd6555230064fa1..e3bc0deb33e5a5645b130b316126f532859cb744 100644 --- a/test/compile_errors/stage2/union_extra_field.zig +++ b/test/compile_errors/stage2/union_extra_field.zig @@ -13,7 +13,8 @@ export fn entry() usize { return @sizeOf(U); } -// union extra field +// error +// target=native // // :6:1: error: enum 'tmp.E' has no field named 'd' // :1:11: note: enum declared here diff --git a/test/compile_errors/stage2/union_runtime_coercion_from_enum.zig b/test/compile_errors/stage2/union_runtime_coercion_from_enum.zig index f7e96834fd00c3f9ccbf74bf847cf70082df2b43..9020e9d5d7d202ef14c9c2660bee33df59508901 100644 --- a/test/compile_errors/stage2/union_runtime_coercion_from_enum.zig +++ b/test/compile_errors/stage2/union_runtime_coercion_from_enum.zig @@ -14,7 +14,8 @@ export fn doTheTest() u64 { return u.b; } -// runtime coercion from enum to union +// error +// target=native // // :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields // :6:5: note: field 'a' has type 'u32' diff --git a/test/incremental/aarch64-linux/conditional_branches.0.zig b/test/incremental/aarch64-linux/conditional_branches.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..28435b9d4a86940fb08eaf65bc8243a2488d4429 --- /dev/null +++ b/test/incremental/aarch64-linux/conditional_branches.0.zig @@ -0,0 +1,26 @@ +pub fn main() void { + foo(123); +} + +fn foo(x: u64) void { + if (x > 42) { + print(); + } +} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{x8}" (64), + [arg1] "{x0}" (1), + [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{x2}" ("Hello, World!\n".len), + : "memory", "cc" + ); +} + +// run +// target=aarch64-linux +// +// Hello, World! +// diff --git a/test/incremental/aarch64-linux/conditional_branches.1.zig b/test/incremental/aarch64-linux/conditional_branches.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..e03758fcb7c99317c812e8ef06921fe5c43d4f19 --- /dev/null +++ b/test/incremental/aarch64-linux/conditional_branches.1.zig @@ -0,0 +1,25 @@ +pub fn main() void { + foo(true); +} + +fn foo(x: bool) void { + if (x) { + print(); + } +} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{x8}" (64), + [arg1] "{x0}" (1), + [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{x2}" ("Hello, World!\n".len), + : "memory", "cc" + ); +} + +// run +// +// Hello, World! +// diff --git a/test/incremental/aarch64-linux/hello_world_with_updates.0.zig b/test/incremental/aarch64-linux/hello_world_with_updates.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..7a87d74dc3063b0d16f4f12fa678a4d3e7e13953 --- /dev/null +++ b/test/incremental/aarch64-linux/hello_world_with_updates.0.zig @@ -0,0 +1,31 @@ +pub export fn _start() noreturn { + print(); + exit(0); +} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{x8}" (64), + [arg1] "{x0}" (1), + [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{x2}" ("Hello, World!\n".len), + : "memory", "cc" + ); +} + +fn exit(ret: usize) noreturn { + asm volatile ("svc #0" + : + : [number] "{x8}" (93), + [arg1] "{x0}" (ret), + : "memory", "cc" + ); + unreachable; +} + +// run +// target=aarch64-linux +// +// Hello, World! +// diff --git a/test/incremental/aarch64-linux/hello_world_with_updates.1.zig b/test/incremental/aarch64-linux/hello_world_with_updates.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..a5ca0d9926f62da4dcefb2ff2b30c902acbf1a38 --- /dev/null +++ b/test/incremental/aarch64-linux/hello_world_with_updates.1.zig @@ -0,0 +1,36 @@ +pub export fn _start() noreturn { + print(); + print(); + print(); + print(); + exit(0); +} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{x8}" (64), + [arg1] "{x0}" (1), + [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{x2}" ("Hello, World!\n".len), + : "memory", "cc" + ); +} + +fn exit(ret: usize) noreturn { + asm volatile ("svc #0" + : + : [number] "{x8}" (93), + [arg1] "{x0}" (ret), + : "memory", "cc" + ); + unreachable; +} + +// run +// +// Hello, World! +// Hello, World! +// Hello, World! +// Hello, World! +// diff --git a/test/incremental/aarch64-linux/hello_world_with_updates.2.zig b/test/incremental/aarch64-linux/hello_world_with_updates.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..71f0f160bc6ba35df619c1875671515f7240ccf7 --- /dev/null +++ b/test/incremental/aarch64-linux/hello_world_with_updates.2.zig @@ -0,0 +1,21 @@ +pub fn main() void { + print(); + print(); +} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{x8}" (64), + [arg1] "{x0}" (1), + [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{x2}" ("Hello, World!\n".len), + : "memory", "cc" + ); +} + +// run +// +// Hello, World! +// Hello, World! +// diff --git a/test/incremental/aarch64-macos/hello_world_with_updates.0.zig b/test/incremental/aarch64-macos/hello_world_with_updates.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..11a379a9a933e6736165dd0a6d5625b3eb0418c9 --- /dev/null +++ b/test/incremental/aarch64-macos/hello_world_with_updates.0.zig @@ -0,0 +1,5 @@ +// error +// output_mode=Exe +// target=aarch64-macos +// +// :109:9: error: struct 'tmp.tmp' has no member named 'main' diff --git a/test/incremental/aarch64-macos/hello_world_with_updates.1.zig b/test/incremental/aarch64-macos/hello_world_with_updates.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..909fc9ccfbcb343f761414446c0ec4d52e98aeef --- /dev/null +++ b/test/incremental/aarch64-macos/hello_world_with_updates.1.zig @@ -0,0 +1,5 @@ +pub export fn main() noreturn {} + +// error +// +// :1:32: error: expected noreturn, found void diff --git a/test/incremental/aarch64-macos/hello_world_with_updates.2.zig b/test/incremental/aarch64-macos/hello_world_with_updates.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..fb8cb39eddf859f843ce61b068c0f6f8f9feb387 --- /dev/null +++ b/test/incremental/aarch64-macos/hello_world_with_updates.2.zig @@ -0,0 +1,19 @@ +extern "c" fn write(usize, usize, usize) usize; +extern "c" fn exit(usize) noreturn; + +pub export fn main() noreturn { + print(); + + exit(0); +} + +fn print() void { + const msg = @ptrToInt("Hello, World!\n"); + const len = 14; + _ = write(1, msg, len); +} + +// run +// +// Hello, World! +// diff --git a/test/incremental/aarch64-macos/hello_world_with_updates.3.zig b/test/incremental/aarch64-macos/hello_world_with_updates.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..f6e233886b0a7d616f92dd11ffb4232191c997de --- /dev/null +++ b/test/incremental/aarch64-macos/hello_world_with_updates.3.zig @@ -0,0 +1,16 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + print(); +} + +fn print() void { + const msg = @ptrToInt("Hello, World!\n"); + const len = 14; + _ = write(1, msg, len); +} + +// run +// +// Hello, World! +// diff --git a/test/incremental/aarch64-macos/hello_world_with_updates.4.zig b/test/incremental/aarch64-macos/hello_world_with_updates.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..f89cef73543ce1f3e51a4e0152c0a8c367edf537 --- /dev/null +++ b/test/incremental/aarch64-macos/hello_world_with_updates.4.zig @@ -0,0 +1,22 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + print(); + print(); + print(); + print(); +} + +fn print() void { + const msg = @ptrToInt("Hello, World!\n"); + const len = 14; + _ = write(1, msg, len); +} + +// run +// +// Hello, World! +// Hello, World! +// Hello, World! +// Hello, World! +// diff --git a/test/incremental/aarch64-macos/hello_world_with_updates.5.zig b/test/incremental/aarch64-macos/hello_world_with_updates.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..0d7f97578afe1274d1c8e3d356ce702992edca61 --- /dev/null +++ b/test/incremental/aarch64-macos/hello_world_with_updates.5.zig @@ -0,0 +1,16 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + print(); +} + +fn print() void { + const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); + const len = 104; + _ = write(1, msg, len); +} + +// run +// +// What is up? This is a longer message that will force the data to be relocated in virtual address space. +// diff --git a/test/incremental/aarch64-macos/hello_world_with_updates.6.zig b/test/incremental/aarch64-macos/hello_world_with_updates.6.zig new file mode 100644 index 0000000000000000000000000000000000000000..3ce2cb717639d663c2679dcdef2a4583c3c3f8ec --- /dev/null +++ b/test/incremental/aarch64-macos/hello_world_with_updates.6.zig @@ -0,0 +1,18 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + print(); + print(); +} + +fn print() void { + const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); + const len = 104; + _ = write(1, msg, len); +} + +// run +// +// What is up? This is a longer message that will force the data to be relocated in virtual address space. +// What is up? This is a longer message that will force the data to be relocated in virtual address space. +// diff --git a/test/incremental/adding_numbers_at_runtime_and_comptime.0.zig b/test/incremental/adding_numbers_at_runtime_and_comptime.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..e8c219681348a2456792cffea64853f01c5ab81e --- /dev/null +++ b/test/incremental/adding_numbers_at_runtime_and_comptime.0.zig @@ -0,0 +1,10 @@ +pub fn main() void { + add(3, 4); +} + +fn add(a: u32, b: u32) void { + if (a + b != 7) unreachable; +} + +// run +// diff --git a/test/incremental/adding_numbers_at_runtime_and_comptime.1.zig b/test/incremental/adding_numbers_at_runtime_and_comptime.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..d90dc6884d6960c96c1192d673662f275739d9ce --- /dev/null +++ b/test/incremental/adding_numbers_at_runtime_and_comptime.1.zig @@ -0,0 +1,12 @@ +pub fn main() void { + if (x - 7 != 0) unreachable; +} + +fn add(a: u32, b: u32) u32 { + return a + b; +} + +const x = add(3, 4); + +// run +// diff --git a/test/incremental/adding_numbers_at_runtime_and_comptime.2.zig b/test/incremental/adding_numbers_at_runtime_and_comptime.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..6643d811fc7edd946d27adac4302439093fb2603 --- /dev/null +++ b/test/incremental/adding_numbers_at_runtime_and_comptime.2.zig @@ -0,0 +1,12 @@ +pub fn main() void { + var x: usize = 3; + const y = add(1, 2, x); + if (y - 6 != 0) unreachable; +} + +inline fn add(a: usize, b: usize, c: usize) usize { + return a + b + c; +} + +// run +// diff --git a/test/incremental/ambiguous_reference.zig b/test/incremental/ambiguous_reference.zig new file mode 100644 index 0000000000000000000000000000000000000000..66144a5645902aea913226486abd12657434367d --- /dev/null +++ b/test/incremental/ambiguous_reference.zig @@ -0,0 +1,13 @@ +const T = struct { + const T = struct { + fn f() void { + _ = T; + } + }; +}; + +// error +// +// :4:17: error: ambiguous reference +// :2:5: note: declared here +// :1:1: note: also declared here diff --git a/test/incremental/arm-linux/arithmetic_operations.0.zig b/test/incremental/arm-linux/arithmetic_operations.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..51a2dbd700ff528ea70db8cac4f4a3faf0605b1a --- /dev/null +++ b/test/incremental/arm-linux/arithmetic_operations.0.zig @@ -0,0 +1,21 @@ +pub fn main() void { + print(2, 4); + print(1, 7); +} + +fn print(a: u32, b: u32) void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg3] "{r2}" (a + b), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("123456789")), + : "memory" + ); + return; +} + +// run +// target=arm-linux +// +// 12345612345678 diff --git a/test/incremental/arm-linux/arithmetic_operations.1.zig b/test/incremental/arm-linux/arithmetic_operations.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..1e3793ed38f2cf4e554de59233f13fbcccc542c7 --- /dev/null +++ b/test/incremental/arm-linux/arithmetic_operations.1.zig @@ -0,0 +1,20 @@ +pub fn main() void { + print(10, 5); + print(4, 3); +} + +fn print(a: u32, b: u32) void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg3] "{r2}" (a - b), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("123456789")), + : "memory" + ); + return; +} + +// run +// +// 123451 diff --git a/test/incremental/arm-linux/arithmetic_operations.2.zig b/test/incremental/arm-linux/arithmetic_operations.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..6b81e62198b665f8d3928069425df20bc79812bb --- /dev/null +++ b/test/incremental/arm-linux/arithmetic_operations.2.zig @@ -0,0 +1,20 @@ +pub fn main() void { + print(8, 9); + print(3, 7); +} + +fn print(a: u32, b: u32) void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg3] "{r2}" (a & b), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("123456789")), + : "memory" + ); + return; +} + +// run +// +// 12345678123 diff --git a/test/incremental/arm-linux/arithmetic_operations.3.zig b/test/incremental/arm-linux/arithmetic_operations.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..23089127f53aa331ed08030caa524b9627fdba2e --- /dev/null +++ b/test/incremental/arm-linux/arithmetic_operations.3.zig @@ -0,0 +1,20 @@ +pub fn main() void { + print(4, 2); + print(3, 7); +} + +fn print(a: u32, b: u32) void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg3] "{r2}" (a | b), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("123456789")), + : "memory" + ); + return; +} + +// run +// +// 1234561234567 diff --git a/test/incremental/arm-linux/arithmetic_operations.4.zig b/test/incremental/arm-linux/arithmetic_operations.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..ce5133c4653da4568d1bdae16edf56fa418e4fb1 --- /dev/null +++ b/test/incremental/arm-linux/arithmetic_operations.4.zig @@ -0,0 +1,20 @@ +pub fn main() void { + print(42, 42); + print(3, 5); +} + +fn print(a: u32, b: u32) void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg3] "{r2}" (a ^ b), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("123456789")), + : "memory" + ); + return; +} + +// run +// +// 123456 diff --git a/test/incremental/arm-linux/arithmetic_operations.5.zig b/test/incremental/arm-linux/arithmetic_operations.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..b1c18ca7da2ffed288f42f414fc64b42e6e552be --- /dev/null +++ b/test/incremental/arm-linux/arithmetic_operations.5.zig @@ -0,0 +1,15 @@ +pub fn main() void { + var x: u32 = 1; + assert(x << 1 == 2); + + x <<= 1; + assert(x << 2 == 8); + assert(x << 3 == 16); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/arm-linux/arithmetic_operations.6.zig b/test/incremental/arm-linux/arithmetic_operations.6.zig new file mode 100644 index 0000000000000000000000000000000000000000..e03731173c613aa1f3aaf5b9dd114e076eac6e7c --- /dev/null +++ b/test/incremental/arm-linux/arithmetic_operations.6.zig @@ -0,0 +1,21 @@ +pub fn main() void { + var a: u32 = 1024; + assert(a >> 1 == 512); + + a >>= 1; + assert(a >> 2 == 128); + assert(a >> 3 == 64); + assert(a >> 4 == 32); + assert(a >> 5 == 16); + assert(a >> 6 == 8); + assert(a >> 7 == 4); + assert(a >> 8 == 2); + assert(a >> 9 == 1); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/arm-linux/errors.0.zig b/test/incremental/arm-linux/errors.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..3e20d1d9737652b33f030e6f4b51abe819e222ec --- /dev/null +++ b/test/incremental/arm-linux/errors.0.zig @@ -0,0 +1,21 @@ +pub fn main() void { + foo() catch print(); +} + +fn foo() anyerror!void {} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{r2}" ("Hello, World!\n".len), + : "memory" + ); + return; +} + +// run +// target=arm-linux +// diff --git a/test/incremental/arm-linux/errors.1.zig b/test/incremental/arm-linux/errors.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..43fbb12675581ef874e92d08f360ee68263e0e4f --- /dev/null +++ b/test/incremental/arm-linux/errors.1.zig @@ -0,0 +1,24 @@ +pub fn main() void { + foo() catch print(); +} + +fn foo() anyerror!void { + return error.Test; +} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{r2}" ("Hello, World!\n".len), + : "memory" + ); + return; +} + +// run +// +// Hello, World! +// diff --git a/test/incremental/arm-linux/errors.2.zig b/test/incremental/arm-linux/errors.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..a1b9aef97dc4396e8e89bf1394592f260cce3743 --- /dev/null +++ b/test/incremental/arm-linux/errors.2.zig @@ -0,0 +1,27 @@ +pub fn main() void { + foo() catch |err| { + assert(err == error.Foo); + assert(err != error.Bar); + assert(err != error.Baz); + }; + bar() catch |err| { + assert(err != error.Foo); + assert(err == error.Bar); + assert(err != error.Baz); + }; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +fn foo() anyerror!void { + return error.Foo; +} + +fn bar() anyerror!void { + return error.Bar; +} + +// run +// diff --git a/test/incremental/arm-linux/errors.3.zig b/test/incremental/arm-linux/errors.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..390696fcfcb261ea6c8383d13c0bec8c9e85c445 --- /dev/null +++ b/test/incremental/arm-linux/errors.3.zig @@ -0,0 +1,12 @@ +pub fn main() void { + foo() catch unreachable; +} + +fn foo() anyerror!void { + try bar(); +} + +fn bar() anyerror!void {} + +// run +// diff --git a/test/incremental/arm-linux/function_pointers.zig b/test/incremental/arm-linux/function_pointers.zig new file mode 100644 index 0000000000000000000000000000000000000000..0ef5df6745d804633632e894b586811e0636216d --- /dev/null +++ b/test/incremental/arm-linux/function_pointers.zig @@ -0,0 +1,44 @@ +const PrintFn = *const fn () void; + +pub fn main() void { + var printFn: PrintFn = stopSayingThat; + var i: u32 = 0; + while (i < 4) : (i += 1) printFn(); + + printFn = moveEveryZig; + printFn(); +} + +fn stopSayingThat() void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("Hello, my name is Inigo Montoya; you killed my father, prepare to die.\n")), + [arg3] "{r2}" ("Hello, my name is Inigo Montoya; you killed my father, prepare to die.\n".len), + : "memory" + ); + return; +} + +fn moveEveryZig() void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("All your codebase are belong to us\n")), + [arg3] "{r2}" ("All your codebase are belong to us\n".len), + : "memory" + ); + return; +} + +// run +// target=arm-linux +// +// Hello, my name is Inigo Montoya; you killed my father, prepare to die. +// Hello, my name is Inigo Montoya; you killed my father, prepare to die. +// Hello, my name is Inigo Montoya; you killed my father, prepare to die. +// Hello, my name is Inigo Montoya; you killed my father, prepare to die. +// All your codebase are belong to us +// diff --git a/test/incremental/arm-linux/hello_world_with_updates.0.zig b/test/incremental/arm-linux/hello_world_with_updates.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..4ffdc2ae0f6d372aa809c590737536d468cabae1 --- /dev/null +++ b/test/incremental/arm-linux/hello_world_with_updates.0.zig @@ -0,0 +1,32 @@ +pub export fn _start() noreturn { + print(); + exit(); +} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{r2}" (14), + : "memory" + ); + return; +} + +fn exit() noreturn { + asm volatile ("svc #0" + : + : [number] "{r7}" (1), + [arg1] "{r0}" (0), + : "memory" + ); + unreachable; +} + +// run +// target=arm-linux +// +// Hello, World! +// diff --git a/test/incremental/arm-linux/hello_world_with_updates.1.zig b/test/incremental/arm-linux/hello_world_with_updates.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..8372d757ad8e448ab76cb5a2608e25307ffab904 --- /dev/null +++ b/test/incremental/arm-linux/hello_world_with_updates.1.zig @@ -0,0 +1,37 @@ +pub export fn _start() noreturn { + print(); + print(); + print(); + print(); + exit(); +} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{r2}" (14), + : "memory" + ); + return; +} + +fn exit() noreturn { + asm volatile ("svc #0" + : + : [number] "{r7}" (1), + [arg1] "{r0}" (0), + : "memory" + ); + unreachable; +} + +// run +// +// Hello, World! +// Hello, World! +// Hello, World! +// Hello, World! +// diff --git a/test/incremental/arm-linux/hello_world_with_updates.2.zig b/test/incremental/arm-linux/hello_world_with_updates.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..0b97bf2360149f324a7314208e43cb31b74a39ee --- /dev/null +++ b/test/incremental/arm-linux/hello_world_with_updates.2.zig @@ -0,0 +1,22 @@ +pub fn main() void { + print(); + print(); +} + +fn print() void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{r2}" (14), + : "memory" + ); + return; +} + +// run +// +// Hello, World! +// Hello, World! +// diff --git a/test/incremental/arm-linux/parameters_and_return_values.0.zig b/test/incremental/arm-linux/parameters_and_return_values.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..6a306d802c2ad01609c73cc79cf6c81d9c6b7b07 --- /dev/null +++ b/test/incremental/arm-linux/parameters_and_return_values.0.zig @@ -0,0 +1,28 @@ +pub fn main() void { + print(id(14)); +} + +fn id(x: u32) u32 { + return x; +} + +// TODO: The parameters to the asm statement in print() had to +// be in a specific order because otherwise the write to r0 +// would overwrite the len parameter which resides in r0 +fn print(len: u32) void { + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg3] "{r2}" (len), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), + : "memory" + ); + return; +} + +// run +// target=arm-linux +// +// Hello, World! +// diff --git a/test/incremental/arm-linux/parameters_and_return_values.1.zig b/test/incremental/arm-linux/parameters_and_return_values.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..f2bc35d22ec6a7ac0b203bf257d10805815dc931 --- /dev/null +++ b/test/incremental/arm-linux/parameters_and_return_values.1.zig @@ -0,0 +1,14 @@ +pub fn main() void { + assert(add(1, 2, 3, 4, 5, 6) == 21); +} + +fn add(a: u32, b: u32, c: u32, d: u32, e: u32, f: u32) u32 { + return a + b + c + d + e + f; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/arm-linux/print_u32s.zig b/test/incremental/arm-linux/print_u32s.zig new file mode 100644 index 0000000000000000000000000000000000000000..92fad75ddf0a1f75e5d3c0ac6d04052166771cde --- /dev/null +++ b/test/incremental/arm-linux/print_u32s.zig @@ -0,0 +1,40 @@ +pub fn main() void { + printNumberHex(0x00000000); + printNumberHex(0xaaaaaaaa); + printNumberHex(0xdeadbeef); + printNumberHex(0x31415926); +} + +fn printNumberHex(x: u32) void { + var i: u5 = 28; + while (true) : (i -= 4) { + const digit = (x >> i) & 0xf; + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("0123456789abcdef") + digit), + [arg3] "{r2}" (1), + : "memory" + ); + + if (i == 0) break; + } + asm volatile ("svc #0" + : + : [number] "{r7}" (4), + [arg1] "{r0}" (1), + [arg2] "{r1}" (@ptrToInt("\n")), + [arg3] "{r2}" (1), + : "memory" + ); +} + +// run +// target=arm-linux +// +// 00000000 +// aaaaaaaa +// deadbeef +// 31415926 +// diff --git a/test/incremental/arm-linux/spilling_registers.0.zig b/test/incremental/arm-linux/spilling_registers.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..ac74e071ad70f03a2d90f76c8d9cd9ca66f76095 --- /dev/null +++ b/test/incremental/arm-linux/spilling_registers.0.zig @@ -0,0 +1,38 @@ +pub fn main() void { + assert(add(3, 4) == 791); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + const k = i + j; // 210 + const l = k + c; // 217 + const m = l + d; // 227 + const n = m + e; // 241 + const o = n + f; // 265 + const p = o + g; // 303 + const q = p + h; // 365 + const r = q + i; // 465 + const s = r + j; // 575 + const t = s + k; // 785 + break :blk t; + }; + const y = x + a; // 788 + const z = y + a; // 791 + return z; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// target=arm-linux +// diff --git a/test/incremental/arm-linux/spilling_registers.1.zig b/test/incremental/arm-linux/spilling_registers.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..f401a5d7b7d1f29a9dc628315cff7e5b4e85d21c --- /dev/null +++ b/test/incremental/arm-linux/spilling_registers.1.zig @@ -0,0 +1,37 @@ +pub fn main() void { + assert(addMul(3, 4) == 357747496); +} + +fn addMul(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + const k = i + j; // 210 + const l = k + c; // 217 + const m = l * d; // 2170 + const n = m + e; // 2184 + const o = n * f; // 52416 + const p = o + g; // 52454 + const q = p * h; // 3252148 + const r = q + i; // 3252248 + const s = r * j; // 357747280 + const t = s + k; // 357747490 + break :blk t; + }; + const y = x + a; // 357747493 + const z = y + a; // 357747496 + return z; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// diff --git a/test/incremental/bad_inferred_variable_type.zig b/test/incremental/bad_inferred_variable_type.zig new file mode 100644 index 0000000000000000000000000000000000000000..47ceb9b638185dbc9dafd3ec92900dfa5ad4d4cf --- /dev/null +++ b/test/incremental/bad_inferred_variable_type.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var x = null; + _ = x; +} + +// error +// output_mode=Exe +// +// :2:9: error: variable of type '@TypeOf(null)' must be const or comptime diff --git a/test/incremental/binary_operands.0.zig b/test/incremental/binary_operands.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..e3688232aa27c190ecfcbab4f4ea734093156d98 --- /dev/null +++ b/test/incremental/binary_operands.0.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var i: u8 = 5; + i += 20; + if (i != 25) unreachable; +} + +// run +// target=wasm32-wasi +// diff --git a/test/incremental/binary_operands.1.zig b/test/incremental/binary_operands.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..fdee492d227abb71eca039c996d32c6a24568d43 --- /dev/null +++ b/test/incremental/binary_operands.1.zig @@ -0,0 +1,8 @@ +pub fn main() void { + var i: i32 = 2147483647; + if (i +% 1 != -2147483648) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.10.zig b/test/incremental/binary_operands.10.zig new file mode 100644 index 0000000000000000000000000000000000000000..63e045c258199ca9127804d16969e7ba2d4c9a64 --- /dev/null +++ b/test/incremental/binary_operands.10.zig @@ -0,0 +1,13 @@ +pub fn main() void { + var i: u32 = 5; + i *= 7; + var result: u32 = foo(i, 10); + if (result != 350) unreachable; + return; +} +fn foo(x: u32, y: u32) u32 { + return x * y; +} + +// run +// diff --git a/test/incremental/binary_operands.11.zig b/test/incremental/binary_operands.11.zig new file mode 100644 index 0000000000000000000000000000000000000000..f461bcc0af9ba6cb1cae194c078fb53bcd6b24bd --- /dev/null +++ b/test/incremental/binary_operands.11.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var i: i32 = 2147483647; + const result = i *% 2; + if (result != -2) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.12.zig b/test/incremental/binary_operands.12.zig new file mode 100644 index 0000000000000000000000000000000000000000..0ffb5e22309d4642af7b59c80999f2ce465d7c45 --- /dev/null +++ b/test/incremental/binary_operands.12.zig @@ -0,0 +1,8 @@ +pub fn main() void { + var i: u3 = 3; + if (i *% 3 != 1) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.13.zig b/test/incremental/binary_operands.13.zig new file mode 100644 index 0000000000000000000000000000000000000000..e62107b47e71c7bb3d7a0cf2d8e9fcf9b8ee7a0c --- /dev/null +++ b/test/incremental/binary_operands.13.zig @@ -0,0 +1,8 @@ +pub fn main() void { + var i: i4 = 3; + if (i *% 3 != 1) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.14.zig b/test/incremental/binary_operands.14.zig new file mode 100644 index 0000000000000000000000000000000000000000..fcc7245ad97d3606a1d364981bbae5c1339cc8d7 --- /dev/null +++ b/test/incremental/binary_operands.14.zig @@ -0,0 +1,13 @@ +pub fn main() void { + var i: u32 = 352; + i /= 7; // i = 50 + var result: u32 = foo(i, 7); + if (result != 7) unreachable; + return; +} +fn foo(x: u32, y: u32) u32 { + return x / y; +} + +// run +// diff --git a/test/incremental/binary_operands.15.zig b/test/incremental/binary_operands.15.zig new file mode 100644 index 0000000000000000000000000000000000000000..c709e5dfd2327111b9ea86deaa341e12d148df0e --- /dev/null +++ b/test/incremental/binary_operands.15.zig @@ -0,0 +1,8 @@ +pub fn main() u8 { + var i: u8 = 5; + i &= 6; + return i - 4; +} + +// run +// diff --git a/test/incremental/binary_operands.16.zig b/test/incremental/binary_operands.16.zig new file mode 100644 index 0000000000000000000000000000000000000000..fe1813b8772784ea7a9617f755223f0ed34fefb1 --- /dev/null +++ b/test/incremental/binary_operands.16.zig @@ -0,0 +1,8 @@ +pub fn main() u8 { + var i: u8 = 5; + i |= 6; + return i - 7; +} + +// run +// diff --git a/test/incremental/binary_operands.17.zig b/test/incremental/binary_operands.17.zig new file mode 100644 index 0000000000000000000000000000000000000000..439d3d6d6b59699ca309a7705ac83b312fd33b9b --- /dev/null +++ b/test/incremental/binary_operands.17.zig @@ -0,0 +1,8 @@ +pub fn main() u8 { + var i: u8 = 5; + i ^= 6; + return i - 3; +} + +// run +// diff --git a/test/incremental/binary_operands.18.zig b/test/incremental/binary_operands.18.zig new file mode 100644 index 0000000000000000000000000000000000000000..c21aa586c555e8fd882ba31a0bbbe5169e6ff5e0 --- /dev/null +++ b/test/incremental/binary_operands.18.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var b: bool = false; + b = b or false; + if (b) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.19.zig b/test/incremental/binary_operands.19.zig new file mode 100644 index 0000000000000000000000000000000000000000..e95470391cf1bec9d9412b1b4156eb26d77669f7 --- /dev/null +++ b/test/incremental/binary_operands.19.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var b: bool = true; + b = b or false; + if (!b) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.2.zig b/test/incremental/binary_operands.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..7407ed7d9558f22956f631ac9af4edbf31edc24e --- /dev/null +++ b/test/incremental/binary_operands.2.zig @@ -0,0 +1,8 @@ +pub fn main() void { + var i: i4 = 7; + if (i +% 1 != 0) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.20.zig b/test/incremental/binary_operands.20.zig new file mode 100644 index 0000000000000000000000000000000000000000..9238bf97c04ed9e5dbb0cc98634eecf96de9fa40 --- /dev/null +++ b/test/incremental/binary_operands.20.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var b: bool = false; + b = b or true; + if (!b) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.21.zig b/test/incremental/binary_operands.21.zig new file mode 100644 index 0000000000000000000000000000000000000000..a2d427bda9d66dbdcb59d300ffbab4e1a6af9076 --- /dev/null +++ b/test/incremental/binary_operands.21.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var b: bool = true; + b = b or true; + if (!b) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.22.zig b/test/incremental/binary_operands.22.zig new file mode 100644 index 0000000000000000000000000000000000000000..aa8439a36189db87ef416602872feb38a3b17993 --- /dev/null +++ b/test/incremental/binary_operands.22.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var b: bool = false; + b = b and false; + if (b) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.23.zig b/test/incremental/binary_operands.23.zig new file mode 100644 index 0000000000000000000000000000000000000000..8596ea77098058f4d23bab966d0cad540704df09 --- /dev/null +++ b/test/incremental/binary_operands.23.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var b: bool = true; + b = b and false; + if (b) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.24.zig b/test/incremental/binary_operands.24.zig new file mode 100644 index 0000000000000000000000000000000000000000..08dc4430a2298ea934e15c140c9aa0f6d65b7603 --- /dev/null +++ b/test/incremental/binary_operands.24.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var b: bool = false; + b = b and true; + if (b) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.25.zig b/test/incremental/binary_operands.25.zig new file mode 100644 index 0000000000000000000000000000000000000000..8aa0acfdb558d082ea40c2533b30502315aa59e3 --- /dev/null +++ b/test/incremental/binary_operands.25.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var b: bool = true; + b = b and true; + if (!b) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.3.zig b/test/incremental/binary_operands.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..0297f1e7a48a877295b059a36e0fc958e2033f61 --- /dev/null +++ b/test/incremental/binary_operands.3.zig @@ -0,0 +1,7 @@ +pub fn main() u8 { + var i: u8 = 255; + return i +% 1; +} + +// run +// diff --git a/test/incremental/binary_operands.4.zig b/test/incremental/binary_operands.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..f0f8910e1463b4127d7da741907491cbbee4394a --- /dev/null +++ b/test/incremental/binary_operands.4.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var i: u8 = 5; + i += 20; + var result: u8 = foo(i, 10); + return result - 35; +} +fn foo(x: u8, y: u8) u8 { + return x + y; +} + +// run +// diff --git a/test/incremental/binary_operands.5.zig b/test/incremental/binary_operands.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..51ab437475684082b941075aa3ba636f7985977a --- /dev/null +++ b/test/incremental/binary_operands.5.zig @@ -0,0 +1,8 @@ +pub fn main() u8 { + var i: u8 = 20; + i -= 5; + return i - 15; +} + +// run +// diff --git a/test/incremental/binary_operands.6.zig b/test/incremental/binary_operands.6.zig new file mode 100644 index 0000000000000000000000000000000000000000..5c9c5be68aa1364a8f782aaab099532cd6dde297 --- /dev/null +++ b/test/incremental/binary_operands.6.zig @@ -0,0 +1,8 @@ +pub fn main() void { + var i: i32 = -2147483648; + if (i -% 1 != 2147483647) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.7.zig b/test/incremental/binary_operands.7.zig new file mode 100644 index 0000000000000000000000000000000000000000..634a47fb0ce4042bd71d386044a2077109f39356 --- /dev/null +++ b/test/incremental/binary_operands.7.zig @@ -0,0 +1,8 @@ +pub fn main() void { + var i: i7 = -64; + if (i -% 1 != 63) unreachable; + return; +} + +// run +// diff --git a/test/incremental/binary_operands.8.zig b/test/incremental/binary_operands.8.zig new file mode 100644 index 0000000000000000000000000000000000000000..a20f6646944d35e89980743212ce060d9b3e5930 --- /dev/null +++ b/test/incremental/binary_operands.8.zig @@ -0,0 +1,7 @@ +pub fn main() void { + var i: u4 = 0; + if (i -% 1 != 15) unreachable; +} + +// run +// diff --git a/test/incremental/binary_operands.9.zig b/test/incremental/binary_operands.9.zig new file mode 100644 index 0000000000000000000000000000000000000000..e6c4f5d52b491158f629ec74f7b0f16f624f94ac --- /dev/null +++ b/test/incremental/binary_operands.9.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var i: u8 = 5; + i -= 3; + var result: u8 = foo(i, 10); + return result - 8; +} +fn foo(x: u8, y: u8) u8 { + return y - x; +} + +// run +// diff --git a/test/incremental/break_continue.0.zig b/test/incremental/break_continue.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..ac0abdb52dadc98760d9ac2d1b466b185e8bd90d --- /dev/null +++ b/test/incremental/break_continue.0.zig @@ -0,0 +1,9 @@ +pub fn main() void { + while (true) { + break; + } +} + +// run +// target=x86_64-linux,x86_64-macos,aarch64-linux,aarch64-macos +// diff --git a/test/incremental/break_continue.1.zig b/test/incremental/break_continue.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..9e4f79bd14d7a1340b9fcbc02c271790c642bd07 --- /dev/null +++ b/test/incremental/break_continue.1.zig @@ -0,0 +1,8 @@ +pub fn main() void { + foo: while (true) { + break :foo; + } +} + +// run +// diff --git a/test/incremental/break_continue.2.zig b/test/incremental/break_continue.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..ba12f33e3f05b3419a5f3f84631e3d52a3ce9eec --- /dev/null +++ b/test/incremental/break_continue.2.zig @@ -0,0 +1,10 @@ +pub fn main() void { + var i: u64 = 0; + while (true) : (i += 1) { + if (i == 4) return; + continue; + } +} + +// run +// diff --git a/test/incremental/break_continue.3.zig b/test/incremental/break_continue.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..03e224d26545d7c8d67617dd0a4fb609b6d80405 --- /dev/null +++ b/test/incremental/break_continue.3.zig @@ -0,0 +1,10 @@ +pub fn main() void { + var i: u64 = 0; + foo: while (true) : (i += 1) { + if (i == 4) return; + continue :foo; + } +} + +// run +// diff --git a/test/incremental/catch_at_comptime.0.zig b/test/incremental/catch_at_comptime.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..af1545832dee3b3e558a463ebf9ac75ad36b346e --- /dev/null +++ b/test/incremental/catch_at_comptime.0.zig @@ -0,0 +1,11 @@ +pub fn main() void { + const i: anyerror!u64 = 0; + const caught = i catch 5; + assert(caught == 0); +} +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// diff --git a/test/incremental/catch_at_comptime.1.zig b/test/incremental/catch_at_comptime.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..e05caeae6d9f058b730777d4868e85850dd776c5 --- /dev/null +++ b/test/incremental/catch_at_comptime.1.zig @@ -0,0 +1,11 @@ +pub fn main() void { + const i: anyerror!u64 = error.B; + const caught = i catch 5; + assert(caught == 5); +} +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// diff --git a/test/incremental/catch_at_comptime.2.zig b/test/incremental/catch_at_comptime.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..326e6f0b61a4c8a651130c6767a72d77617506a6 --- /dev/null +++ b/test/incremental/catch_at_comptime.2.zig @@ -0,0 +1,11 @@ +pub fn main() void { + const a: anyerror!comptime_int = 42; + const b: *const comptime_int = &(a catch unreachable); + assert(b.* == 42); +} +fn assert(b: bool) void { + if (!b) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/catch_at_comptime.3.zig b/test/incremental/catch_at_comptime.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..d00317f697426e19c149abb0e89ae171d0427f45 --- /dev/null +++ b/test/incremental/catch_at_comptime.3.zig @@ -0,0 +1,10 @@ +pub fn main() void { + const a: anyerror!u32 = error.B; + _ = &(a catch |err| assert(err == error.B)); +} +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// diff --git a/test/incremental/catch_at_comptime.4.zig b/test/incremental/catch_at_comptime.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..57cb602641ded47982e332f2fbe5f484fa64363f --- /dev/null +++ b/test/incremental/catch_at_comptime.4.zig @@ -0,0 +1,10 @@ +pub fn main() void { + const a: anyerror!u32 = error.Bar; + a catch |err| assert(err == error.Bar); +} +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// diff --git a/test/incremental/compile_error.zig b/test/incremental/compile_error.zig new file mode 100644 index 0000000000000000000000000000000000000000..dab0f7f7cc9fd2dc36d0bab8dcdaa5b1dbc6fdfb --- /dev/null +++ b/test/incremental/compile_error.zig @@ -0,0 +1,7 @@ +export fn foo() void { + @compileError("this is an error"); +} + +// error +// +// :2:5: error: this is an error diff --git a/test/incremental/compile_error_in_inline_fn_call_fixed.0.zig b/test/incremental/compile_error_in_inline_fn_call_fixed.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..1848490b0794abeb37eddb4f413e96cc013f976a --- /dev/null +++ b/test/incremental/compile_error_in_inline_fn_call_fixed.0.zig @@ -0,0 +1,16 @@ +pub fn main() void { + var x: usize = 3; + const y = add(10, 2, x); + if (y - 6 != 0) unreachable; +} + +inline fn add(a: usize, b: usize, c: usize) usize { + if (a == 10) @compileError("bad"); + return a + b + c; +} + +// error +// output_mode=Exe +// +// :8:18: error: bad +// :3:18: note: called from here diff --git a/test/incremental/compile_error_in_inline_fn_call_fixed.1.zig b/test/incremental/compile_error_in_inline_fn_call_fixed.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..1e61c6c790fd3b9f7bde2c5de0ce5b67421bdc1e --- /dev/null +++ b/test/incremental/compile_error_in_inline_fn_call_fixed.1.zig @@ -0,0 +1,13 @@ +pub fn main() void { + var x: usize = 3; + const y = add(1, 2, x); + if (y - 6 != 0) unreachable; +} + +inline fn add(a: usize, b: usize, c: usize) usize { + if (a == 10) @compileError("bad"); + return a + b + c; +} + +// run +// diff --git a/test/incremental/compile_log.0.zig b/test/incremental/compile_log.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..c213ebb930ca78b5b25f6fec55acaf643761afb5 --- /dev/null +++ b/test/incremental/compile_log.0.zig @@ -0,0 +1,17 @@ +export fn _start() noreturn { + const b = true; + var f: u32 = 1; + @compileLog(b, 20, f, x); + @compileLog(1000); + var bruh: usize = true; + _ = bruh; + unreachable; +} +export fn other() void { + @compileLog(1234); +} +fn x() void {} + +// error +// +// :6:23: error: expected usize, found bool diff --git a/test/incremental/compile_log.1.zig b/test/incremental/compile_log.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..12e66415420870549bdff9b0e1964403985d2dd3 --- /dev/null +++ b/test/incremental/compile_log.1.zig @@ -0,0 +1,16 @@ +export fn _start() noreturn { + const b = true; + var f: u32 = 1; + @compileLog(b, 20, f, x); + @compileLog(1000); + unreachable; +} +export fn other() void { + @compileLog(1234); +} +fn x() void {} + +// error +// +// :9:5: error: found compile log statement +// :4:5: note: also here diff --git a/test/incremental/double_ampersand.0.zig b/test/incremental/double_ampersand.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..b14c30ecb01225e88025b6e0cb1aa7c25c69f1ed --- /dev/null +++ b/test/incremental/double_ampersand.0.zig @@ -0,0 +1,6 @@ +pub const a = if (true && false) 1 else 2; + +// error +// output_mode=Exe +// +// :1:24: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND diff --git a/test/incremental/double_ampersand.1.zig b/test/incremental/double_ampersand.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..cd5bba02fdaa14bd47cc3d1332854865e9aaea49 --- /dev/null +++ b/test/incremental/double_ampersand.1.zig @@ -0,0 +1,11 @@ +pub fn main() void { + const a = true; + const b = false; + _ = a & &b; +} + +// error +// +// :4:11: error: incompatible types: 'bool' and '*const bool' +// :4:9: note: type 'bool' here +// :4:13: note: type '*const bool' here diff --git a/test/incremental/double_ampersand.2.zig b/test/incremental/double_ampersand.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..c6f461d66126f07c9808aacf5160615fc36d7917 --- /dev/null +++ b/test/incremental/double_ampersand.2.zig @@ -0,0 +1,7 @@ +pub fn main() void { + const b: u8 = 1; + _ = &&b; +} + +// run +// diff --git a/test/incremental/enum_values.0.zig b/test/incremental/enum_values.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..d96841dd8c65b1c20f05849b687d5de6b4f2186e --- /dev/null +++ b/test/incremental/enum_values.0.zig @@ -0,0 +1,18 @@ +const Number = enum { One, Two, Three }; + +pub fn main() void { + var number1 = Number.One; + var number2: Number = .Two; + if (false) { + number1; + number2; + } + const number3 = @intToEnum(Number, 2); + if (@enumToInt(number3) != 2) { + unreachable; + } + return; +} + +// run +// diff --git a/test/incremental/enum_values.1.zig b/test/incremental/enum_values.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..47b9e21a2778c2bdb4d23c881326b10ec975acdd --- /dev/null +++ b/test/incremental/enum_values.1.zig @@ -0,0 +1,22 @@ +const Number = enum { One, Two, Three }; + +pub fn main() void { + var number1 = Number.One; + var number2: Number = .Two; + const number3 = @intToEnum(Number, 2); + assert(number1 != number2); + assert(number2 != number3); + assert(@enumToInt(number1) == 0); + assert(@enumToInt(number2) == 1); + assert(@enumToInt(number3) == 2); + var x: Number = .Two; + assert(number2 == x); + + return; +} +fn assert(val: bool) void { + if (!val) unreachable; +} + +// run +// diff --git a/test/incremental/extern_variable_has_no_type.0.zig b/test/incremental/extern_variable_has_no_type.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..2f03067b3ac8aba8bfe34a948baece7c2796fe05 --- /dev/null +++ b/test/incremental/extern_variable_has_no_type.0.zig @@ -0,0 +1,9 @@ +comptime { + const x = foo + foo; + _ = x; +} +extern var foo: i32; + +// error +// +// :2:15: error: unable to resolve comptime value diff --git a/test/incremental/extern_variable_has_no_type.1.zig b/test/incremental/extern_variable_has_no_type.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..f5c31244e5a7bfe9a39f028fd80f40ebcd3dff04 --- /dev/null +++ b/test/incremental/extern_variable_has_no_type.1.zig @@ -0,0 +1,8 @@ +export fn entry() void { + _ = foo; +} +extern var foo; + +// error +// +// :4:8: error: unable to infer variable type diff --git a/test/incremental/function_calls.0.zig b/test/incremental/function_calls.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..eb388bc49f6b9399ebc8b1f42424f7527f735360 --- /dev/null +++ b/test/incremental/function_calls.0.zig @@ -0,0 +1,12 @@ +pub fn main() void { + foo(); + bar(); +} +fn foo() void { + bar(); + bar(); +} +fn bar() void {} + +// run +// diff --git a/test/incremental/function_calls.1.zig b/test/incremental/function_calls.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..60bc061bca50c1e0a18e5bfa0b67c14d1cc06c9f --- /dev/null +++ b/test/incremental/function_calls.1.zig @@ -0,0 +1,15 @@ +pub fn main() void { + bar(); + foo(); + foo(); + bar(); + foo(); + bar(); +} +fn foo() void { + bar(); +} +fn bar() void {} + +// run +// diff --git a/test/incremental/function_calls.2.zig b/test/incremental/function_calls.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..ce5627378a891a2f894ac79e7197f566f51aa958 --- /dev/null +++ b/test/incremental/function_calls.2.zig @@ -0,0 +1,14 @@ +pub fn main() void { + bar(); + foo(); + return; +} +fn foo() void { + bar(); + bar(); + bar(); +} +fn bar() void {} + +// run +// diff --git a/test/incremental/function_calls.3.zig b/test/incremental/function_calls.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..0316d9042d6b2888e0c7f3a71a2e99fe06bfbc8f --- /dev/null +++ b/test/incremental/function_calls.3.zig @@ -0,0 +1,10 @@ +pub fn main() void { + foo(10, 20); +} +fn foo(x: u8, y: u8) void { + _ = x; + _ = y; +} + +// run +// diff --git a/test/incremental/function_redeclaration.zig b/test/incremental/function_redeclaration.zig new file mode 100644 index 0000000000000000000000000000000000000000..a9664646c98a4dcb5b889de88ddfc60ce8d5d8d5 --- /dev/null +++ b/test/incremental/function_redeclaration.zig @@ -0,0 +1,14 @@ +// dummy comment +fn entry() void {} +fn entry() void {} + +fn foo() void { + var foo = 1234; +} + +// error +// +// :3:1: error: redeclaration of 'entry' +// :2:1: note: other declaration here +// :6:9: error: local shadows declaration of 'foo' +// :5:1: note: declared here diff --git a/test/incremental/global_variable_redeclaration.zig b/test/incremental/global_variable_redeclaration.zig new file mode 100644 index 0000000000000000000000000000000000000000..9a0d5939fbffc35ff3da74a6901cf8d69dec421a --- /dev/null +++ b/test/incremental/global_variable_redeclaration.zig @@ -0,0 +1,8 @@ +// dummy comment +var foo = false; +var foo = true; + +// error +// +// :3:1: error: redeclaration of 'foo' +// :2:1: note: other declaration here diff --git a/test/incremental/inner_func_accessing_outer_var.zig b/test/incremental/inner_func_accessing_outer_var.zig new file mode 100644 index 0000000000000000000000000000000000000000..e30cf58ef84d54e38ecfac903a7e47437d971a68 --- /dev/null +++ b/test/incremental/inner_func_accessing_outer_var.zig @@ -0,0 +1,15 @@ +pub fn f() void { + var bar: bool = true; + const S = struct { + fn baz() bool { + return bar; + } + }; + _ = S; +} + +// error +// +// :5:20: error: mutable 'bar' not accessible from here +// :2:9: note: declared mutable here +// :3:15: note: crosses namespace boundary here diff --git a/test/incremental/int_to_ptr.0.zig b/test/incremental/int_to_ptr.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..b7c70b90a44ff58c786fa8b18fa3b440caef980f --- /dev/null +++ b/test/incremental/int_to_ptr.0.zig @@ -0,0 +1,8 @@ +pub fn main() void { + _ = @intToPtr(*u8, 0); +} + +// error +// output_mode=Exe +// +// :2:24: error: pointer type '*u8' does not allow address zero diff --git a/test/incremental/int_to_ptr.1.zig b/test/incremental/int_to_ptr.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..72c8c8c9d6f06d8c7d4e4d49219106160beae122 --- /dev/null +++ b/test/incremental/int_to_ptr.1.zig @@ -0,0 +1,7 @@ +pub fn main() void { + _ = @intToPtr(*u32, 2); +} + +// error +// +// :2:25: error: pointer type '*u32' requires aligned address diff --git a/test/incremental/large_add_function.zig b/test/incremental/large_add_function.zig new file mode 100644 index 0000000000000000000000000000000000000000..8b0e9b879b2f9309f29ef99823f5d26e783124c7 --- /dev/null +++ b/test/incremental/large_add_function.zig @@ -0,0 +1,38 @@ +pub fn main() void { + assert(add(3, 4) == 791); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + const k = i + j; // 210 + const l = k + c; // 217 + const m = l + d; // 227 + const n = m + e; // 241 + const o = n + f; // 265 + const p = o + g; // 303 + const q = p + h; // 365 + const r = q + i; // 465 + const s = r + j; // 575 + const t = s + k; // 785 + break :blk t; + }; + const y = x + a; // 788 + const z = y + a; // 791 + return z; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// target=aarch64-linux,aarch64-macos +// diff --git a/test/incremental/llvm/address_space_pointer_access_chaining_pointer_to_optional_array.zig b/test/incremental/llvm/address_space_pointer_access_chaining_pointer_to_optional_array.zig new file mode 100644 index 0000000000000000000000000000000000000000..cf43513159d1fb4ffe7e5a913833f2f343578e7e --- /dev/null +++ b/test/incremental/llvm/address_space_pointer_access_chaining_pointer_to_optional_array.zig @@ -0,0 +1,12 @@ +fn entry(a: *addrspace(.gs) ?[1]i32) *addrspace(.gs) i32 { + return &a.*.?[0]; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/address_spaces_pointer_access_chaining_array_pointer.zig b/test/incremental/llvm/address_spaces_pointer_access_chaining_array_pointer.zig new file mode 100644 index 0000000000000000000000000000000000000000..5907c1dad5e961a35d9116f4c1c94a4dc0fbb4da --- /dev/null +++ b/test/incremental/llvm/address_spaces_pointer_access_chaining_array_pointer.zig @@ -0,0 +1,12 @@ +fn entry(a: *addrspace(.gs) [1]i32) *addrspace(.gs) i32 { + return &a[0]; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/address_spaces_pointer_access_chaining_complex.zig b/test/incremental/llvm/address_spaces_pointer_access_chaining_complex.zig new file mode 100644 index 0000000000000000000000000000000000000000..ece0614f73040a8a73e22dd356721b815dc115db --- /dev/null +++ b/test/incremental/llvm/address_spaces_pointer_access_chaining_complex.zig @@ -0,0 +1,13 @@ +const A = struct { a: ?[1]i32 }; +fn entry(a: *addrspace(.gs) [1]A) *addrspace(.gs) i32 { + return &a[0].a.?[0]; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/address_spaces_pointer_access_chaining_struct_pointer.zig b/test/incremental/llvm/address_spaces_pointer_access_chaining_struct_pointer.zig new file mode 100644 index 0000000000000000000000000000000000000000..9175bcbc0ea9165f083ec8973f606ef5baa57040 --- /dev/null +++ b/test/incremental/llvm/address_spaces_pointer_access_chaining_struct_pointer.zig @@ -0,0 +1,13 @@ +const A = struct { a: i32 }; +fn entry(a: *addrspace(.gs) A) *addrspace(.gs) i32 { + return &a.a; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/any_typed_null_to_any_typed_optional.zig b/test/incremental/llvm/any_typed_null_to_any_typed_optional.zig new file mode 100644 index 0000000000000000000000000000000000000000..c155d044976655e1becf111027c00d25edadbb90 --- /dev/null +++ b/test/incremental/llvm/any_typed_null_to_any_typed_optional.zig @@ -0,0 +1,11 @@ +pub fn main() void { + var a: ?*anyopaque = undefined; + a = @as(?usize, null); +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// +// :3:21: error: expected *anyopaque, found ?usize diff --git a/test/incremental/llvm/blocks.zig b/test/incremental/llvm/blocks.zig new file mode 100644 index 0000000000000000000000000000000000000000..c64909c7fea640a33c5fcf793f6ed82fe3189ba6 --- /dev/null +++ b/test/incremental/llvm/blocks.zig @@ -0,0 +1,22 @@ +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +fn foo(ok: bool) i32 { + const val: i32 = blk: { + var x: i32 = 1; + if (!ok) break :blk x + 9; + break :blk x + 19; + }; + return val + 10; +} + +pub fn main() void { + assert(foo(false) == 20); + assert(foo(true) == 30); +} + +// run +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/dereferencing_though_multiple_pointers_with_address_spaces.zig b/test/incremental/llvm/dereferencing_though_multiple_pointers_with_address_spaces.zig new file mode 100644 index 0000000000000000000000000000000000000000..8f3670075717006113252c90086f21059337b61f --- /dev/null +++ b/test/incremental/llvm/dereferencing_though_multiple_pointers_with_address_spaces.zig @@ -0,0 +1,12 @@ +fn entry(a: *addrspace(.fs) *addrspace(.gs) *i32) *i32 { + return a.*.*; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/f_segment_address_space_reading_and_writing.zig b/test/incremental/llvm/f_segment_address_space_reading_and_writing.zig new file mode 100644 index 0000000000000000000000000000000000000000..62db92668b4da29b83dc36fdbb531eba4124a882 --- /dev/null +++ b/test/incremental/llvm/f_segment_address_space_reading_and_writing.zig @@ -0,0 +1,48 @@ +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +fn setFs(value: c_ulong) void { + asm volatile ( + \\syscall + : + : [number] "{rax}" (158), + [code] "{rdi}" (0x1002), + [val] "{rsi}" (value), + : "rcx", "r11", "memory" + ); +} + +fn getFs() c_ulong { + var result: c_ulong = undefined; + asm volatile ( + \\syscall + : + : [number] "{rax}" (158), + [code] "{rdi}" (0x1003), + [ptr] "{rsi}" (@ptrToInt(&result)), + : "rcx", "r11", "memory" + ); + return result; +} + +var test_value: u64 = 12345; + +pub fn main() void { + const orig_fs = getFs(); + + setFs(@ptrToInt(&test_value)); + assert(getFs() == @ptrToInt(&test_value)); + + var test_ptr = @intToPtr(*allowzero addrspace(.fs) u64, 0); + assert(test_ptr.* == 12345); + test_ptr.* = 98765; + assert(test_value == 98765); + + setFs(orig_fs); +} + +// run +// backend=llvm +// target=x86_64-linux +// diff --git a/test/incremental/llvm/for_loop.zig b/test/incremental/llvm/for_loop.zig new file mode 100644 index 0000000000000000000000000000000000000000..e7e701aafaa88ddd9617e9b24db34fe27b71133e --- /dev/null +++ b/test/incremental/llvm/for_loop.zig @@ -0,0 +1,16 @@ +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +pub fn main() void { + var x: u32 = 0; + for ("hello") |_| { + x += 1; + } + assert("hello".len == x); +} + +// run +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/hello_world.zig b/test/incremental/llvm/hello_world.zig new file mode 100644 index 0000000000000000000000000000000000000000..4243191b0fb7a82da70c8f00ad28e72439b968f1 --- /dev/null +++ b/test/incremental/llvm/hello_world.zig @@ -0,0 +1,12 @@ +extern fn puts(s: [*:0]const u8) c_int; + +pub fn main() void { + _ = puts("hello world!"); +} + +// run +// backend=llvm +// target=x86_64-linux,x86_64-macos +// +// hello world! +// diff --git a/test/incremental/llvm/invalid_address_space_coercion.zig b/test/incremental/llvm/invalid_address_space_coercion.zig new file mode 100644 index 0000000000000000000000000000000000000000..6b72f1d5a8ada2bebfecc79b0b780d9af20eb3d8 --- /dev/null +++ b/test/incremental/llvm/invalid_address_space_coercion.zig @@ -0,0 +1,13 @@ +fn entry(a: *addrspace(.gs) i32) *i32 { + return a; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// +// :2:12: error: expected *i32, found *addrspace(.gs) i32 diff --git a/test/incremental/llvm/invalid_pointer_keeps_address_space_when_taking_address_of_dereference.zig b/test/incremental/llvm/invalid_pointer_keeps_address_space_when_taking_address_of_dereference.zig new file mode 100644 index 0000000000000000000000000000000000000000..26f68ce7895207a301eb192fc679156573e9d39d --- /dev/null +++ b/test/incremental/llvm/invalid_pointer_keeps_address_space_when_taking_address_of_dereference.zig @@ -0,0 +1,13 @@ +fn entry(a: *addrspace(.gs) i32) *i32 { + return &a.*; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// +// :2:12: error: expected *i32, found *addrspace(.gs) i32 diff --git a/test/incremental/llvm/nested_blocks.zig b/test/incremental/llvm/nested_blocks.zig new file mode 100644 index 0000000000000000000000000000000000000000..47b6c5069bffb04c825bd70c695eaca0d7854269 --- /dev/null +++ b/test/incremental/llvm/nested_blocks.zig @@ -0,0 +1,24 @@ +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +fn foo(ok: bool) i32 { + var val: i32 = blk: { + const val2: i32 = another: { + if (!ok) break :blk 10; + break :another 10; + }; + break :blk val2 + 10; + }; + return val; +} + +pub fn main() void { + assert(foo(false) == 10); + assert(foo(true) == 20); +} + +// run +// backend=stage2, llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/optionals.zig b/test/incremental/llvm/optionals.zig new file mode 100644 index 0000000000000000000000000000000000000000..7d52fc0f17d73b201c3aad46adf461cfe0fe5de2 --- /dev/null +++ b/test/incremental/llvm/optionals.zig @@ -0,0 +1,45 @@ +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +pub fn main() void { + var opt_val: ?i32 = 10; + var null_val: ?i32 = null; + + var val1: i32 = opt_val.?; + const val1_1: i32 = opt_val.?; + var ptr_val1 = &(opt_val.?); + const ptr_val1_1 = &(opt_val.?); + + var val2: i32 = null_val orelse 20; + const val2_2: i32 = null_val orelse 20; + + var value: i32 = 20; + var ptr_val2 = &(null_val orelse value); + + const val3 = opt_val orelse 30; + var val3_var = opt_val orelse 30; + + assert(val1 == 10); + assert(val1_1 == 10); + assert(ptr_val1.* == 10); + assert(ptr_val1_1.* == 10); + + assert(val2 == 20); + assert(val2_2 == 20); + assert(ptr_val2.* == 20); + + assert(val3 == 10); + assert(val3_var == 10); + + (null_val orelse val2) = 1234; + assert(val2 == 1234); + + (opt_val orelse val2) = 5678; + assert(opt_val.? == 5678); +} + +// run +// backend=llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/pointer_keeps_address_space.zig b/test/incremental/llvm/pointer_keeps_address_space.zig new file mode 100644 index 0000000000000000000000000000000000000000..bfd40566f840e493e335031ae44b30c7059e9cf0 --- /dev/null +++ b/test/incremental/llvm/pointer_keeps_address_space.zig @@ -0,0 +1,12 @@ +fn entry(a: *addrspace(.gs) i32) *addrspace(.gs) i32 { + return a; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/pointer_keeps_address_space_when_taking_address_of_dereference.zig b/test/incremental/llvm/pointer_keeps_address_space_when_taking_address_of_dereference.zig new file mode 100644 index 0000000000000000000000000000000000000000..8114e86c5da0b836592fbb851fc82d9d0c0ea56c --- /dev/null +++ b/test/incremental/llvm/pointer_keeps_address_space_when_taking_address_of_dereference.zig @@ -0,0 +1,12 @@ +fn entry(a: *addrspace(.gs) i32) *addrspace(.gs) i32 { + return &a.*; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/pointer_to_explicit_generic_address_space_coerces_to_implicit_pointer.zig b/test/incremental/llvm/pointer_to_explicit_generic_address_space_coerces_to_implicit_pointer.zig new file mode 100644 index 0000000000000000000000000000000000000000..78bc3e4bd6f42e5babba073ffa042ce04fffb071 --- /dev/null +++ b/test/incremental/llvm/pointer_to_explicit_generic_address_space_coerces_to_implicit_pointer.zig @@ -0,0 +1,12 @@ +fn entry(a: *addrspace(.generic) i32) *i32 { + return a; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/pointer_with_different_address_spaces.zig b/test/incremental/llvm/pointer_with_different_address_spaces.zig new file mode 100644 index 0000000000000000000000000000000000000000..8fbd8b07cfccbcd8f8897881ca38d868c68eff4b --- /dev/null +++ b/test/incremental/llvm/pointer_with_different_address_spaces.zig @@ -0,0 +1,13 @@ +fn entry(a: *addrspace(.gs) i32) *addrspace(.fs) i32 { + return a; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// +// :2:12: error: expected *addrspace(.fs) i32, found *addrspace(.gs) i32 diff --git a/test/incremental/llvm/pointers_with_different_address_spaces.zig b/test/incremental/llvm/pointers_with_different_address_spaces.zig new file mode 100644 index 0000000000000000000000000000000000000000..39e5e6a6d176e58fd8237a425e06a9517edf3590 --- /dev/null +++ b/test/incremental/llvm/pointers_with_different_address_spaces.zig @@ -0,0 +1,13 @@ +fn entry(a: ?*addrspace(.gs) i32) *i32 { + return a.?; +} +pub fn main() void { + _ = entry; +} + +// error +// output_mode=Exe +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// +// :2:13: error: expected *i32, found *addrspace(.gs) i32 diff --git a/test/incremental/llvm/rem.zig b/test/incremental/llvm/rem.zig new file mode 100644 index 0000000000000000000000000000000000000000..9804338ea6f946fbac06a3e8737929002ab5bf0b --- /dev/null +++ b/test/incremental/llvm/rem.zig @@ -0,0 +1,15 @@ +fn assert(ok: bool) void { + if (!ok) unreachable; +} +fn rem(lhs: i32, rhs: i32, expected: i32) bool { + return @rem(lhs, rhs) == expected; +} +pub fn main() void { + assert(rem(-5, 3, -2)); + assert(rem(5, 3, 2)); +} + +// run +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/shift_right_plus_left.0.zig b/test/incremental/llvm/shift_right_plus_left.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..23b733c4934ba1dc65ea50ecac37ef447142104a --- /dev/null +++ b/test/incremental/llvm/shift_right_plus_left.0.zig @@ -0,0 +1,12 @@ +pub fn main() void { + var i: u32 = 16; + assert(i >> 1, 8); +} +fn assert(a: u32, b: u32) void { + if (a != b) unreachable; +} + +// run +// backend=llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/shift_right_plus_left.1.zig b/test/incremental/llvm/shift_right_plus_left.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..994b67b9d0bc4c8da0c1c344503885c2a8a0dd16 --- /dev/null +++ b/test/incremental/llvm/shift_right_plus_left.1.zig @@ -0,0 +1,10 @@ +pub fn main() void { + var i: u32 = 16; + assert(i << 1, 32); +} +fn assert(a: u32, b: u32) void { + if (a != b) unreachable; +} + +// run +// diff --git a/test/incremental/llvm/simple_addition_and_subtraction.zig b/test/incremental/llvm/simple_addition_and_subtraction.zig new file mode 100644 index 0000000000000000000000000000000000000000..8a6f419f4a5c64649aa3f7618394c0264b667304 --- /dev/null +++ b/test/incremental/llvm/simple_addition_and_subtraction.zig @@ -0,0 +1,20 @@ +fn add(a: i32, b: i32) i32 { + return a + b; +} + +pub fn main() void { + var a: i32 = -5; + const x = add(a, 7); + var y = add(2, 0); + y -= x; + assert(y == 0); +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/simple_if_statement.zig b/test/incremental/llvm/simple_if_statement.zig new file mode 100644 index 0000000000000000000000000000000000000000..73cf08cda2b45477f87b222dbf5b46cadd6917d9 --- /dev/null +++ b/test/incremental/llvm/simple_if_statement.zig @@ -0,0 +1,16 @@ +fn add(a: i32, b: i32) i32 { + return a + b; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +pub fn main() void { + assert(add(1, 2) == 3); +} + +// run +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/llvm/while_loops.zig b/test/incremental/llvm/while_loops.zig new file mode 100644 index 0000000000000000000000000000000000000000..3b9276cf7f31fd3fc22e5db640533026ce6f0834 --- /dev/null +++ b/test/incremental/llvm/while_loops.zig @@ -0,0 +1,18 @@ +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +pub fn main() void { + var sum: u32 = 0; + var i: u32 = 0; + while (i < 5) : (i += 1) { + sum += i; + } + assert(sum == 10); + assert(i == 5); +} + +// run +// backend=stage2,llvm +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/lower_unnamed_consts_structs.0.zig b/test/incremental/lower_unnamed_consts_structs.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..31232996461ac972b886c5bb30b9c91ff6840d52 --- /dev/null +++ b/test/incremental/lower_unnamed_consts_structs.0.zig @@ -0,0 +1,25 @@ +const Foo = struct { + a: u8, + b: u32, + + fn first(self: *Foo) u8 { + return self.a; + } + + fn second(self: *Foo) u32 { + return self.b; + } +}; + +pub fn main() void { + var foo = Foo{ .a = 1, .b = 5 }; + assert(foo.first() == 1); + assert(foo.second() == 5); +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// diff --git a/test/incremental/lower_unnamed_consts_structs.1.zig b/test/incremental/lower_unnamed_consts_structs.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..37afdc8a09c0f08f0351a4d0201416e17455b07b --- /dev/null +++ b/test/incremental/lower_unnamed_consts_structs.1.zig @@ -0,0 +1,35 @@ +const Foo = struct { + a: u8, + b: u32, + + fn first(self: *Foo) u8 { + return self.a; + } + + fn second(self: *Foo) u32 { + return self.b; + } +}; + +pub fn main() void { + var foo = Foo{ .a = 1, .b = 5 }; + assert(foo.first() == 1); + assert(foo.second() == 5); + + foo.a = 10; + foo.b = 255; + + assert(foo.first() == 10); + assert(foo.second() == 255); + + var foo2 = Foo{ .a = 15, .b = 255 }; + assert(foo2.first() == 15); + assert(foo2.second() == 255); +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// diff --git a/test/incremental/lower_unnamed_consts_structs.2.zig b/test/incremental/lower_unnamed_consts_structs.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..b437c4a030aae4842b371abef19074f27b76d556 --- /dev/null +++ b/test/incremental/lower_unnamed_consts_structs.2.zig @@ -0,0 +1,25 @@ +const Foo = struct { + a: u8, + b: u32, + + fn first(self: *Foo) u8 { + return self.a; + } + + fn second(self: *Foo) u32 { + return self.b; + } +}; + +pub fn main() void { + var foo2 = Foo{ .a = 15, .b = 255 }; + assert(foo2.first() == 15); + assert(foo2.second() == 255); +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// diff --git a/test/incremental/merge_error_sets.0.zig b/test/incremental/merge_error_sets.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..f1f3b968830988d3d8e6105f1bd97d49345a8d08 --- /dev/null +++ b/test/incremental/merge_error_sets.0.zig @@ -0,0 +1,18 @@ +pub fn main() void { + const E = error{ A, B, D } || error{ A, B, C }; + E.A catch {}; + E.B catch {}; + E.C catch {}; + E.D catch {}; + const E2 = error{ X, Y } || @TypeOf(error.Z); + E2.X catch {}; + E2.Y catch {}; + E2.Z catch {}; + assert(anyerror || error{Z} == anyerror); +} +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// diff --git a/test/incremental/merge_error_sets.1.zig b/test/incremental/merge_error_sets.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..81c1cad134ec58f46201197a827608b88389f344 --- /dev/null +++ b/test/incremental/merge_error_sets.1.zig @@ -0,0 +1,9 @@ +pub fn main() void { + const z = true || false; + _ = z; +} + +// error +// +// :2:15: error: expected error set type, found 'bool' +// :2:20: note: '||' merges error sets; 'or' performs boolean OR diff --git a/test/incremental/multiplying_numbers_at_runtime_and_comptime.0.zig b/test/incremental/multiplying_numbers_at_runtime_and_comptime.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..f113928982fbeedd44b3eab66d73c46bba0b3721 --- /dev/null +++ b/test/incremental/multiplying_numbers_at_runtime_and_comptime.0.zig @@ -0,0 +1,11 @@ +pub fn main() void { + mul(3, 4); +} + +fn mul(a: u32, b: u32) void { + if (a * b != 12) unreachable; +} + +// run +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/multiplying_numbers_at_runtime_and_comptime.1.zig b/test/incremental/multiplying_numbers_at_runtime_and_comptime.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..1dff884900dcf2811722ea7a9cc6d99484d0f913 --- /dev/null +++ b/test/incremental/multiplying_numbers_at_runtime_and_comptime.1.zig @@ -0,0 +1,12 @@ +pub fn main() void { + if (x - 12 != 0) unreachable; +} + +fn mul(a: u32, b: u32) u32 { + return a * b; +} + +const x = mul(3, 4); + +// run +// diff --git a/test/incremental/multiplying_numbers_at_runtime_and_comptime.2.zig b/test/incremental/multiplying_numbers_at_runtime_and_comptime.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..31093729baa7924f2f6461d8049ad5e2f40a2ba5 --- /dev/null +++ b/test/incremental/multiplying_numbers_at_runtime_and_comptime.2.zig @@ -0,0 +1,12 @@ +pub fn main() void { + var x: usize = 5; + const y = mul(2, 3, x); + if (y - 30 != 0) unreachable; +} + +inline fn mul(a: usize, b: usize, c: usize) usize { + return a * b * c; +} + +// run +// diff --git a/test/incremental/non_leaf_functions.zig b/test/incremental/non_leaf_functions.zig new file mode 100644 index 0000000000000000000000000000000000000000..cb1737130e0e2cebd51b96e1c11ca8d8f7ee799f --- /dev/null +++ b/test/incremental/non_leaf_functions.zig @@ -0,0 +1,12 @@ +pub fn main() void { + foo(); +} + +fn foo() void { + bar(); +} + +fn bar() void {} + +// run +// diff --git a/test/incremental/optional_payload.0.zig b/test/incremental/optional_payload.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..65296875ff1c27542bf6ee87b3e66d720b023cf5 --- /dev/null +++ b/test/incremental/optional_payload.0.zig @@ -0,0 +1,19 @@ +pub fn main() void { + var x: u32 = undefined; + const maybe_x = byPtr(&x); + assert(maybe_x != null); + maybe_x.?.* = 123; + assert(x == 123); +} + +fn byPtr(x: *u32) ?*u32 { + return x; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// target=x86_64-linux,x86_64-macos +// diff --git a/test/incremental/optional_payload.1.zig b/test/incremental/optional_payload.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..2d4dafffb9bdb898c20465beba6ec86a7ef54985 --- /dev/null +++ b/test/incremental/optional_payload.1.zig @@ -0,0 +1,17 @@ +pub fn main() void { + var x: u32 = undefined; + const maybe_x = byPtr(&x); + assert(maybe_x == null); +} + +fn byPtr(x: *u32) ?*u32 { + _ = x; + return null; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// diff --git a/test/incremental/optional_payload.2.zig b/test/incremental/optional_payload.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..608310923bad2f4a376c63f6673c7f66c2275679 --- /dev/null +++ b/test/incremental/optional_payload.2.zig @@ -0,0 +1,18 @@ +pub fn main() void { + var x: u8 = undefined; + const maybe_x = byPtr(&x); + assert(maybe_x != null); + maybe_x.?.* = 255; + assert(x == 255); +} + +fn byPtr(x: *u8) ?*u8 { + return x; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// diff --git a/test/incremental/optional_payload.3.zig b/test/incremental/optional_payload.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..b81ec398c7a28ed88b5dab7295fcbf9fafa19c83 --- /dev/null +++ b/test/incremental/optional_payload.3.zig @@ -0,0 +1,18 @@ +pub fn main() void { + var x: i8 = undefined; + const maybe_x = byPtr(&x); + assert(maybe_x != null); + maybe_x.?.* = -1; + assert(x == -1); +} + +fn byPtr(x: *i8) ?*i8 { + return x; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// diff --git a/test/incremental/orelse_at_comptime.0.zig b/test/incremental/orelse_at_comptime.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..5397ca3b0afae077fb60745b35c3011576c8a49d --- /dev/null +++ b/test/incremental/orelse_at_comptime.0.zig @@ -0,0 +1,11 @@ +pub fn main() void { + const i: ?u64 = 0; + const result = i orelse 5; + assert(result == 0); +} +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// diff --git a/test/incremental/orelse_at_comptime.1.zig b/test/incremental/orelse_at_comptime.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..7d4fcd3178a34fc251f78f49b54857c759dc9254 --- /dev/null +++ b/test/incremental/orelse_at_comptime.1.zig @@ -0,0 +1,11 @@ +pub fn main() void { + const i: ?u64 = null; + const result = i orelse 5; + assert(result == 5); +} +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// diff --git a/test/incremental/passing_u0_to_function.zig b/test/incremental/passing_u0_to_function.zig new file mode 100644 index 0000000000000000000000000000000000000000..f84c30be8a4128afa10d50a576ad2600bc8ad5a0 --- /dev/null +++ b/test/incremental/passing_u0_to_function.zig @@ -0,0 +1,9 @@ +pub fn main() void { + doNothing(0); +} +fn doNothing(arg: u0) void { + _ = arg; +} + +// run +// diff --git a/test/incremental/plan9/exit.zig b/test/incremental/plan9/exit.zig new file mode 100644 index 0000000000000000000000000000000000000000..735818fb8336c564521926398a7f7d57e7607c07 --- /dev/null +++ b/test/incremental/plan9/exit.zig @@ -0,0 +1,5 @@ +pub fn main() void {} + +// run +// target=x86_64-plan9,aarch64-plan9 +// diff --git a/test/incremental/plan9/hello_world_with_updates.0.zig b/test/incremental/plan9/hello_world_with_updates.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..7e7c3732518c776f31450f33083af7289c7f6e19 --- /dev/null +++ b/test/incremental/plan9/hello_world_with_updates.0.zig @@ -0,0 +1,28 @@ +pub fn main() void { + const str = "Hello World!\n"; + asm volatile ( + \\push $0 + \\push %%r10 + \\push %%r11 + \\push $1 + \\push $0 + \\syscall + \\pop %%r11 + \\pop %%r11 + \\pop %%r11 + \\pop %%r11 + \\pop %%r11 + : + // pwrite + : [syscall_number] "{rbp}" (51), + [hey] "{r11}" (@ptrToInt(str)), + [strlen] "{r10}" (str.len), + : "rcx", "rbp", "r11", "memory" + ); +} + +// run +// target=x86_64-plan9 +// +// Hello World +// diff --git a/test/incremental/plan9/hello_world_with_updates.1.zig b/test/incremental/plan9/hello_world_with_updates.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..4111a8dc08738a33687e328cb75e92c3c9112d98 --- /dev/null +++ b/test/incremental/plan9/hello_world_with_updates.1.zig @@ -0,0 +1,10 @@ +const std = @import("std"); +pub fn main() void { + const str = "Hello World!\n"; + _ = std.os.plan9.pwrite(1, str, str.len, 0); +} + +// run +// +// Hello World +// diff --git a/test/incremental/recursive_fibonacci.zig b/test/incremental/recursive_fibonacci.zig new file mode 100644 index 0000000000000000000000000000000000000000..4e284e3fc1807365381c1fd4098ae8ffc31298d5 --- /dev/null +++ b/test/incremental/recursive_fibonacci.zig @@ -0,0 +1,24 @@ +pub fn main() void { + assert(fib(0) == 0); + assert(fib(1) == 1); + assert(fib(2) == 1); + assert(fib(3) == 2); + assert(fib(10) == 55); + assert(fib(20) == 6765); +} + +fn fib(n: u32) u32 { + if (n < 2) { + return n; + } else { + return fib(n - 2) + fib(n - 1); + } +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// target=arm-linux,x86_64-linux,x86_64-macos,wasm32-wasi +// diff --git a/test/incremental/recursive_inline_function.0.zig b/test/incremental/recursive_inline_function.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..c8333c906516bccd45128a99106fc510a0ea4d9f --- /dev/null +++ b/test/incremental/recursive_inline_function.0.zig @@ -0,0 +1,12 @@ +pub fn main() void { + const y = fibonacci(7); + if (y - 21 != 0) unreachable; +} + +inline fn fibonacci(n: usize) usize { + if (n <= 2) return n; + return fibonacci(n - 2) + fibonacci(n - 1); +} + +// run +// diff --git a/test/incremental/recursive_inline_function.1.zig b/test/incremental/recursive_inline_function.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..139da1c371292c2cbf196d87c3cb80c4fcd3315b --- /dev/null +++ b/test/incremental/recursive_inline_function.1.zig @@ -0,0 +1,16 @@ +// This additionally tests that the compile error reports the correct source location. +// Without storing source locations relative to the owner decl, the compile error +// here would be off by 2 bytes (from the "7" -> "999"). +pub fn main() void { + const y = fibonacci(999); + if (y - 21 != 0) unreachable; +} + +inline fn fibonacci(n: usize) usize { + if (n <= 2) return n; + return fibonacci(n - 2) + fibonacci(n - 1); +} + +// error +// +// :11:21: error: evaluation exceeded 1000 backwards branches diff --git a/test/incremental/redundant_comptime.0.zig b/test/incremental/redundant_comptime.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..c1ecbf7acec79ac1c60f9f09780e317b609ccd12 --- /dev/null +++ b/test/incremental/redundant_comptime.0.zig @@ -0,0 +1,7 @@ +pub fn main() void { + var a: comptime u32 = 0; +} + +// error +// +// :2:12: error: redundant comptime keyword in already comptime scope diff --git a/test/incremental/redundant_comptime.1.zig b/test/incremental/redundant_comptime.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..79226ae8a6b2799dc4e87cfad71219f09a47fc34 --- /dev/null +++ b/test/incremental/redundant_comptime.1.zig @@ -0,0 +1,9 @@ +pub fn main() void { + comptime { + var a: u32 = comptime 0; + } +} + +// error +// +// :3:22: error: redundant comptime keyword in already comptime scope diff --git a/test/incremental/returns_in_try.zig b/test/incremental/returns_in_try.zig new file mode 100644 index 0000000000000000000000000000000000000000..de5a9a3258288c1357d96172f1e8458abe45d4d1 --- /dev/null +++ b/test/incremental/returns_in_try.zig @@ -0,0 +1,16 @@ +pub fn main() !void { + try a(); + try b(); +} + +pub fn a() !void { + defer try b(); +} +pub fn b() !void { + defer return a(); +} + +// error +// +// :7:11: error: 'try' not allowed inside defer expression +// :10:11: error: cannot return from defer expression diff --git a/test/incremental/riscv64-linux/hello_world_with_updates.0.zig b/test/incremental/riscv64-linux/hello_world_with_updates.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..dd119fd1f4366a089f62a796daf96cf437a43f04 --- /dev/null +++ b/test/incremental/riscv64-linux/hello_world_with_updates.0.zig @@ -0,0 +1,21 @@ +pub fn main() void { + print(); +} + +fn print() void { + asm volatile ("ecall" + : + : [number] "{a7}" (64), + [arg1] "{a0}" (1), + [arg2] "{a1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{a2}" ("Hello, World!\n".len), + : "rcx", "r11", "memory" + ); + return; +} + +// run +// target=riscv64-linux +// +// Hello, World! +// diff --git a/test/incremental/riscv64-linux/hello_world_with_updates.1.zig b/test/incremental/riscv64-linux/hello_world_with_updates.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..26718738a9ed459aeb650db31628ad2f2b7de0c6 --- /dev/null +++ b/test/incremental/riscv64-linux/hello_world_with_updates.1.zig @@ -0,0 +1,27 @@ +pub fn main() void { + print(); + print(); + print(); + print(); +} + +fn print() void { + asm volatile ("ecall" + : + : [number] "{a7}" (64), + [arg1] "{a0}" (1), + [arg2] "{a1}" (@ptrToInt("Hello, World!\n")), + [arg3] "{a2}" ("Hello, World!\n".len), + : "rcx", "r11", "memory" + ); + return; +} + +// run +// target=riscv64-linux +// +// Hello, World! +// Hello, World! +// Hello, World! +// Hello, World! +// diff --git a/test/incremental/runtime_bitwise_and.zig b/test/incremental/runtime_bitwise_and.zig new file mode 100644 index 0000000000000000000000000000000000000000..3ba3d3124cc400d5ccd309f392c3fd2c593732e3 --- /dev/null +++ b/test/incremental/runtime_bitwise_and.zig @@ -0,0 +1,16 @@ +pub fn main() void { + var i: u32 = 10; + var j: u32 = 11; + assert(i & 1 == 0); + assert(j & 1 == 1); + var m1: u32 = 0b1111; + var m2: u32 = 0b0000; + assert(m1 & 0b1010 == 0b1010); + assert(m2 & 0b1010 == 0b0000); +} +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// diff --git a/test/incremental/runtime_bitwise_or.zig b/test/incremental/runtime_bitwise_or.zig new file mode 100644 index 0000000000000000000000000000000000000000..b97c2acf0228a3314eccb4ab859eee3a7dc2d77b --- /dev/null +++ b/test/incremental/runtime_bitwise_or.zig @@ -0,0 +1,16 @@ +pub fn main() void { + var i: u32 = 10; + var j: u32 = 11; + assert(i | 1 == 11); + assert(j | 1 == 11); + var m1: u32 = 0b1111; + var m2: u32 = 0b0000; + assert(m1 | 0b1010 == 0b1111); + assert(m2 | 0b1010 == 0b1010); +} +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// diff --git a/test/incremental/save_function_return_values_in_callee_preserved_register.zig b/test/incremental/save_function_return_values_in_callee_preserved_register.zig new file mode 100644 index 0000000000000000000000000000000000000000..a2019038082b4f978de13ebfef6a1439ccbb79f7 --- /dev/null +++ b/test/incremental/save_function_return_values_in_callee_preserved_register.zig @@ -0,0 +1,22 @@ +pub fn main() void { + assert(foo() == 43); +} + +fn foo() u32 { + return bar() + baz(42); +} + +fn bar() u32 { + return 1; +} + +fn baz(x: u32) u32 { + return x; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +// run +// diff --git a/test/incremental/setting_an_address_space_on_a_local_variable.zig b/test/incremental/setting_an_address_space_on_a_local_variable.zig new file mode 100644 index 0000000000000000000000000000000000000000..dad282dc318cdf22005f31b55a5eda38bd8018a4 --- /dev/null +++ b/test/incremental/setting_an_address_space_on_a_local_variable.zig @@ -0,0 +1,8 @@ +export fn entry() i32 { + var foo: i32 addrspace(".general") = 1234; + return foo; +} + +// error +// +// :2:28: error: cannot set address space of local variable 'foo' diff --git a/test/incremental/sparcv9-linux/hello_world.zig b/test/incremental/sparcv9-linux/hello_world.zig new file mode 100644 index 0000000000000000000000000000000000000000..327a8c56ad64fb22e31dc190c076b0886cd6cdde --- /dev/null +++ b/test/incremental/sparcv9-linux/hello_world.zig @@ -0,0 +1,27 @@ +const msg = "Hello, World!\n"; + +pub export fn _start() noreturn { + asm volatile ("ta 0x6d" + : + : [number] "{g1}" (4), + [arg1] "{o0}" (1), + [arg2] "{o1}" (@ptrToInt(msg)), + [arg3] "{o2}" (msg.len), + : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory" + ); + + asm volatile ("ta 0x6d" + : + : [number] "{g1}" (1), + [arg1] "{o0}" (0), + : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory" + ); + + unreachable; +} + +// run +// target=sparcv9-linux +// +// Hello, World! +// diff --git a/test/incremental/try_in_comptime_in_struct_in_test.zig b/test/incremental/try_in_comptime_in_struct_in_test.zig new file mode 100644 index 0000000000000000000000000000000000000000..e88aa13a7b05977ee51d2b63f20baa8f76af159f --- /dev/null +++ b/test/incremental/try_in_comptime_in_struct_in_test.zig @@ -0,0 +1,13 @@ +test "@unionInit on union w/ tag but no fields" { + const S = struct { + comptime { + try expect(false); + } + }; + _ = S; +} + +// error +// is_test=1 +// +// :4:13: error: 'try' outside function scope diff --git a/test/incremental/type_of.0.zig b/test/incremental/type_of.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..d8a97d144470eff0d74fb59464146a17c52f328d --- /dev/null +++ b/test/incremental/type_of.0.zig @@ -0,0 +1,13 @@ +pub fn main() void { + var x: usize = 0; + _ = x; + const z = @TypeOf(x, @as(u128, 5)); + assert(z == u128); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/type_of.1.zig b/test/incremental/type_of.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..86d7d87a19da452234bebb83b69d8cb0ee1fa1a8 --- /dev/null +++ b/test/incremental/type_of.1.zig @@ -0,0 +1,11 @@ +pub fn main() void { + const z = @TypeOf(true); + assert(z == bool); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/type_of.2.zig b/test/incremental/type_of.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..cdbc8121fd71bc5f6603e8c2ab399154ba9b0c84 --- /dev/null +++ b/test/incremental/type_of.2.zig @@ -0,0 +1,9 @@ +pub fn main() void { + _ = @TypeOf(true, 1); +} + +// error +// +// :2:9: error: incompatible types: 'bool' and 'comptime_int' +// :2:17: note: type 'bool' here +// :2:23: note: type 'comptime_int' here diff --git a/test/incremental/unused_labels.0.zig b/test/incremental/unused_labels.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..9afa5facdde2c412bd30cd0d43463c2f90cd2cf2 --- /dev/null +++ b/test/incremental/unused_labels.0.zig @@ -0,0 +1,8 @@ +comptime { + foo: {} +} + +// error +// output_mode=Exe +// +// :2:5: error: unused block label diff --git a/test/incremental/unused_labels.1.zig b/test/incremental/unused_labels.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..c7ff576875dcea1d493816bb78ee56b863023707 --- /dev/null +++ b/test/incremental/unused_labels.1.zig @@ -0,0 +1,7 @@ +comptime { + foo: while (true) {} +} + +// error +// +// :2:5: error: unused while loop label diff --git a/test/incremental/unused_labels.2.zig b/test/incremental/unused_labels.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..babe3c7b0a1dda7aac83115faf4c60d00aa06543 --- /dev/null +++ b/test/incremental/unused_labels.2.zig @@ -0,0 +1,7 @@ +comptime { + foo: for ("foo") |_| {} +} + +// error +// +// :2:5: error: unused for loop label diff --git a/test/incremental/unused_labels.3.zig b/test/incremental/unused_labels.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..e4f3ac05a404667fb60cad6f5fc8bfe43abb457c --- /dev/null +++ b/test/incremental/unused_labels.3.zig @@ -0,0 +1,8 @@ +comptime { + blk: {blk: {}} +} + +// error +// +// :2:11: error: redefinition of label 'blk' +// :2:5: note: previous definition here diff --git a/test/incremental/unused_vars.zig b/test/incremental/unused_vars.zig new file mode 100644 index 0000000000000000000000000000000000000000..85e168d19a9e479bf93e1500c141551a1f8e2fad --- /dev/null +++ b/test/incremental/unused_vars.zig @@ -0,0 +1,7 @@ +pub fn main() void { + const x = 1; +} + +// error +// +// :2:11: error: unused local constant diff --git a/test/incremental/variable_shadowing.0.zig b/test/incremental/variable_shadowing.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..0ab53a78f929e43ba4edb678f290b05dd042b35f --- /dev/null +++ b/test/incremental/variable_shadowing.0.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var i: u32 = 10; + var i: u32 = 10; +} + +// error +// +// :3:9: error: redeclaration of local variable 'i' +// :2:9: note: previous declaration here diff --git a/test/incremental/variable_shadowing.1.zig b/test/incremental/variable_shadowing.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..af24af038dfc0da511879b35a0edd97415320621 --- /dev/null +++ b/test/incremental/variable_shadowing.1.zig @@ -0,0 +1,9 @@ +var testing: i64 = 10; +pub fn main() void { + var testing: i64 = 20; +} + +// error +// +// :3:9: error: local shadows declaration of 'testing' +// :1:1: note: declared here diff --git a/test/incremental/variable_shadowing.2.zig b/test/incremental/variable_shadowing.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..a44372f9b978ce8ed3eef164ce81364637fb2313 --- /dev/null +++ b/test/incremental/variable_shadowing.2.zig @@ -0,0 +1,13 @@ +fn a() type { + return struct { + pub fn b() void { + const c = 6; + const c = 69; + } + }; +} + +// error +// +// :5:19: error: redeclaration of local constant 'c' +// :4:19: note: previous declaration here diff --git a/test/incremental/variable_shadowing.3.zig b/test/incremental/variable_shadowing.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..89288705e1b1d70326edefcc81da2ae02cca7ecf --- /dev/null +++ b/test/incremental/variable_shadowing.3.zig @@ -0,0 +1,10 @@ +pub fn main() void { + var i = 0; + for ("n") |_, i| { + } +} + +// error +// +// :3:19: error: redeclaration of local variable 'i' +// :2:9: note: previous declaration here diff --git a/test/incremental/variable_shadowing.4.zig b/test/incremental/variable_shadowing.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..b798cc13c1dc018a136fcca8ef4548839b8130fd --- /dev/null +++ b/test/incremental/variable_shadowing.4.zig @@ -0,0 +1,10 @@ +pub fn main() void { + var i = 0; + for ("n") |i| { + } +} + +// error +// +// :3:16: error: redeclaration of local variable 'i' +// :2:9: note: previous declaration here diff --git a/test/incremental/variable_shadowing.5.zig b/test/incremental/variable_shadowing.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..484d218ea20e1e46451a1947d8bbedd5aef61d95 --- /dev/null +++ b/test/incremental/variable_shadowing.5.zig @@ -0,0 +1,10 @@ +pub fn main() void { + var i = 0; + while ("n") |i| { + } +} + +// error +// +// :3:18: error: redeclaration of local variable 'i' +// :2:9: note: previous declaration here diff --git a/test/incremental/variable_shadowing.6.zig b/test/incremental/variable_shadowing.6.zig new file mode 100644 index 0000000000000000000000000000000000000000..3e53c4da2fcbb95783caf037ff8849ddd8d07999 --- /dev/null +++ b/test/incremental/variable_shadowing.6.zig @@ -0,0 +1,13 @@ +pub fn main() void { + var i = 0; + while ("n") |bruh| { + _ = bruh; + } else |i| { + + } +} + +// error +// +// :5:13: error: redeclaration of local variable 'i' +// :2:9: note: previous declaration here diff --git a/test/incremental/variable_shadowing.7.zig b/test/incremental/variable_shadowing.7.zig new file mode 100644 index 0000000000000000000000000000000000000000..95888839a7107a446c9e850946b4f4484d599f00 --- /dev/null +++ b/test/incremental/variable_shadowing.7.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var i = 0; + if (true) |i| {} +} + +// error +// +// :3:16: error: redeclaration of local variable 'i' +// :2:9: note: previous declaration here diff --git a/test/incremental/variable_shadowing.8.zig b/test/incremental/variable_shadowing.8.zig new file mode 100644 index 0000000000000000000000000000000000000000..57e616e1d699d2123eb62fc92acda0a0ec02e4fc --- /dev/null +++ b/test/incremental/variable_shadowing.8.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var i = 0; + if (true) |i| {} else |e| {} +} + +// error +// +// :3:16: error: redeclaration of local variable 'i' +// :2:9: note: previous declaration here diff --git a/test/incremental/variable_shadowing.9.zig b/test/incremental/variable_shadowing.9.zig new file mode 100644 index 0000000000000000000000000000000000000000..b8a1198aed4608b4c8fde8f40e3f2f04fdcdef5a --- /dev/null +++ b/test/incremental/variable_shadowing.9.zig @@ -0,0 +1,9 @@ +pub fn main() void { + var i = 0; + if (true) |_| {} else |i| {} +} + +// error +// +// :3:28: error: redeclaration of local variable 'i' +// :2:9: note: previous declaration here diff --git a/test/incremental/wasm-wasi/conditions.0.zig b/test/incremental/wasm-wasi/conditions.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..1167ea85a4413757b8d481b1d672703b2a2ebd2f --- /dev/null +++ b/test/incremental/wasm-wasi/conditions.0.zig @@ -0,0 +1,11 @@ +pub fn main() u8 { + var i: u8 = 5; + if (i > @as(u8, 4)) { + i += 10; + } + return i - 15; +} + +// run +// target=wasm32-wasi +// diff --git a/test/incremental/wasm-wasi/conditions.1.zig b/test/incremental/wasm-wasi/conditions.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..f9f03808b97a134f78276875979f483e8ad317e5 --- /dev/null +++ b/test/incremental/wasm-wasi/conditions.1.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var i: u8 = 5; + if (i < @as(u8, 4)) { + i += 10; + } else { + i = 2; + } + return i - 2; +} + +// run +// diff --git a/test/incremental/wasm-wasi/conditions.2.zig b/test/incremental/wasm-wasi/conditions.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..a80ead9ea54084317c55da133d91bf72f305909f --- /dev/null +++ b/test/incremental/wasm-wasi/conditions.2.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var i: u8 = 5; + if (i < @as(u8, 4)) { + i += 10; + } else if (i == @as(u8, 5)) { + i = 20; + } + return i - 20; +} + +// run +// diff --git a/test/incremental/wasm-wasi/conditions.3.zig b/test/incremental/wasm-wasi/conditions.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..bd016a47f3c78ec39512ad91d0cd373f35a8bed2 --- /dev/null +++ b/test/incremental/wasm-wasi/conditions.3.zig @@ -0,0 +1,16 @@ +pub fn main() u8 { + var i: u8 = 11; + if (i < @as(u8, 4)) { + i += 10; + } else { + if (i > @as(u8, 10)) { + i += 20; + } else { + i = 20; + } + } + return i - 31; +} + +// run +// diff --git a/test/incremental/wasm-wasi/conditions.4.zig b/test/incremental/wasm-wasi/conditions.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..e1bd9ce0f7b6b397c997f416143b0eac10ac7551 --- /dev/null +++ b/test/incremental/wasm-wasi/conditions.4.zig @@ -0,0 +1,15 @@ +pub fn main() void { + assert(foo(true) != @as(i32, 30)); +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +fn foo(ok: bool) i32 { + const x = if (ok) @as(i32, 20) else @as(i32, 10); + return x; +} + +// run +// diff --git a/test/incremental/wasm-wasi/conditions.5.zig b/test/incremental/wasm-wasi/conditions.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..2d5ba338c7aea87a6f059d6f119bd1e0f7641793 --- /dev/null +++ b/test/incremental/wasm-wasi/conditions.5.zig @@ -0,0 +1,20 @@ +pub fn main() void { + assert(foo(false) == @as(i32, 20)); + assert(foo(true) == @as(i32, 30)); +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +fn foo(ok: bool) i32 { + const val: i32 = blk: { + var x: i32 = 1; + if (!ok) break :blk x + @as(i32, 9); + break :blk x + @as(i32, 19); + }; + return val + 10; +} + +// run +// diff --git a/test/incremental/wasm-wasi/error_unions.0.zig b/test/incremental/wasm-wasi/error_unions.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..355698e4b66b7e43c16c1c0b4c92b9161f1c9a11 --- /dev/null +++ b/test/incremental/wasm-wasi/error_unions.0.zig @@ -0,0 +1,15 @@ +pub fn main() void { + var e1 = error.Foo; + var e2 = error.Bar; + assert(e1 != e2); + assert(e1 == error.Foo); + assert(e2 == error.Bar); +} + +fn assert(b: bool) void { + if (!b) unreachable; +} + +// run +// target=wasm32-wasi +// diff --git a/test/incremental/wasm-wasi/error_unions.1.zig b/test/incremental/wasm-wasi/error_unions.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..526e1a110d4c74415d9c3036ae99b828efd133c7 --- /dev/null +++ b/test/incremental/wasm-wasi/error_unions.1.zig @@ -0,0 +1,8 @@ +pub fn main() u8 { + var e: anyerror!u8 = 5; + const i = e catch 10; + return i - 5; +} + +// run +// diff --git a/test/incremental/wasm-wasi/error_unions.2.zig b/test/incremental/wasm-wasi/error_unions.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..b66c7d78c073bb0ef4cd4365fed5873fb66901af --- /dev/null +++ b/test/incremental/wasm-wasi/error_unions.2.zig @@ -0,0 +1,8 @@ +pub fn main() u8 { + var e: anyerror!u8 = error.Foo; + const i = e catch 10; + return i - 10; +} + +// run +// diff --git a/test/incremental/wasm-wasi/error_unions.3.zig b/test/incremental/wasm-wasi/error_unions.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..d37f826272dc32f990891837ed1a1a202a81fbd4 --- /dev/null +++ b/test/incremental/wasm-wasi/error_unions.3.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var e = foo(); + const i = e catch 69; + return i - 5; +} + +fn foo() anyerror!u8 { + return 5; +} + +// run +// diff --git a/test/incremental/wasm-wasi/error_unions.4.zig b/test/incremental/wasm-wasi/error_unions.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..bbc8dd34da3b637871424a45678b5f5c5f67620c --- /dev/null +++ b/test/incremental/wasm-wasi/error_unions.4.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var e = foo(); + const i = e catch 69; + return i - 69; +} + +fn foo() anyerror!u8 { + return error.Bruh; +} + +// run +// diff --git a/test/incremental/wasm-wasi/error_unions.5.zig b/test/incremental/wasm-wasi/error_unions.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..96d52d1de1f3a3eb31741f0bfdd8f8791f92e232 --- /dev/null +++ b/test/incremental/wasm-wasi/error_unions.5.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var e = foo(); + const i = e catch 42; + return i - 42; +} + +fn foo() anyerror!u8 { + return error.Dab; +} + +// run +// diff --git a/test/incremental/wasm-wasi/locals.0.zig b/test/incremental/wasm-wasi/locals.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..f2df242792c6249864477ac4a69614f5032d6ceb --- /dev/null +++ b/test/incremental/wasm-wasi/locals.0.zig @@ -0,0 +1,14 @@ +pub fn main() void { + var i: u8 = 5; + var y: f32 = 42.0; + var x: u8 = 10; + if (false) { + y; + x; + } + if (i != 5) unreachable; +} + +// run +// target=wasm32-wasi +// diff --git a/test/incremental/wasm-wasi/locals.1.zig b/test/incremental/wasm-wasi/locals.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..f7e59e1c02e8a328b3bc84e7d0f1820c92b22d22 --- /dev/null +++ b/test/incremental/wasm-wasi/locals.1.zig @@ -0,0 +1,17 @@ +pub fn main() void { + var i: u8 = 5; + var y: f32 = 42.0; + _ = y; + var x: u8 = 10; + foo(i, x); + i = x; + if (i != 10) unreachable; +} +fn foo(x: u8, y: u8) void { + _ = y; + var i: u8 = 10; + i = x; +} + +// run +// diff --git a/test/incremental/wasm-wasi/optionals.0.zig b/test/incremental/wasm-wasi/optionals.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..e602bf1c8047d4b39bd8bb669df837b7842c3e5d --- /dev/null +++ b/test/incremental/wasm-wasi/optionals.0.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var x: ?u8 = 5; + var y: u8 = 0; + if (x) |val| { + y = val; + } + return y - 5; +} + +// run +// target=wasm32-wasi +// diff --git a/test/incremental/wasm-wasi/optionals.1.zig b/test/incremental/wasm-wasi/optionals.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..26e81b890983755980f6e5701d04faec506ff49d --- /dev/null +++ b/test/incremental/wasm-wasi/optionals.1.zig @@ -0,0 +1,11 @@ +pub fn main() u8 { + var x: ?u8 = null; + var y: u8 = 0; + if (x) |val| { + y = val; + } + return y; +} + +// run +// diff --git a/test/incremental/wasm-wasi/optionals.2.zig b/test/incremental/wasm-wasi/optionals.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..b610c6d2e9669ccbbe921cce11695c0200e2ba25 --- /dev/null +++ b/test/incremental/wasm-wasi/optionals.2.zig @@ -0,0 +1,7 @@ +pub fn main() u8 { + var x: ?u8 = 5; + return x.? - 5; +} + +// run +// diff --git a/test/incremental/wasm-wasi/optionals.3.zig b/test/incremental/wasm-wasi/optionals.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..d513c102827858be70c41f43bda1f6698fad19ed --- /dev/null +++ b/test/incremental/wasm-wasi/optionals.3.zig @@ -0,0 +1,8 @@ +pub fn main() u8 { + var x: u8 = 5; + var y: ?u8 = x; + return y.? - 5; +} + +// run +// diff --git a/test/incremental/wasm-wasi/optionals.4.zig b/test/incremental/wasm-wasi/optionals.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..af3400b322a9b9cec82f8a3798c1806e93aae4c4 --- /dev/null +++ b/test/incremental/wasm-wasi/optionals.4.zig @@ -0,0 +1,13 @@ +pub fn main() u8 { + var val: ?u8 = 5; + while (val) |*v| { + v.* -= 1; + if (v.* == 2) { + val = null; + } + } + return 0; +} + +// run +// diff --git a/test/incremental/wasm-wasi/pointers.0.zig b/test/incremental/wasm-wasi/pointers.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..958ee5ac8860225eb4b5d5bfb051a8fb9ea97699 --- /dev/null +++ b/test/incremental/wasm-wasi/pointers.0.zig @@ -0,0 +1,14 @@ +pub fn main() u8 { + var x: u8 = 0; + + foo(&x); + return x - 2; +} + +fn foo(x: *u8) void { + x.* = 2; +} + +// run +// target=wasm32-wasi +// diff --git a/test/incremental/wasm-wasi/pointers.1.zig b/test/incremental/wasm-wasi/pointers.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..b3649cf5204313da4d2979866de590a04d4494a1 --- /dev/null +++ b/test/incremental/wasm-wasi/pointers.1.zig @@ -0,0 +1,18 @@ +pub fn main() u8 { + var x: u8 = 0; + + foo(&x); + bar(&x); + return x - 4; +} + +fn foo(x: *u8) void { + x.* = 2; +} + +fn bar(x: *u8) void { + x.* += 2; +} + +// run +// diff --git a/test/incremental/wasm-wasi/structs.0.zig b/test/incremental/wasm-wasi/structs.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..03a8938d9ebcf80db462bb7f98d093b97a28003d --- /dev/null +++ b/test/incremental/wasm-wasi/structs.0.zig @@ -0,0 +1,10 @@ +const Example = struct { x: u8 }; + +pub fn main() u8 { + var example: Example = .{ .x = 5 }; + return example.x - 5; +} + +// run +// target=wasm32-wasi +// diff --git a/test/incremental/wasm-wasi/structs.1.zig b/test/incremental/wasm-wasi/structs.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..8d4250e4a2ac87a7271f06275f2bd951f211180c --- /dev/null +++ b/test/incremental/wasm-wasi/structs.1.zig @@ -0,0 +1,10 @@ +const Example = struct { x: u8 }; + +pub fn main() u8 { + var example: Example = .{ .x = 5 }; + example.x = 10; + return example.x - 10; +} + +// run +// diff --git a/test/incremental/wasm-wasi/structs.2.zig b/test/incremental/wasm-wasi/structs.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..b1d3cbf080accc76edd40158f4f7c5946f9c7c79 --- /dev/null +++ b/test/incremental/wasm-wasi/structs.2.zig @@ -0,0 +1,9 @@ +const Example = struct { x: u8, y: u8 }; + +pub fn main() u8 { + var example: Example = .{ .x = 5, .y = 10 }; + return example.y + example.x - 15; +} + +// run +// diff --git a/test/incremental/wasm-wasi/structs.3.zig b/test/incremental/wasm-wasi/structs.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..558b5a1e2d7109fdf53d0c9b862718588178440e --- /dev/null +++ b/test/incremental/wasm-wasi/structs.3.zig @@ -0,0 +1,12 @@ +const Example = struct { x: u8, y: u8 }; + +pub fn main() u8 { + var example: Example = .{ .x = 5, .y = 10 }; + var example2: Example = .{ .x = 10, .y = 20 }; + + example = example2; + return example.y + example.x - 30; +} + +// run +// diff --git a/test/incremental/wasm-wasi/structs.4.zig b/test/incremental/wasm-wasi/structs.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..2d37446c5692f49b68d0de55488e995b1011e075 --- /dev/null +++ b/test/incremental/wasm-wasi/structs.4.zig @@ -0,0 +1,11 @@ +const Example = struct { x: u8, y: u8 }; + +pub fn main() u8 { + var example: Example = .{ .x = 5, .y = 10 }; + + example = .{ .x = 10, .y = 20 }; + return example.y + example.x - 30; +} + +// run +// diff --git a/test/incremental/wasm-wasi/switch.0.zig b/test/incremental/wasm-wasi/switch.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..d0c0e43f8fb8d9a5cc41e1636c41ec24e9ffce71 --- /dev/null +++ b/test/incremental/wasm-wasi/switch.0.zig @@ -0,0 +1,15 @@ +pub fn main() u8 { + var val: u8 = 1; + var a: u8 = switch (val) { + 0, 1 => 2, + 2 => 3, + 3 => 4, + else => 5, + }; + + return a - 2; +} + +// run +// target=wasm32-wasi +// diff --git a/test/incremental/wasm-wasi/switch.1.zig b/test/incremental/wasm-wasi/switch.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..fe503bf212e45fb1c74940b227b33221868e146e --- /dev/null +++ b/test/incremental/wasm-wasi/switch.1.zig @@ -0,0 +1,14 @@ +pub fn main() u8 { + var val: u8 = 2; + var a: u8 = switch (val) { + 0, 1 => 2, + 2 => 3, + 3 => 4, + else => 5, + }; + + return a - 3; +} + +// run +// diff --git a/test/incremental/wasm-wasi/switch.2.zig b/test/incremental/wasm-wasi/switch.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..24f40d8402ca658e294b45e1d771b9f5697efb90 --- /dev/null +++ b/test/incremental/wasm-wasi/switch.2.zig @@ -0,0 +1,14 @@ +pub fn main() u8 { + var val: u8 = 10; + var a: u8 = switch (val) { + 0, 1 => 2, + 2 => 3, + 3 => 4, + else => 5, + }; + + return a - 5; +} + +// run +// diff --git a/test/incremental/wasm-wasi/switch.3.zig b/test/incremental/wasm-wasi/switch.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..e0b55db3bff6a6809e7ce5285ccce49f40b8c82b --- /dev/null +++ b/test/incremental/wasm-wasi/switch.3.zig @@ -0,0 +1,15 @@ +const MyEnum = enum { One, Two, Three }; + +pub fn main() u8 { + var val: MyEnum = .Two; + var a: u8 = switch (val) { + .One => 1, + .Two => 2, + .Three => 3, + }; + + return a - 2; +} + +// run +// diff --git a/test/incremental/wasm-wasi/while_loops.0.zig b/test/incremental/wasm-wasi/while_loops.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..721b127ff54aeb2d65f03dd4cfdc8315445529f6 --- /dev/null +++ b/test/incremental/wasm-wasi/while_loops.0.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var i: u8 = 0; + while (i < @as(u8, 5)) { + i += 1; + } + + return i - 5; +} + +// run +// target=wasm32-wasi +// diff --git a/test/incremental/wasm-wasi/while_loops.1.zig b/test/incremental/wasm-wasi/while_loops.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..715a813b65e66c4b1f42e4b00b397b5933b0de35 --- /dev/null +++ b/test/incremental/wasm-wasi/while_loops.1.zig @@ -0,0 +1,11 @@ +pub fn main() u8 { + var i: u8 = 0; + while (i < @as(u8, 10)) { + var x: u8 = 1; + i += x; + } + return i - 10; +} + +// run +// diff --git a/test/incremental/wasm-wasi/while_loops.2.zig b/test/incremental/wasm-wasi/while_loops.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..7ad8101c3777d2a94289fedd8406693f4b7c0861 --- /dev/null +++ b/test/incremental/wasm-wasi/while_loops.2.zig @@ -0,0 +1,12 @@ +pub fn main() u8 { + var i: u8 = 0; + while (i < @as(u8, 10)) { + var x: u8 = 1; + i += x; + if (i == @as(u8, 5)) break; + } + return i - 5; +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.0.zig b/test/incremental/x86_64-linux/assert_function.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..ab34f5328dc90498078384ce434c0e11905f0487 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.0.zig @@ -0,0 +1,15 @@ +pub fn main() void { + add(3, 4); +} + +fn add(a: u32, b: u32) void { + assert(a + b == 7); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// target=x86_64-linux +// diff --git a/test/incremental/x86_64-linux/assert_function.1.zig b/test/incremental/x86_64-linux/assert_function.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..ac2df25d8556c661b48a9382d200283073d5d00b --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.1.zig @@ -0,0 +1,17 @@ +pub fn main() void { + add(3, 4); +} + +fn add(a: u32, b: u32) void { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + assert(e == 14); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.10.zig b/test/incremental/x86_64-linux/assert_function.10.zig new file mode 100644 index 0000000000000000000000000000000000000000..b3f1610cd62b71553f20959ef9cf4cec51d8f498 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.10.zig @@ -0,0 +1,27 @@ +pub fn main() void { + assert(add(3, 4) == 116); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + break :blk j; + }; + const y = x + a; // 113 + const z = y + a; // 116 + return z; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.11.zig b/test/incremental/x86_64-linux/assert_function.11.zig new file mode 100644 index 0000000000000000000000000000000000000000..d64130a6775b250ca18a5900e912391dc732a7f7 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.11.zig @@ -0,0 +1,66 @@ +pub fn main() void { + assert(add(3, 4) == 1221); + assert(mul(3, 4) == 21609); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + const k = i + j; // 210 + const l = j + k; // 320 + const m = l + c; // 327 + const n = m + d; // 337 + const o = n + e; // 351 + const p = o + f; // 375 + const q = p + g; // 413 + const r = q + h; // 475 + const s = r + i; // 575 + const t = s + j; // 685 + const u = t + k; // 895 + const v = u + l; // 1215 + break :blk v; + }; + const y = x + a; // 1218 + const z = y + a; // 1221 + return z; +} + +fn mul(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a * a * a * a; // 81 + const d = a * a * a * b; // 108 + const e = a * a * b * a; // 108 + const f = a * a * b * b; // 144 + const g = a * b * a * a; // 108 + const h = a * b * a * b; // 144 + const i = a * b * b * a; // 144 + const j = a * b * b * b; // 192 + const k = b * a * a * a; // 108 + const l = b * a * a * b; // 144 + const m = b * a * b * a; // 144 + const n = b * a * b * b; // 192 + const o = b * b * a * a; // 144 + const p = b * b * a * b; // 192 + const q = b * b * b * a; // 192 + const r = b * b * b * b; // 256 + const s = c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r; // 2401 + break :blk s; + }; + const y = x * a; // 7203 + const z = y * a; // 21609 + return z; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.12.zig b/test/incremental/x86_64-linux/assert_function.12.zig new file mode 100644 index 0000000000000000000000000000000000000000..4f64c1e0626879a2004d66080292dc7cf962065d --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.12.zig @@ -0,0 +1,47 @@ +pub fn main() void { + assert(add(3, 4) == 791); + assert(add(4, 3) == 79); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = if (a < b) blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + const k = i + j; // 210 + const l = k + c; // 217 + const m = l + d; // 227 + const n = m + e; // 241 + const o = n + f; // 265 + const p = o + g; // 303 + const q = p + h; // 365 + const r = q + i; // 465 + const s = r + j; // 575 + const t = s + k; // 785 + break :blk t; + } else blk: { + const t = b + b + a; // 10 + const c = a + t; // 14 + const d = c + t; // 24 + const e = d + t; // 34 + const f = e + t; // 44 + const g = f + t; // 54 + const h = c + g; // 68 + break :blk h + b; // 71 + }; + const y = x + a; // 788, 75 + const z = y + a; // 791, 79 + return z; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.13.zig b/test/incremental/x86_64-linux/assert_function.13.zig new file mode 100644 index 0000000000000000000000000000000000000000..240abf0108dbe8c08040533524872e543fd6d621 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.13.zig @@ -0,0 +1,19 @@ +pub fn main() void { + const ignore = + \\ cool thx + \\ + ; + _ = ignore; + add('ぁ', '\x03'); +} + +fn add(a: u32, b: u32) void { + assert(a + b == 12356); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.14.zig b/test/incremental/x86_64-linux/assert_function.14.zig new file mode 100644 index 0000000000000000000000000000000000000000..d25100dccee2bda1f615c2d870ee477c1252bed3 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.14.zig @@ -0,0 +1,17 @@ +pub fn main() void { + add(aa, bb); +} + +const aa = 'ぁ'; +const bb = '\x03'; + +fn add(a: u32, b: u32) void { + assert(a + b == 12356); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.15.zig b/test/incremental/x86_64-linux/assert_function.15.zig new file mode 100644 index 0000000000000000000000000000000000000000..33ae1ed5af1279b74f089003e7b9665b55c2489b --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.15.zig @@ -0,0 +1,10 @@ +pub fn main() void { + assert("hello"[0] == 'h'); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.16.zig b/test/incremental/x86_64-linux/assert_function.16.zig new file mode 100644 index 0000000000000000000000000000000000000000..eef113642324434c4af1723aac512a57192ce726 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.16.zig @@ -0,0 +1,11 @@ +const hello = "hello".*; +pub fn main() void { + assert(hello[1] == 'e'); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.17.zig b/test/incremental/x86_64-linux/assert_function.17.zig new file mode 100644 index 0000000000000000000000000000000000000000..ac9dce3079f6444476afd65757675726390946cf --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.17.zig @@ -0,0 +1,11 @@ +pub fn main() void { + var i: u64 = 0xFFEEDDCCBBAA9988; + assert(i == 0xFFEEDDCCBBAA9988); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.18.zig b/test/incremental/x86_64-linux/assert_function.18.zig new file mode 100644 index 0000000000000000000000000000000000000000..31cf1207f3dc07541a4210641ee136eb0ba385b0 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.18.zig @@ -0,0 +1,35 @@ +const builtin = @import("builtin"); + +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + for ("hello") |_| print(); +} + +fn print() void { + switch (builtin.os.tag) { + .linux => { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("hello\n")), + [arg3] "{rdx}" (6), + : "rcx", "r11", "memory" + ); + }, + .macos => { + _ = write(1, @ptrToInt("hello\n"), 6); + }, + else => unreachable, + } +} + +// run +// +// hello +// hello +// hello +// hello +// hello +// diff --git a/test/incremental/x86_64-linux/assert_function.2.zig b/test/incremental/x86_64-linux/assert_function.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..8c1c510486185f4116841577473c901e13528283 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.2.zig @@ -0,0 +1,21 @@ +pub fn main() void { + add(3, 4); +} + +fn add(a: u32, b: u32) void { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + assert(i == 100); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.3.zig b/test/incremental/x86_64-linux/assert_function.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..a6829f8e0239f8c01f0a1e4e1cf42e9ed035176b --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.3.zig @@ -0,0 +1,22 @@ +pub fn main() void { + add(3, 4); +} + +fn add(a: u32, b: u32) void { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + assert(j == 110); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.4.zig b/test/incremental/x86_64-linux/assert_function.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..69df4354c3eb8d72d4c91b226fbf4b4c0eddedaf --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.4.zig @@ -0,0 +1,15 @@ +pub fn main() void { + assert(add(3, 4) == 7); + assert(add(20, 10) == 30); +} + +fn add(a: u32, b: u32) u32 { + return a + b; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.5.zig b/test/incremental/x86_64-linux/assert_function.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..89f3f7df4fd3f42da6650c27dff3c8160b281860 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.5.zig @@ -0,0 +1,19 @@ +pub fn main() void { + assert(add(3, 4) == 7); + assert(add(20, 10) == 30); +} + +fn add(a: u32, b: u32) u32 { + var x: u32 = undefined; + x = 0; + x += a; + x += b; + return x; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.6.zig b/test/incremental/x86_64-linux/assert_function.6.zig new file mode 100644 index 0000000000000000000000000000000000000000..1b1b75e68ea72902208bd0889c38202922b89a51 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.6.zig @@ -0,0 +1,9 @@ +pub fn main() void { + const a: u32 = 2; + const b: ?u32 = a; + const c = b.?; + if (c != 2) unreachable; +} + +// run +// diff --git a/test/incremental/x86_64-linux/assert_function.7.zig b/test/incremental/x86_64-linux/assert_function.7.zig new file mode 100644 index 0000000000000000000000000000000000000000..e6d18a5c3f7e1f2f71ffce96c309b8f862541fb0 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.7.zig @@ -0,0 +1,28 @@ +pub fn main() void { + var i: u32 = 0; + while (i < 4) : (i += 1) print(); + assert(i == 4); +} + +fn print() void { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("hello\n")), + [arg3] "{rdx}" (6), + : "rcx", "r11", "memory" + ); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// +// hello +// hello +// hello +// hello +// diff --git a/test/incremental/x86_64-linux/assert_function.8.zig b/test/incremental/x86_64-linux/assert_function.8.zig new file mode 100644 index 0000000000000000000000000000000000000000..ae618cc063eb8921371563dfa6b185f2e0c3ade7 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.8.zig @@ -0,0 +1,24 @@ +pub fn main() void { + var i: u32 = 0; + inline while (i < 4) : (i += 1) print(); + assert(i == 4); +} + +fn print() void { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("hello\n")), + [arg3] "{rdx}" (6), + : "rcx", "r11", "memory" + ); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// error +// +// :3:21: error: unable to resolve comptime value diff --git a/test/incremental/x86_64-linux/assert_function.9.zig b/test/incremental/x86_64-linux/assert_function.9.zig new file mode 100644 index 0000000000000000000000000000000000000000..c754bb771133d8b3a595ec9fe46c48c4c6408e61 --- /dev/null +++ b/test/incremental/x86_64-linux/assert_function.9.zig @@ -0,0 +1,22 @@ +pub fn main() void { + assert(add(3, 4) == 20); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + break :blk e; + }; + const y = x + a; // 17 + const z = y + a; // 20 + return z; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-linux/comptime_var.0.zig b/test/incremental/x86_64-linux/comptime_var.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..45f87ecaa13835c447536cbc60dfb84572025a80 --- /dev/null +++ b/test/incremental/x86_64-linux/comptime_var.0.zig @@ -0,0 +1,12 @@ +pub fn main() void { + var a: u32 = 0; + comptime var b: u32 = 0; + if (a == 0) b = 3; +} + +// error +// output_mode=Exe +// target=x86_64-linux +// +// :4:21: error: store to comptime variable depends on runtime condition +// :4:11: note: runtime condition here diff --git a/test/incremental/x86_64-linux/comptime_var.1.zig b/test/incremental/x86_64-linux/comptime_var.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..efc51aafe3e7572bb8815d5e75ec4e4b00761499 --- /dev/null +++ b/test/incremental/x86_64-linux/comptime_var.1.zig @@ -0,0 +1,13 @@ +pub fn main() void { + var a: u32 = 0; + comptime var b: u32 = 0; + switch (a) { + 0 => {}, + else => b = 3, + } +} + +// error +// +// :6:21: error: store to comptime variable depends on runtime condition +// :4:13: note: runtime condition here diff --git a/test/incremental/x86_64-linux/comptime_var.2.zig b/test/incremental/x86_64-linux/comptime_var.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..72bdfad90c34a452e3be002cc82ad7315e9fe7d3 --- /dev/null +++ b/test/incremental/x86_64-linux/comptime_var.2.zig @@ -0,0 +1,22 @@ +pub fn main() void { + comptime var len: u32 = 5; + print(len); + len += 9; + print(len); +} + +fn print(len: usize) void { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), + [arg3] "{rdx}" (len), + : "rcx", "r11", "memory" + ); +} + +// run +// +// HelloHello, World! +// diff --git a/test/incremental/x86_64-linux/comptime_var.3.zig b/test/incremental/x86_64-linux/comptime_var.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..d4e6d85d9d38fa74e139ece4b911521069f80acd --- /dev/null +++ b/test/incremental/x86_64-linux/comptime_var.3.zig @@ -0,0 +1,10 @@ +comptime { + var x: i32 = 1; + x += 1; + if (x != 1) unreachable; +} +pub fn main() void {} + +// error +// +// :4:17: error: unable to resolve comptime value diff --git a/test/incremental/x86_64-linux/comptime_var.4.zig b/test/incremental/x86_64-linux/comptime_var.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..74da6ef448edd5534b49b1f850673863b4188b99 --- /dev/null +++ b/test/incremental/x86_64-linux/comptime_var.4.zig @@ -0,0 +1,9 @@ +pub fn main() void { + comptime var i: u64 = 0; + while (i < 5) : (i += 1) {} +} + +// error +// +// :3:24: error: cannot store to comptime variable in non-inline loop +// :3:5: note: non-inline loop here diff --git a/test/incremental/x86_64-linux/comptime_var.5.zig b/test/incremental/x86_64-linux/comptime_var.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..76a06f3d4b5931e8fd23271dcc593e07ff414a7f --- /dev/null +++ b/test/incremental/x86_64-linux/comptime_var.5.zig @@ -0,0 +1,15 @@ +pub fn main() void { + var a: u32 = 0; + if (a == 0) { + comptime var b: u32 = 0; + b = 1; + } +} +comptime { + var x: i32 = 1; + x += 1; + if (x != 2) unreachable; +} + +// run +// diff --git a/test/incremental/x86_64-linux/comptime_var.6.zig b/test/incremental/x86_64-linux/comptime_var.6.zig new file mode 100644 index 0000000000000000000000000000000000000000..2790949561cb9d11c777288410d34feebc35a1f0 --- /dev/null +++ b/test/incremental/x86_64-linux/comptime_var.6.zig @@ -0,0 +1,20 @@ +pub fn main() void { + comptime var i: u64 = 2; + inline while (i < 6) : (i += 1) { + print(i); + } +} +fn print(len: usize) void { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("Hello")), + [arg3] "{rdx}" (len), + : "rcx", "r11", "memory" + ); +} + +// run +// +// HeHelHellHello diff --git a/test/incremental/x86_64-linux/hello_world_with_updates.0.zig b/test/incremental/x86_64-linux/hello_world_with_updates.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..960fae5e644fa67cb8f46decb7c774ae7a0719d1 --- /dev/null +++ b/test/incremental/x86_64-linux/hello_world_with_updates.0.zig @@ -0,0 +1,5 @@ +// error +// output_mode=Exe +// target=x86_64-linux +// +// :109:9: error: struct 'tmp.tmp' has no member named 'main' diff --git a/test/incremental/x86_64-linux/hello_world_with_updates.1.zig b/test/incremental/x86_64-linux/hello_world_with_updates.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..0f347b7f5069ccefb13bd680334cbba2a4beb4e7 --- /dev/null +++ b/test/incremental/x86_64-linux/hello_world_with_updates.1.zig @@ -0,0 +1,5 @@ +pub export fn _start() noreturn {} + +// error +// +// :1:34: error: expected noreturn, found void diff --git a/test/incremental/x86_64-linux/hello_world_with_updates.2.zig b/test/incremental/x86_64-linux/hello_world_with_updates.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..fcea1870ce59ef67264c3be650beafabbd5a97e3 --- /dev/null +++ b/test/incremental/x86_64-linux/hello_world_with_updates.2.zig @@ -0,0 +1,32 @@ +pub export fn _start() noreturn { + print(); + + exit(); +} + +fn print() void { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), + [arg3] "{rdx}" (14), + : "rcx", "r11", "memory" + ); + return; +} + +fn exit() noreturn { + asm volatile ("syscall" + : + : [number] "{rax}" (231), + [arg1] "{rdi}" (0), + : "rcx", "r11", "memory" + ); + unreachable; +} + +// run +// +// Hello, World! +// diff --git a/test/incremental/x86_64-linux/hello_world_with_updates.3.zig b/test/incremental/x86_64-linux/hello_world_with_updates.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..7812023372e14acc9c4c93441e913126d1e7de1d --- /dev/null +++ b/test/incremental/x86_64-linux/hello_world_with_updates.3.zig @@ -0,0 +1,20 @@ +pub fn main() void { + print(); +} + +fn print() void { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), + [arg3] "{rdx}" (14), + : "rcx", "r11", "memory" + ); + return; +} + +// run +// +// Hello, World! +// diff --git a/test/incremental/x86_64-linux/hello_world_with_updates.4.zig b/test/incremental/x86_64-linux/hello_world_with_updates.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..cdf47012b8306d2a234871842bfe00da550522de --- /dev/null +++ b/test/incremental/x86_64-linux/hello_world_with_updates.4.zig @@ -0,0 +1,20 @@ +pub fn main() void { + print(); +} + +fn print() void { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), + [arg3] "{rdx}" (104), + : "rcx", "r11", "memory" + ); + return; +} + +// run +// +// What is up? This is a longer message that will force the data to be relocated in virtual address space. +// diff --git a/test/incremental/x86_64-linux/hello_world_with_updates.5.zig b/test/incremental/x86_64-linux/hello_world_with_updates.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..68c1e305f713135321cd2000bdd9b50dc2020c8e --- /dev/null +++ b/test/incremental/x86_64-linux/hello_world_with_updates.5.zig @@ -0,0 +1,22 @@ +pub fn main() void { + print(); + print(); +} + +fn print() void { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), + [arg3] "{rdx}" (104), + : "rcx", "r11", "memory" + ); + return; +} + +// run +// +// What is up? This is a longer message that will force the data to be relocated in virtual address space. +// What is up? This is a longer message that will force the data to be relocated in virtual address space. +// diff --git a/test/incremental/x86_64-linux/inline_assembly.0.zig b/test/incremental/x86_64-linux/inline_assembly.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..e3c0f3badbb61fa8a53a63bcabb7b90edbe4657b --- /dev/null +++ b/test/incremental/x86_64-linux/inline_assembly.0.zig @@ -0,0 +1,16 @@ +pub fn main() void { + const number = 1234; + const x = asm volatile ("syscall" + : [o] "{rax}" (-> number), + : [number] "{rax}" (231), + [arg1] "{rdi}" (60), + : "rcx", "r11", "memory" + ); + _ = x; +} + +// error +// output_mode=Exe +// target=x86_64-linux +// +// :4:27: error: expected type, found comptime_int diff --git a/test/incremental/x86_64-linux/inline_assembly.1.zig b/test/incremental/x86_64-linux/inline_assembly.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..b35014b0f6b6afa26cd92e7496edbc70c2b90dbf --- /dev/null +++ b/test/incremental/x86_64-linux/inline_assembly.1.zig @@ -0,0 +1,15 @@ +const S = struct { + comptime { + asm volatile ( + \\zig_moment: + \\syscall + ); + } +}; +pub fn main() void { + _ = S; +} + +// error +// +// :3:13: error: volatile is meaningless on global assembly diff --git a/test/incremental/x86_64-linux/inline_assembly.2.zig b/test/incremental/x86_64-linux/inline_assembly.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..1695265ab4ebcbb6a2625bb9abdffb0d751eec07 --- /dev/null +++ b/test/incremental/x86_64-linux/inline_assembly.2.zig @@ -0,0 +1,12 @@ +pub fn main() void { + var bruh: u32 = 1; + asm ("" + : + : [bruh] "{rax}" (4) + : "memory" + ); +} + +// error +// +// :3:5: error: assembly expression with no output must be marked volatile diff --git a/test/incremental/x86_64-linux/inline_assembly.3.zig b/test/incremental/x86_64-linux/inline_assembly.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..765eaeb97eb2f8373afff7399051a2fca6269070 --- /dev/null +++ b/test/incremental/x86_64-linux/inline_assembly.3.zig @@ -0,0 +1,12 @@ +pub fn main() void {} +comptime { + asm ("" + : + : [bruh] "{rax}" (4) + : "memory" + ); +} + +// error +// +// :3:5: error: global assembly cannot have inputs, outputs, or clobbers diff --git a/test/incremental/x86_64-linux/only_1_function_and_it_gets_updated.0.zig b/test/incremental/x86_64-linux/only_1_function_and_it_gets_updated.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..ecba1c8133714f48d0423b98c9a213a057550ad1 --- /dev/null +++ b/test/incremental/x86_64-linux/only_1_function_and_it_gets_updated.0.zig @@ -0,0 +1,13 @@ +pub export fn _start() noreturn { + asm volatile ("syscall" + : + : [number] "{rax}" (60), // exit + [arg1] "{rdi}" (0), + : "rcx", "r11", "memory" + ); + unreachable; +} + +// run +// target=x86_64-linux +// diff --git a/test/incremental/x86_64-linux/only_1_function_and_it_gets_updated.1.zig b/test/incremental/x86_64-linux/only_1_function_and_it_gets_updated.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..529acbcf38132bb09f0a47adc2a128ac7c7b7ac5 --- /dev/null +++ b/test/incremental/x86_64-linux/only_1_function_and_it_gets_updated.1.zig @@ -0,0 +1,12 @@ +pub export fn _start() noreturn { + asm volatile ("syscall" + : + : [number] "{rax}" (231), // exit_group + [arg1] "{rdi}" (0), + : "rcx", "r11", "memory" + ); + unreachable; +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.0.zig b/test/incremental/x86_64-macos/assert_function.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..20e5cf0b97a96116457be9805f66190f5d7f8b4c --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.0.zig @@ -0,0 +1,15 @@ +pub fn main() void { + add(3, 4); +} + +fn add(a: u32, b: u32) void { + assert(a + b == 7); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// target=x86_64-macos +// diff --git a/test/incremental/x86_64-macos/assert_function.1.zig b/test/incremental/x86_64-macos/assert_function.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..ac2df25d8556c661b48a9382d200283073d5d00b --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.1.zig @@ -0,0 +1,17 @@ +pub fn main() void { + add(3, 4); +} + +fn add(a: u32, b: u32) void { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + assert(e == 14); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.10.zig b/test/incremental/x86_64-macos/assert_function.10.zig new file mode 100644 index 0000000000000000000000000000000000000000..b3f1610cd62b71553f20959ef9cf4cec51d8f498 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.10.zig @@ -0,0 +1,27 @@ +pub fn main() void { + assert(add(3, 4) == 116); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + break :blk j; + }; + const y = x + a; // 113 + const z = y + a; // 116 + return z; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.11.zig b/test/incremental/x86_64-macos/assert_function.11.zig new file mode 100644 index 0000000000000000000000000000000000000000..d64130a6775b250ca18a5900e912391dc732a7f7 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.11.zig @@ -0,0 +1,66 @@ +pub fn main() void { + assert(add(3, 4) == 1221); + assert(mul(3, 4) == 21609); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + const k = i + j; // 210 + const l = j + k; // 320 + const m = l + c; // 327 + const n = m + d; // 337 + const o = n + e; // 351 + const p = o + f; // 375 + const q = p + g; // 413 + const r = q + h; // 475 + const s = r + i; // 575 + const t = s + j; // 685 + const u = t + k; // 895 + const v = u + l; // 1215 + break :blk v; + }; + const y = x + a; // 1218 + const z = y + a; // 1221 + return z; +} + +fn mul(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a * a * a * a; // 81 + const d = a * a * a * b; // 108 + const e = a * a * b * a; // 108 + const f = a * a * b * b; // 144 + const g = a * b * a * a; // 108 + const h = a * b * a * b; // 144 + const i = a * b * b * a; // 144 + const j = a * b * b * b; // 192 + const k = b * a * a * a; // 108 + const l = b * a * a * b; // 144 + const m = b * a * b * a; // 144 + const n = b * a * b * b; // 192 + const o = b * b * a * a; // 144 + const p = b * b * a * b; // 192 + const q = b * b * b * a; // 192 + const r = b * b * b * b; // 256 + const s = c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r; // 2401 + break :blk s; + }; + const y = x * a; // 7203 + const z = y * a; // 21609 + return z; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.12.zig b/test/incremental/x86_64-macos/assert_function.12.zig new file mode 100644 index 0000000000000000000000000000000000000000..4f64c1e0626879a2004d66080292dc7cf962065d --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.12.zig @@ -0,0 +1,47 @@ +pub fn main() void { + assert(add(3, 4) == 791); + assert(add(4, 3) == 79); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = if (a < b) blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + const k = i + j; // 210 + const l = k + c; // 217 + const m = l + d; // 227 + const n = m + e; // 241 + const o = n + f; // 265 + const p = o + g; // 303 + const q = p + h; // 365 + const r = q + i; // 465 + const s = r + j; // 575 + const t = s + k; // 785 + break :blk t; + } else blk: { + const t = b + b + a; // 10 + const c = a + t; // 14 + const d = c + t; // 24 + const e = d + t; // 34 + const f = e + t; // 44 + const g = f + t; // 54 + const h = c + g; // 68 + break :blk h + b; // 71 + }; + const y = x + a; // 788, 75 + const z = y + a; // 791, 79 + return z; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.13.zig b/test/incremental/x86_64-macos/assert_function.13.zig new file mode 100644 index 0000000000000000000000000000000000000000..240abf0108dbe8c08040533524872e543fd6d621 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.13.zig @@ -0,0 +1,19 @@ +pub fn main() void { + const ignore = + \\ cool thx + \\ + ; + _ = ignore; + add('ぁ', '\x03'); +} + +fn add(a: u32, b: u32) void { + assert(a + b == 12356); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.14.zig b/test/incremental/x86_64-macos/assert_function.14.zig new file mode 100644 index 0000000000000000000000000000000000000000..d25100dccee2bda1f615c2d870ee477c1252bed3 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.14.zig @@ -0,0 +1,17 @@ +pub fn main() void { + add(aa, bb); +} + +const aa = 'ぁ'; +const bb = '\x03'; + +fn add(a: u32, b: u32) void { + assert(a + b == 12356); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.15.zig b/test/incremental/x86_64-macos/assert_function.15.zig new file mode 100644 index 0000000000000000000000000000000000000000..33ae1ed5af1279b74f089003e7b9665b55c2489b --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.15.zig @@ -0,0 +1,10 @@ +pub fn main() void { + assert("hello"[0] == 'h'); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.16.zig b/test/incremental/x86_64-macos/assert_function.16.zig new file mode 100644 index 0000000000000000000000000000000000000000..eef113642324434c4af1723aac512a57192ce726 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.16.zig @@ -0,0 +1,11 @@ +const hello = "hello".*; +pub fn main() void { + assert(hello[1] == 'e'); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.17.zig b/test/incremental/x86_64-macos/assert_function.17.zig new file mode 100644 index 0000000000000000000000000000000000000000..ac9dce3079f6444476afd65757675726390946cf --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.17.zig @@ -0,0 +1,11 @@ +pub fn main() void { + var i: u64 = 0xFFEEDDCCBBAA9988; + assert(i == 0xFFEEDDCCBBAA9988); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.18.zig b/test/incremental/x86_64-macos/assert_function.18.zig new file mode 100644 index 0000000000000000000000000000000000000000..31cf1207f3dc07541a4210641ee136eb0ba385b0 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.18.zig @@ -0,0 +1,35 @@ +const builtin = @import("builtin"); + +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + for ("hello") |_| print(); +} + +fn print() void { + switch (builtin.os.tag) { + .linux => { + asm volatile ("syscall" + : + : [number] "{rax}" (1), + [arg1] "{rdi}" (1), + [arg2] "{rsi}" (@ptrToInt("hello\n")), + [arg3] "{rdx}" (6), + : "rcx", "r11", "memory" + ); + }, + .macos => { + _ = write(1, @ptrToInt("hello\n"), 6); + }, + else => unreachable, + } +} + +// run +// +// hello +// hello +// hello +// hello +// hello +// diff --git a/test/incremental/x86_64-macos/assert_function.2.zig b/test/incremental/x86_64-macos/assert_function.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..8c1c510486185f4116841577473c901e13528283 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.2.zig @@ -0,0 +1,21 @@ +pub fn main() void { + add(3, 4); +} + +fn add(a: u32, b: u32) void { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + assert(i == 100); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.3.zig b/test/incremental/x86_64-macos/assert_function.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..a6829f8e0239f8c01f0a1e4e1cf42e9ed035176b --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.3.zig @@ -0,0 +1,22 @@ +pub fn main() void { + add(3, 4); +} + +fn add(a: u32, b: u32) void { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + const f = d + e; // 24 + const g = e + f; // 38 + const h = f + g; // 62 + const i = g + h; // 100 + const j = i + d; // 110 + assert(j == 110); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.4.zig b/test/incremental/x86_64-macos/assert_function.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..69df4354c3eb8d72d4c91b226fbf4b4c0eddedaf --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.4.zig @@ -0,0 +1,15 @@ +pub fn main() void { + assert(add(3, 4) == 7); + assert(add(20, 10) == 30); +} + +fn add(a: u32, b: u32) u32 { + return a + b; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.5.zig b/test/incremental/x86_64-macos/assert_function.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..89f3f7df4fd3f42da6650c27dff3c8160b281860 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.5.zig @@ -0,0 +1,19 @@ +pub fn main() void { + assert(add(3, 4) == 7); + assert(add(20, 10) == 30); +} + +fn add(a: u32, b: u32) u32 { + var x: u32 = undefined; + x = 0; + x += a; + x += b; + return x; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.6.zig b/test/incremental/x86_64-macos/assert_function.6.zig new file mode 100644 index 0000000000000000000000000000000000000000..1b1b75e68ea72902208bd0889c38202922b89a51 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.6.zig @@ -0,0 +1,9 @@ +pub fn main() void { + const a: u32 = 2; + const b: ?u32 = a; + const c = b.?; + if (c != 2) unreachable; +} + +// run +// diff --git a/test/incremental/x86_64-macos/assert_function.7.zig b/test/incremental/x86_64-macos/assert_function.7.zig new file mode 100644 index 0000000000000000000000000000000000000000..27ba37029a8bee825a2676c78bcbeded35108033 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.7.zig @@ -0,0 +1,23 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + var i: u32 = 0; + while (i < 4) : (i += 1) print(); + assert(i == 4); +} + +fn print() void { + _ = write(1, @ptrToInt("hello\n"), 6); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// +// hello +// hello +// hello +// hello +// diff --git a/test/incremental/x86_64-macos/assert_function.8.zig b/test/incremental/x86_64-macos/assert_function.8.zig new file mode 100644 index 0000000000000000000000000000000000000000..801cd2e3be148fc847869d92babb8d92ef7a146f --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.8.zig @@ -0,0 +1,19 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + var i: u32 = 0; + inline while (i < 4) : (i += 1) print(); + assert(i == 4); +} + +fn print() void { + _ = write(1, @ptrToInt("hello\n"), 6); +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// error +// +// :5:21: error: unable to resolve comptime value diff --git a/test/incremental/x86_64-macos/assert_function.9.zig b/test/incremental/x86_64-macos/assert_function.9.zig new file mode 100644 index 0000000000000000000000000000000000000000..c754bb771133d8b3a595ec9fe46c48c4c6408e61 --- /dev/null +++ b/test/incremental/x86_64-macos/assert_function.9.zig @@ -0,0 +1,22 @@ +pub fn main() void { + assert(add(3, 4) == 20); +} + +fn add(a: u32, b: u32) u32 { + const x: u32 = blk: { + const c = a + b; // 7 + const d = a + c; // 10 + const e = d + b; // 14 + break :blk e; + }; + const y = x + a; // 17 + const z = y + a; // 20 + return z; +} + +pub fn assert(ok: bool) void { + if (!ok) unreachable; // assertion failure +} + +// run +// diff --git a/test/incremental/x86_64-macos/comptime_var.0.zig b/test/incremental/x86_64-macos/comptime_var.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..da82b35c6fb12795af2ce139adc3766a5ee53483 --- /dev/null +++ b/test/incremental/x86_64-macos/comptime_var.0.zig @@ -0,0 +1,12 @@ +pub fn main() void { + var a: u32 = 0; + comptime var b: u32 = 0; + if (a == 0) b = 3; +} + +// error +// output_mode=Exe +// target=x86_64-macos +// +// :4:21: error: store to comptime variable depends on runtime condition +// :4:11: note: runtime condition here diff --git a/test/incremental/x86_64-macos/comptime_var.1.zig b/test/incremental/x86_64-macos/comptime_var.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..efc51aafe3e7572bb8815d5e75ec4e4b00761499 --- /dev/null +++ b/test/incremental/x86_64-macos/comptime_var.1.zig @@ -0,0 +1,13 @@ +pub fn main() void { + var a: u32 = 0; + comptime var b: u32 = 0; + switch (a) { + 0 => {}, + else => b = 3, + } +} + +// error +// +// :6:21: error: store to comptime variable depends on runtime condition +// :4:13: note: runtime condition here diff --git a/test/incremental/x86_64-macos/comptime_var.2.zig b/test/incremental/x86_64-macos/comptime_var.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..abd34255cdc70c519f9166c8a686d0febf5a9669 --- /dev/null +++ b/test/incremental/x86_64-macos/comptime_var.2.zig @@ -0,0 +1,17 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + comptime var len: u32 = 5; + print(len); + len += 9; + print(len); +} + +fn print(len: usize) void { + _ = write(1, @ptrToInt("Hello, World!\n"), len); +} + +// run +// +// HelloHello, World! +// diff --git a/test/incremental/x86_64-macos/comptime_var.3.zig b/test/incremental/x86_64-macos/comptime_var.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..d4e6d85d9d38fa74e139ece4b911521069f80acd --- /dev/null +++ b/test/incremental/x86_64-macos/comptime_var.3.zig @@ -0,0 +1,10 @@ +comptime { + var x: i32 = 1; + x += 1; + if (x != 1) unreachable; +} +pub fn main() void {} + +// error +// +// :4:17: error: unable to resolve comptime value diff --git a/test/incremental/x86_64-macos/comptime_var.4.zig b/test/incremental/x86_64-macos/comptime_var.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..74da6ef448edd5534b49b1f850673863b4188b99 --- /dev/null +++ b/test/incremental/x86_64-macos/comptime_var.4.zig @@ -0,0 +1,9 @@ +pub fn main() void { + comptime var i: u64 = 0; + while (i < 5) : (i += 1) {} +} + +// error +// +// :3:24: error: cannot store to comptime variable in non-inline loop +// :3:5: note: non-inline loop here diff --git a/test/incremental/x86_64-macos/comptime_var.5.zig b/test/incremental/x86_64-macos/comptime_var.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..76a06f3d4b5931e8fd23271dcc593e07ff414a7f --- /dev/null +++ b/test/incremental/x86_64-macos/comptime_var.5.zig @@ -0,0 +1,15 @@ +pub fn main() void { + var a: u32 = 0; + if (a == 0) { + comptime var b: u32 = 0; + b = 1; + } +} +comptime { + var x: i32 = 1; + x += 1; + if (x != 2) unreachable; +} + +// run +// diff --git a/test/incremental/x86_64-macos/comptime_var.6.zig b/test/incremental/x86_64-macos/comptime_var.6.zig new file mode 100644 index 0000000000000000000000000000000000000000..381e609bd1143f8284d3323ec63266e604d6719b --- /dev/null +++ b/test/incremental/x86_64-macos/comptime_var.6.zig @@ -0,0 +1,15 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + comptime var i: u64 = 2; + inline while (i < 6) : (i += 1) { + print(i); + } +} +fn print(len: usize) void { + _ = write(1, @ptrToInt("Hello"), len); +} + +// run +// +// HeHelHellHello diff --git a/test/incremental/x86_64-macos/hello_world_with_updates.0.zig b/test/incremental/x86_64-macos/hello_world_with_updates.0.zig new file mode 100644 index 0000000000000000000000000000000000000000..34440c4603e0c2164ad399efb03d59e4de9cf6ff --- /dev/null +++ b/test/incremental/x86_64-macos/hello_world_with_updates.0.zig @@ -0,0 +1,5 @@ +// error +// output_mode=Exe +// target=x86_64-macos +// +// :109:9: error: struct 'tmp.tmp' has no member named 'main' diff --git a/test/incremental/x86_64-macos/hello_world_with_updates.1.zig b/test/incremental/x86_64-macos/hello_world_with_updates.1.zig new file mode 100644 index 0000000000000000000000000000000000000000..909fc9ccfbcb343f761414446c0ec4d52e98aeef --- /dev/null +++ b/test/incremental/x86_64-macos/hello_world_with_updates.1.zig @@ -0,0 +1,5 @@ +pub export fn main() noreturn {} + +// error +// +// :1:32: error: expected noreturn, found void diff --git a/test/incremental/x86_64-macos/hello_world_with_updates.2.zig b/test/incremental/x86_64-macos/hello_world_with_updates.2.zig new file mode 100644 index 0000000000000000000000000000000000000000..fb8cb39eddf859f843ce61b068c0f6f8f9feb387 --- /dev/null +++ b/test/incremental/x86_64-macos/hello_world_with_updates.2.zig @@ -0,0 +1,19 @@ +extern "c" fn write(usize, usize, usize) usize; +extern "c" fn exit(usize) noreturn; + +pub export fn main() noreturn { + print(); + + exit(0); +} + +fn print() void { + const msg = @ptrToInt("Hello, World!\n"); + const len = 14; + _ = write(1, msg, len); +} + +// run +// +// Hello, World! +// diff --git a/test/incremental/x86_64-macos/hello_world_with_updates.3.zig b/test/incremental/x86_64-macos/hello_world_with_updates.3.zig new file mode 100644 index 0000000000000000000000000000000000000000..f6e233886b0a7d616f92dd11ffb4232191c997de --- /dev/null +++ b/test/incremental/x86_64-macos/hello_world_with_updates.3.zig @@ -0,0 +1,16 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + print(); +} + +fn print() void { + const msg = @ptrToInt("Hello, World!\n"); + const len = 14; + _ = write(1, msg, len); +} + +// run +// +// Hello, World! +// diff --git a/test/incremental/x86_64-macos/hello_world_with_updates.4.zig b/test/incremental/x86_64-macos/hello_world_with_updates.4.zig new file mode 100644 index 0000000000000000000000000000000000000000..f89cef73543ce1f3e51a4e0152c0a8c367edf537 --- /dev/null +++ b/test/incremental/x86_64-macos/hello_world_with_updates.4.zig @@ -0,0 +1,22 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + print(); + print(); + print(); + print(); +} + +fn print() void { + const msg = @ptrToInt("Hello, World!\n"); + const len = 14; + _ = write(1, msg, len); +} + +// run +// +// Hello, World! +// Hello, World! +// Hello, World! +// Hello, World! +// diff --git a/test/incremental/x86_64-macos/hello_world_with_updates.5.zig b/test/incremental/x86_64-macos/hello_world_with_updates.5.zig new file mode 100644 index 0000000000000000000000000000000000000000..0d7f97578afe1274d1c8e3d356ce702992edca61 --- /dev/null +++ b/test/incremental/x86_64-macos/hello_world_with_updates.5.zig @@ -0,0 +1,16 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + print(); +} + +fn print() void { + const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); + const len = 104; + _ = write(1, msg, len); +} + +// run +// +// What is up? This is a longer message that will force the data to be relocated in virtual address space. +// diff --git a/test/incremental/x86_64-macos/hello_world_with_updates.6.zig b/test/incremental/x86_64-macos/hello_world_with_updates.6.zig new file mode 100644 index 0000000000000000000000000000000000000000..3ce2cb717639d663c2679dcdef2a4583c3c3f8ec --- /dev/null +++ b/test/incremental/x86_64-macos/hello_world_with_updates.6.zig @@ -0,0 +1,18 @@ +extern "c" fn write(usize, usize, usize) usize; + +pub fn main() void { + print(); + print(); +} + +fn print() void { + const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); + const len = 104; + _ = write(1, msg, len); +} + +// run +// +// What is up? This is a longer message that will force the data to be relocated in virtual address space. +// What is up? This is a longer message that will force the data to be relocated in virtual address space. +// diff --git a/test/stage2/aarch64.zig b/test/stage2/aarch64.zig deleted file mode 100644 index 84334c2a29e6f8e38e82149a6495c0092afce1c0..0000000000000000000000000000000000000000 --- a/test/stage2/aarch64.zig +++ /dev/null @@ -1,271 +0,0 @@ -const std = @import("std"); -const CrossTarget = std.zig.CrossTarget; -const TestContext = @import("../../src/test.zig").TestContext; - -const linux_aarch64 = CrossTarget{ - .cpu_arch = .aarch64, - .os_tag = .linux, -}; -const macos_aarch64 = CrossTarget{ - .cpu_arch = .aarch64, - .os_tag = .macos, -}; - -pub fn addCases(ctx: *TestContext) !void { - // Linux tests - { - var case = ctx.exe("linux_aarch64 hello world", linux_aarch64); - // Regular old hello world - case.addCompareOutput( - \\pub fn main() void { - \\ print(); - \\} - \\ - \\fn print() void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{x8}" (64), - \\ [arg1] "{x0}" (1), - \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{x2}" ("Hello, World!\n".len) - \\ : "memory", "cc" - \\ ); - \\} - , - "Hello, World!\n", - ); - } - - { - var case = ctx.exe("exit fn taking argument", linux_aarch64); - - case.addCompareOutput( - \\pub export fn _start() noreturn { - \\ exit(0); - \\} - \\ - \\fn exit(ret: usize) noreturn { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{x8}" (93), - \\ [arg1] "{x0}" (ret) - \\ : "memory", "cc" - \\ ); - \\ unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("conditional branches", linux_aarch64); - - case.addCompareOutput( - \\pub fn main() void { - \\ foo(123); - \\} - \\ - \\fn foo(x: u64) void { - \\ if (x > 42) { - \\ print(); - \\ } - \\} - \\ - \\fn print() void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{x8}" (64), - \\ [arg1] "{x0}" (1), - \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{x2}" ("Hello, World!\n".len), - \\ : "memory", "cc" - \\ ); - \\} - , - "Hello, World!\n", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ foo(true); - \\} - \\ - \\fn foo(x: bool) void { - \\ if (x) { - \\ print(); - \\ } - \\} - \\ - \\fn print() void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{x8}" (64), - \\ [arg1] "{x0}" (1), - \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{x2}" ("Hello, World!\n".len), - \\ : "memory", "cc" - \\ ); - \\} - , - "Hello, World!\n", - ); - } - - { - var case = ctx.exe("large add function", linux_aarch64); - - case.addCompareOutput( - \\pub fn main() void { - \\ assert(add(3, 4) == 791); - \\} - \\ - \\fn add(a: u32, b: u32) u32 { - \\ const x: u32 = blk: { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ const f = d + e; // 24 - \\ const g = e + f; // 38 - \\ const h = f + g; // 62 - \\ const i = g + h; // 100 - \\ const j = i + d; // 110 - \\ const k = i + j; // 210 - \\ const l = k + c; // 217 - \\ const m = l + d; // 227 - \\ const n = m + e; // 241 - \\ const o = n + f; // 265 - \\ const p = o + g; // 303 - \\ const q = p + h; // 365 - \\ const r = q + i; // 465 - \\ const s = r + j; // 575 - \\ const t = s + k; // 785 - \\ break :blk t; - \\ }; - \\ const y = x + a; // 788 - \\ const z = y + a; // 791 - \\ return z; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - // macOS tests - { - var case = ctx.exe("hello world with updates", macos_aarch64); - case.addError("", &[_][]const u8{ - ":109:9: error: struct 'tmp.tmp' has no member named 'main'", - }); - - // Incorrect return type - case.addError( - \\pub export fn main() noreturn { - \\} - , &[_][]const u8{ - ":2:1: error: expected noreturn, found void", - }); - - // Regular old hello world - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\extern "c" fn exit(usize) noreturn; - \\ - \\pub export fn main() noreturn { - \\ print(); - \\ - \\ exit(0); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("Hello, World!\n"); - \\ const len = 14; - \\ _ = write(1, msg, len); - \\} - , - "Hello, World!\n", - ); - - // Now using start.zig without an explicit extern exit fn - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ print(); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("Hello, World!\n"); - \\ const len = 14; - \\ _ = write(1, msg, len); - \\} - , - "Hello, World!\n", - ); - - // Print it 4 times and force growth and realloc. - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ print(); - \\ print(); - \\ print(); - \\ print(); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("Hello, World!\n"); - \\ const len = 14; - \\ _ = write(1, msg, len); - \\} - , - \\Hello, World! - \\Hello, World! - \\Hello, World! - \\Hello, World! - \\ - ); - - // Print it once, and change the message. - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ print(); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); - \\ const len = 104; - \\ _ = write(1, msg, len); - \\} - , - "What is up? This is a longer message that will force the data to be relocated in virtual address space.\n", - ); - - // Now we print it twice. - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ print(); - \\ print(); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); - \\ const len = 104; - \\ _ = write(1, msg, len); - \\} - , - \\What is up? This is a longer message that will force the data to be relocated in virtual address space. - \\What is up? This is a longer message that will force the data to be relocated in virtual address space. - \\ - ); - } -} diff --git a/test/stage2/arm.zig b/test/stage2/arm.zig deleted file mode 100644 index a0afcf9d6fb0c574470ec0c6ff4ffdb4c68e1078..0000000000000000000000000000000000000000 --- a/test/stage2/arm.zig +++ /dev/null @@ -1,798 +0,0 @@ -const std = @import("std"); -const TestContext = @import("../../src/test.zig").TestContext; - -const linux_arm = std.zig.CrossTarget{ - .cpu_arch = .arm, - .os_tag = .linux, -}; - -pub fn addCases(ctx: *TestContext) !void { - { - var case = ctx.exe("linux_arm hello world", linux_arm); - // Hello world using _start and inline asm. - case.addCompareOutput( - \\pub export fn _start() noreturn { - \\ print(); - \\ exit(); - \\} - \\ - \\fn print() void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{r2}" (14) - \\ : "memory" - \\ ); - \\ return; - \\} - \\ - \\fn exit() noreturn { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (1), - \\ [arg1] "{r0}" (0) - \\ : "memory" - \\ ); - \\ unreachable; - \\} - , - "Hello, World!\n", - ); - } - - { - var case = ctx.exe("parameters and return values", linux_arm); - // Testing simple parameters and return values - // - // TODO: The parameters to the asm statement in print() had to - // be in a specific order because otherwise the write to r0 - // would overwrite the len parameter which resides in r0 - case.addCompareOutput( - \\pub fn main() void { - \\ print(id(14)); - \\} - \\ - \\fn id(x: u32) u32 { - \\ return x; - \\} - \\ - \\fn print(len: u32) void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg3] "{r2}" (len), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("Hello, World!\n")) - \\ : "memory" - \\ ); - \\ return; - \\} - , - "Hello, World!\n", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ assert(add(1, 2, 3, 4, 5, 6) == 21); - \\} - \\ - \\fn add(a: u32, b: u32, c: u32, d: u32, e: u32, f: u32) u32 { - \\ return a + b + c + d + e + f; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - } - - { - var case = ctx.exe("non-leaf functions", linux_arm); - // Testing non-leaf functions - case.addCompareOutput( - \\pub fn main() void { - \\ foo(); - \\} - \\ - \\fn foo() void { - \\ bar(); - \\} - \\ - \\fn bar() void {} - , - "", - ); - } - - { - var case = ctx.exe("arithmetic operations", linux_arm); - - // Add two numbers - case.addCompareOutput( - \\pub fn main() void { - \\ print(2, 4); - \\ print(1, 7); - \\} - \\ - \\fn print(a: u32, b: u32) void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg3] "{r2}" (a + b), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("123456789")) - \\ : "memory" - \\ ); - \\ return; - \\} - , - "12345612345678", - ); - - // Subtract two numbers - case.addCompareOutput( - \\pub fn main() void { - \\ print(10, 5); - \\ print(4, 3); - \\} - \\ - \\fn print(a: u32, b: u32) void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg3] "{r2}" (a - b), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("123456789")) - \\ : "memory" - \\ ); - \\ return; - \\} - , - "123451", - ); - - // Bitwise And - case.addCompareOutput( - \\pub fn main() void { - \\ print(8, 9); - \\ print(3, 7); - \\} - \\ - \\fn print(a: u32, b: u32) void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg3] "{r2}" (a & b), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("123456789")) - \\ : "memory" - \\ ); - \\ return; - \\} - , - "12345678123", - ); - - // Bitwise Or - case.addCompareOutput( - \\pub fn main() void { - \\ print(4, 2); - \\ print(3, 7); - \\} - \\ - \\fn print(a: u32, b: u32) void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg3] "{r2}" (a | b), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("123456789")) - \\ : "memory" - \\ ); - \\ return; - \\} - , - "1234561234567", - ); - - // Bitwise Xor - case.addCompareOutput( - \\pub fn main() void { - \\ print(42, 42); - \\ print(3, 5); - \\} - \\ - \\fn print(a: u32, b: u32) void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg3] "{r2}" (a ^ b), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("123456789")) - \\ : "memory" - \\ ); - \\ return; - \\} - , - "123456", - ); - - // Bit Shift Left - case.addCompareOutput( - \\pub fn main() void { - \\ var x: u32 = 1; - \\ assert(x << 1 == 2); - \\ - \\ x <<= 1; - \\ assert(x << 2 == 8); - \\ assert(x << 3 == 16); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Bit Shift Right - case.addCompareOutput( - \\pub fn main() void { - \\ var a: u32 = 1024; - \\ assert(a >> 1 == 512); - \\ - \\ a >>= 1; - \\ assert(a >> 2 == 128); - \\ assert(a >> 3 == 64); - \\ assert(a >> 4 == 32); - \\ assert(a >> 5 == 16); - \\ assert(a >> 6 == 8); - \\ assert(a >> 7 == 4); - \\ assert(a >> 8 == 2); - \\ assert(a >> 9 == 1); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - } - - { - var case = ctx.exe("if statements", linux_arm); - // Simple if statement in assert - case.addCompareOutput( - \\pub fn main() void { - \\ var x: u32 = 123; - \\ var y: u32 = 42; - \\ assert(x > y); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("while loops", linux_arm); - // Simple while loop with assert - case.addCompareOutput( - \\pub fn main() void { - \\ var x: u32 = 2020; - \\ var i: u32 = 0; - \\ while (x > 0) { - \\ x -= 2; - \\ i += 1; - \\ } - \\ assert(i == 1010); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("integer multiplication", linux_arm); - // Simple u32 integer multiplication - case.addCompareOutput( - \\pub fn main() void { - \\ assert(mul(1, 1) == 1); - \\ assert(mul(42, 1) == 42); - \\ assert(mul(1, 42) == 42); - \\ assert(mul(123, 42) == 5166); - \\} - \\ - \\fn mul(x: u32, y: u32) u32 { - \\ return x * y; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("save function return values in callee preserved register", linux_arm); - // Here, it is necessary to save the result of bar() into a - // callee preserved register, otherwise it will be overwritten - // by the first parameter to baz. - case.addCompareOutput( - \\pub fn main() void { - \\ assert(foo() == 43); - \\} - \\ - \\fn foo() u32 { - \\ return bar() + baz(42); - \\} - \\ - \\fn bar() u32 { - \\ return 1; - \\} - \\ - \\fn baz(x: u32) u32 { - \\ return x; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("enums", linux_arm); - case.addCompareOutput( - \\const Number = enum { one, two, three }; - \\ - \\pub fn main() void { - \\ var x: Number = .one; - \\ var y = Number.two; - \\ var z = @intToEnum(Number, 2); - \\ assert(@enumToInt(x) == 0); - \\ assert(@enumToInt(y) == 1); - \\ assert(@enumToInt(z) == 2); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - case.addCompareOutput( - \\const Number = enum { one, two, three }; - \\ - \\pub fn main() void { - \\ var x: Number = .one; - \\ var y = Number.two; - \\ assert(@enumToInt(x) < @enumToInt(y)); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - } - - { - var case = ctx.exe("recursive fibonacci", linux_arm); - case.addCompareOutput( - \\pub fn main() void { - \\ assert(fib(0) == 0); - \\ assert(fib(1) == 1); - \\ assert(fib(2) == 1); - \\ assert(fib(3) == 2); - \\ assert(fib(10) == 55); - \\ assert(fib(20) == 6765); - \\} - \\ - \\fn fib(n: u32) u32 { - \\ if (n < 2) { - \\ return n; - \\ } else { - \\ return fib(n - 2) + fib(n - 1); - \\ } - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("spilling registers", linux_arm); - case.addCompareOutput( - \\pub fn main() void { - \\ assert(add(3, 4) == 791); - \\} - \\ - \\fn add(a: u32, b: u32) u32 { - \\ const x: u32 = blk: { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ const f = d + e; // 24 - \\ const g = e + f; // 38 - \\ const h = f + g; // 62 - \\ const i = g + h; // 100 - \\ const j = i + d; // 110 - \\ const k = i + j; // 210 - \\ const l = k + c; // 217 - \\ const m = l + d; // 227 - \\ const n = m + e; // 241 - \\ const o = n + f; // 265 - \\ const p = o + g; // 303 - \\ const q = p + h; // 365 - \\ const r = q + i; // 465 - \\ const s = r + j; // 575 - \\ const t = s + k; // 785 - \\ break :blk t; - \\ }; - \\ const y = x + a; // 788 - \\ const z = y + a; // 791 - \\ return z; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ assert(addMul(3, 4) == 357747496); - \\} - \\ - \\fn addMul(a: u32, b: u32) u32 { - \\ const x: u32 = blk: { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ const f = d + e; // 24 - \\ const g = e + f; // 38 - \\ const h = f + g; // 62 - \\ const i = g + h; // 100 - \\ const j = i + d; // 110 - \\ const k = i + j; // 210 - \\ const l = k + c; // 217 - \\ const m = l * d; // 2170 - \\ const n = m + e; // 2184 - \\ const o = n * f; // 52416 - \\ const p = o + g; // 52454 - \\ const q = p * h; // 3252148 - \\ const r = q + i; // 3252248 - \\ const s = r * j; // 357747280 - \\ const t = s + k; // 357747490 - \\ break :blk t; - \\ }; - \\ const y = x + a; // 357747493 - \\ const z = y + a; // 357747496 - \\ return z; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("print u32s", linux_arm); - case.addCompareOutput( - \\pub fn main() void { - \\ printNumberHex(0x00000000); - \\ printNumberHex(0xaaaaaaaa); - \\ printNumberHex(0xdeadbeef); - \\ printNumberHex(0x31415926); - \\} - \\ - \\fn printNumberHex(x: u32) void { - \\ var i: u5 = 28; - \\ while (true) : (i -= 4) { - \\ const digit = (x >> i) & 0xf; - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("0123456789abcdef") + digit), - \\ [arg3] "{r2}" (1) - \\ : "memory" - \\ ); - \\ - \\ if (i == 0) break; - \\ } - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("\n")), - \\ [arg3] "{r2}" (1) - \\ : "memory" - \\ ); - \\} - , - \\00000000 - \\aaaaaaaa - \\deadbeef - \\31415926 - \\ - , - ); - } - - { - var case = ctx.exe("save compare flags", linux_arm); - case.addCompareOutput( - \\pub fn main() void { - \\ foo(2, 1); - \\} - \\ - \\fn foo(x: u32, y: u32) void { - \\ const b = x > y; - \\ assert(b); - \\ assert(b); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - } - - { - var case = ctx.exe("optionals", linux_arm); - case.addCompareOutput( - \\var x: u32 = 42; - \\ - \\pub fn main() void { - \\ var p: ?*u32 = null; - \\ assert(p == null); - \\ p = &x; - \\ assert(p != null); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("errors", linux_arm); - case.addCompareOutput( - \\pub fn main() void { - \\ foo() catch print(); - \\} - \\ - \\fn foo() anyerror!void {} - \\ - \\fn print() void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{r2}" ("Hello, World!\n".len), - \\ : "memory" - \\ ); - \\ return; - \\} - , - "", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ foo() catch print(); - \\} - \\ - \\fn foo() anyerror!void { - \\ return error.Test; - \\} - \\ - \\fn print() void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{r2}" ("Hello, World!\n".len), - \\ : "memory" - \\ ); - \\ return; - \\} - , - "Hello, World!\n", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ foo() catch |err| { - \\ assert(err == error.Foo); - \\ assert(err != error.Bar); - \\ assert(err != error.Baz); - \\ }; - \\ bar() catch |err| { - \\ assert(err != error.Foo); - \\ assert(err == error.Bar); - \\ assert(err != error.Baz); - \\ }; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\fn foo() anyerror!void { - \\ return error.Foo; - \\} - \\ - \\fn bar() anyerror!void { - \\ return error.Bar; - \\} - , - "", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ foo() catch unreachable; - \\} - \\ - \\fn foo() anyerror!void { - \\ try bar(); - \\} - \\ - \\fn bar() anyerror!void {} - , - "", - ); - } - - { - var case = ctx.exe("slices", linux_arm); - case.addCompareOutput( - \\var array = [_]u32{ 0, 42, 123, 69 }; - \\var s: []const u32 = &array; - \\ - \\pub fn main() void { - \\ assert(s[0] == 0); - \\ assert(s[1] == 42); - \\ assert(s[2] == 123); - \\ assert(s[3] == 69); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("structs", linux_arm); - case.addCompareOutput( - \\var array = [_]SomeStruct{ - \\ .{ .a = 0, .b = 42, .c = 69 }, - \\ .{ .a = 1, .b = 2, .c = 3 }, - \\ .{ .a = 123, .b = 456, .c = 789 }, - \\}; - \\var s: []const SomeStruct = &array; - \\ - \\var some_struct: SomeStruct = .{ - \\ .a = 0, - \\ .b = 42, - \\ .c = 69, - \\}; - \\ - \\const SomeStruct = struct { - \\ a: u32, - \\ b: u32, - \\ c: u32, - \\}; - \\ - \\pub fn main() void { - \\ assert(some_struct.a == 0); - \\ assert(some_struct.b == 42); - \\ assert(some_struct.c == 69); - \\ - \\ assert(s[0].a == 0); - \\ assert(s[0].b == 42); - \\ assert(s[0].c == 69); - \\ assert(s[1].a == 1); - \\ assert(s[1].b == 2); - \\ assert(s[1].c == 3); - \\ assert(s[2].a == 123); - \\ assert(s[2].b == 456); - \\ assert(s[2].c == 789); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("function pointers", linux_arm); - case.addCompareOutput( - \\const PrintFn = *const fn () void; - \\ - \\pub fn main() void { - \\ var printFn: PrintFn = stopSayingThat; - \\ var i: u32 = 0; - \\ while (i < 4) : (i += 1) printFn(); - \\ - \\ printFn = moveEveryZig; - \\ printFn(); - \\} - \\ - \\fn stopSayingThat() void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("Hello, my name is Inigo Montoya; you killed my father, prepare to die.\n")), - \\ [arg3] "{r2}" ("Hello, my name is Inigo Montoya; you killed my father, prepare to die.\n".len), - \\ : "memory" - \\ ); - \\ return; - \\} - \\ - \\fn moveEveryZig() void { - \\ asm volatile ("svc #0" - \\ : - \\ : [number] "{r7}" (4), - \\ [arg1] "{r0}" (1), - \\ [arg2] "{r1}" (@ptrToInt("All your codebase are belong to us\n")), - \\ [arg3] "{r2}" ("All your codebase are belong to us\n".len), - \\ : "memory" - \\ ); - \\ return; - \\} - , - \\Hello, my name is Inigo Montoya; you killed my father, prepare to die. - \\Hello, my name is Inigo Montoya; you killed my father, prepare to die. - \\Hello, my name is Inigo Montoya; you killed my father, prepare to die. - \\Hello, my name is Inigo Montoya; you killed my father, prepare to die. - \\All your codebase are belong to us - \\ - , - ); - } -} diff --git a/test/stage2/llvm.zig b/test/stage2/llvm.zig deleted file mode 100644 index bf538efacaa9c0f22e1ce365000c2f93c023f667..0000000000000000000000000000000000000000 --- a/test/stage2/llvm.zig +++ /dev/null @@ -1,438 +0,0 @@ -const std = @import("std"); -const TestContext = @import("../../src/test.zig").TestContext; -const build_options = @import("build_options"); - -// These tests should work with all platforms, but we're using linux_x64 for -// now for consistency. Will be expanded eventually. -const linux_x64 = std.zig.CrossTarget{ - .cpu_arch = .x86_64, - .os_tag = .linux, -}; - -pub fn addCases(ctx: *TestContext) !void { - { - var case = ctx.exeUsingLlvmBackend("simple addition and subtraction", linux_x64); - - case.addCompareOutput( - \\fn add(a: i32, b: i32) i32 { - \\ return a + b; - \\} - \\ - \\pub export fn main() c_int { - \\ var a: i32 = -5; - \\ const x = add(a, 7); - \\ var y = add(2, 0); - \\ y -= x; - \\ return y; - \\} - , ""); - } - - { - var case = ctx.exeUsingLlvmBackend("shift right + left", linux_x64); - - case.addCompareOutput( - \\pub export fn main() c_int { - \\ var i: u32 = 16; - \\ assert(i >> 1, 8); - \\ return 0; - \\} - \\fn assert(a: u32, b: u32) void { - \\ if (a != b) unreachable; - \\} - , ""); - case.addCompareOutput( - \\pub export fn main() c_int { - \\ var i: u32 = 16; - \\ assert(i << 1, 32); - \\ return 0; - \\} - \\fn assert(a: u32, b: u32) void { - \\ if (a != b) unreachable; - \\} - , ""); - } - - { - var case = ctx.exeUsingLlvmBackend("llvm hello world", linux_x64); - - case.addCompareOutput( - \\extern fn puts(s: [*:0]const u8) c_int; - \\ - \\pub export fn main() c_int { - \\ _ = puts("hello world!"); - \\ return 0; - \\} - , "hello world!" ++ std.cstr.line_sep); - } - - { - var case = ctx.exeUsingLlvmBackend("simple if statement", linux_x64); - - case.addCompareOutput( - \\fn add(a: i32, b: i32) i32 { - \\ return a + b; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\pub export fn main() c_int { - \\ assert(add(1,2) == 3); - \\ return 0; - \\} - , ""); - } - - { - var case = ctx.exeUsingLlvmBackend("blocks", linux_x64); - - case.addCompareOutput( - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\fn foo(ok: bool) i32 { - \\ const val: i32 = blk: { - \\ var x: i32 = 1; - \\ if (!ok) break :blk x + 9; - \\ break :blk x + 19; - \\ }; - \\ return val + 10; - \\} - \\ - \\pub export fn main() c_int { - \\ assert(foo(false) == 20); - \\ assert(foo(true) == 30); - \\ return 0; - \\} - , ""); - } - - { - var case = ctx.exeUsingLlvmBackend("nested blocks", linux_x64); - - case.addCompareOutput( - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\fn foo(ok: bool) i32 { - \\ var val: i32 = blk: { - \\ const val2: i32 = another: { - \\ if (!ok) break :blk 10; - \\ break :another 10; - \\ }; - \\ break :blk val2 + 10; - \\ }; - \\ return val; - \\} - \\ - \\pub export fn main() c_int { - \\ assert(foo(false) == 10); - \\ assert(foo(true) == 20); - \\ return 0; - \\} - , ""); - } - - { - var case = ctx.exeUsingLlvmBackend("while loops", linux_x64); - - case.addCompareOutput( - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\pub export fn main() c_int { - \\ var sum: u32 = 0; - \\ var i: u32 = 0; - \\ while (i < 5) : (i += 1) { - \\ sum += i; - \\ } - \\ assert(sum == 10); - \\ assert(i == 5); - \\ return 0; - \\} - , ""); - } - - { - var case = ctx.exeUsingLlvmBackend("optionals", linux_x64); - - case.addCompareOutput( - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\pub export fn main() c_int { - \\ var opt_val: ?i32 = 10; - \\ var null_val: ?i32 = null; - \\ - \\ var val1: i32 = opt_val.?; - \\ const val1_1: i32 = opt_val.?; - \\ var ptr_val1 = &(opt_val.?); - \\ const ptr_val1_1 = &(opt_val.?); - \\ - \\ var val2: i32 = null_val orelse 20; - \\ const val2_2: i32 = null_val orelse 20; - \\ - \\ var value: i32 = 20; - \\ var ptr_val2 = &(null_val orelse value); - \\ - \\ const val3 = opt_val orelse 30; - \\ var val3_var = opt_val orelse 30; - \\ - \\ assert(val1 == 10); - \\ assert(val1_1 == 10); - \\ assert(ptr_val1.* == 10); - \\ assert(ptr_val1_1.* == 10); - \\ - \\ assert(val2 == 20); - \\ assert(val2_2 == 20); - \\ assert(ptr_val2.* == 20); - \\ - \\ assert(val3 == 10); - \\ assert(val3_var == 10); - \\ - \\ (null_val orelse val2) = 1234; - \\ assert(val2 == 1234); - \\ - \\ (opt_val orelse val2) = 5678; - \\ assert(opt_val.? == 5678); - \\ - \\ return 0; - \\} - , ""); - } - - { - var case = ctx.exeUsingLlvmBackend("for loop", linux_x64); - - case.addCompareOutput( - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\pub export fn main() c_int { - \\ var x: u32 = 0; - \\ for ("hello") |_| { - \\ x += 1; - \\ } - \\ assert("hello".len == x); - \\ return 0; - \\} - , ""); - } - - { - var case = ctx.exeUsingLlvmBackend("@rem", linux_x64); - case.addCompareOutput( - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\fn rem(lhs: i32, rhs: i32, expected: i32) bool { - \\ return @rem(lhs, rhs) == expected; - \\} - \\pub export fn main() c_int { - \\ assert(rem(-5, 3, -2)); - \\ assert(rem(5, 3, 2)); - \\ return 0; - \\} - , ""); - } - - { - var case = ctx.exeUsingLlvmBackend("invalid address space coercion", linux_x64); - case.addError( - \\fn entry(a: *addrspace(.gs) i32) *i32 { - \\ return a; - \\} - \\pub export fn main() void { _ = entry; } - , &[_][]const u8{ - ":2:12: error: expected *i32, found *addrspace(.gs) i32", - }); - } - - { - var case = ctx.exeUsingLlvmBackend("pointer keeps address space", linux_x64); - case.compiles( - \\fn entry(a: *addrspace(.gs) i32) *addrspace(.gs) i32 { - \\ return a; - \\} - \\pub export fn main() void { _ = entry; } - ); - } - - { - var case = ctx.exeUsingLlvmBackend("pointer to explicit generic address space coerces to implicit pointer", linux_x64); - case.compiles( - \\fn entry(a: *addrspace(.generic) i32) *i32 { - \\ return a; - \\} - \\pub export fn main() void { _ = entry; } - ); - } - - { - var case = ctx.exeUsingLlvmBackend("pointers with different address spaces", linux_x64); - case.addError( - \\fn entry(a: *addrspace(.gs) i32) *addrspace(.fs) i32 { - \\ return a; - \\} - \\pub export fn main() void { _ = entry; } - , &[_][]const u8{ - ":2:12: error: expected *addrspace(.fs) i32, found *addrspace(.gs) i32", - }); - } - - { - var case = ctx.exeUsingLlvmBackend("pointers with different address spaces", linux_x64); - case.addError( - \\fn entry(a: ?*addrspace(.gs) i32) *i32 { - \\ return a.?; - \\} - \\pub export fn main() void { _ = entry; } - , &[_][]const u8{ - ":2:13: error: expected *i32, found *addrspace(.gs) i32", - }); - } - - { - var case = ctx.exeUsingLlvmBackend("invalid pointer keeps address space when taking address of dereference", linux_x64); - case.addError( - \\fn entry(a: *addrspace(.gs) i32) *i32 { - \\ return &a.*; - \\} - \\pub export fn main() void { _ = entry; } - , &[_][]const u8{ - ":2:12: error: expected *i32, found *addrspace(.gs) i32", - }); - } - - { - var case = ctx.exeUsingLlvmBackend("pointer keeps address space when taking address of dereference", linux_x64); - case.compiles( - \\fn entry(a: *addrspace(.gs) i32) *addrspace(.gs) i32 { - \\ return &a.*; - \\} - \\pub export fn main() void { _ = entry; } - ); - } - - { - var case = ctx.exeUsingLlvmBackend("address spaces pointer access chaining: array pointer", linux_x64); - case.compiles( - \\fn entry(a: *addrspace(.gs) [1]i32) *addrspace(.gs) i32 { - \\ return &a[0]; - \\} - \\pub export fn main() void { _ = entry; } - ); - } - - { - var case = ctx.exeUsingLlvmBackend("address spaces pointer access chaining: pointer to optional array", linux_x64); - case.compiles( - \\fn entry(a: *addrspace(.gs) ?[1]i32) *addrspace(.gs) i32 { - \\ return &a.*.?[0]; - \\} - \\pub export fn main() void { _ = entry; } - ); - } - - { - var case = ctx.exeUsingLlvmBackend("address spaces pointer access chaining: struct pointer", linux_x64); - case.compiles( - \\const A = struct{ a: i32 }; - \\fn entry(a: *addrspace(.gs) A) *addrspace(.gs) i32 { - \\ return &a.a; - \\} - \\pub export fn main() void { _ = entry; } - ); - } - - { - var case = ctx.exeUsingLlvmBackend("address spaces pointer access chaining: complex", linux_x64); - case.compiles( - \\const A = struct{ a: ?[1]i32 }; - \\fn entry(a: *addrspace(.gs) [1]A) *addrspace(.gs) i32 { - \\ return &a[0].a.?[0]; - \\} - \\pub export fn main() void { _ = entry; } - ); - } - - { - var case = ctx.exeUsingLlvmBackend("dereferencing through multiple pointers with address spaces", linux_x64); - case.compiles( - \\fn entry(a: *addrspace(.fs) *addrspace(.gs) *i32) *i32 { - \\ return a.*.*; - \\} - \\pub export fn main() void { _ = entry; } - ); - } - - { - var case = ctx.exeUsingLlvmBackend("f segment address space reading and writing", linux_x64); - case.addCompareOutput( - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\fn setFs(value: c_ulong) void { - \\ asm volatile ( - \\ \\syscall - \\ : - \\ : [number] "{rax}" (158), - \\ [code] "{rdi}" (0x1002), - \\ [val] "{rsi}" (value), - \\ : "rcx", "r11", "memory" - \\ ); - \\} - \\ - \\fn getFs() c_ulong { - \\ var result: c_ulong = undefined; - \\ asm volatile ( - \\ \\syscall - \\ : - \\ : [number] "{rax}" (158), - \\ [code] "{rdi}" (0x1003), - \\ [ptr] "{rsi}" (@ptrToInt(&result)), - \\ : "rcx", "r11", "memory" - \\ ); - \\ return result; - \\} - \\ - \\var test_value: u64 = 12345; - \\ - \\pub export fn main() c_int { - \\ const orig_fs = getFs(); - \\ - \\ setFs(@ptrToInt(&test_value)); - \\ assert(getFs() == @ptrToInt(&test_value)); - \\ - \\ var test_ptr = @intToPtr(*allowzero addrspace(.fs) u64, 0); - \\ assert(test_ptr.* == 12345); - \\ test_ptr.* = 98765; - \\ assert(test_value == 98765); - \\ - \\ setFs(orig_fs); - \\ return 0; - \\} - , ""); - } - - { - // This worked in stage1 and we expressly do not want this to work in stage2 - var case = ctx.exeUsingLlvmBackend("any typed null to any typed optional", linux_x64); - case.addError( - \\pub export fn main() void { - \\ var a: ?*anyopaque = undefined; - \\ a = @as(?usize, null); - \\} - , &[_][]const u8{ - ":3:21: error: expected *anyopaque, found ?usize", - }); - } -} diff --git a/test/stage2/plan9.zig b/test/stage2/plan9.zig deleted file mode 100644 index c82f95aa7bba98de374da7034063b9cebbd4f14f..0000000000000000000000000000000000000000 --- a/test/stage2/plan9.zig +++ /dev/null @@ -1,55 +0,0 @@ -const std = @import("std"); -const TestContext = @import("../../src/test.zig").TestContext; - -pub fn addCases(ctx: *TestContext) !void { - const x64: std.zig.CrossTarget = .{ - .cpu_arch = .x86_64, - .os_tag = .plan9, - }; - const aarch64: std.zig.CrossTarget = .{ - .cpu_arch = .aarch64, - .os_tag = .plan9, - }; - { - var case = ctx.exe("plan9: exiting correctly x64", x64); - case.addCompareOutput("pub fn main() void {}", ""); - } - { - var case = ctx.exe("plan9: exiting correctly arm", aarch64); - case.addCompareOutput("pub fn main() void {}", ""); - } - { - var case = ctx.exe("plan9: hello world", x64); - case.addCompareOutput( - \\pub fn main() void { - \\ const str = "Hello World!\n"; - \\ asm volatile ( - \\ \\push $0 - \\ \\push %%r10 - \\ \\push %%r11 - \\ \\push $1 - \\ \\push $0 - \\ \\syscall - \\ \\pop %%r11 - \\ \\pop %%r11 - \\ \\pop %%r11 - \\ \\pop %%r11 - \\ \\pop %%r11 - \\ : - \\ // pwrite - \\ : [syscall_number] "{rbp}" (51), - \\ [hey] "{r11}" (@ptrToInt(str)), - \\ [strlen] "{r10}" (str.len) - \\ : "rcx", "rbp", "r11", "memory" - \\ ); - \\} - , "Hello World\n"); - case.addCompareOutput( - \\const std = @import("std"); - \\pub fn main() void { - \\ const str = "Hello World!\n"; - \\ _ = std.os.plan9.pwrite(1, str, str.len, 0); - \\} - , "Hello World\n"); - } -} diff --git a/test/stage2/riscv64.zig b/test/stage2/riscv64.zig deleted file mode 100644 index c492f1d6b7ceabfdbc67d347830335ce49b031f9..0000000000000000000000000000000000000000 --- a/test/stage2/riscv64.zig +++ /dev/null @@ -1,33 +0,0 @@ -const std = @import("std"); -const TestContext = @import("../../src/test.zig").TestContext; - -const linux_riscv64 = std.zig.CrossTarget{ - .cpu_arch = .riscv64, - .os_tag = .linux, -}; - -pub fn addCases(ctx: *TestContext) !void { - { - var case = ctx.exe("riscv64 hello world", linux_riscv64); - // Regular old hello world - case.addCompareOutput( - \\pub fn main() void { - \\ print(); - \\} - \\ - \\fn print() void { - \\ asm volatile ("ecall" - \\ : - \\ : [number] "{a7}" (64), - \\ [arg1] "{a0}" (1), - \\ [arg2] "{a1}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{a2}" ("Hello, World!\n".len) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - , - "Hello, World!\n", - ); - } -} diff --git a/test/stage2/sparcv9.zig b/test/stage2/sparcv9.zig deleted file mode 100644 index d5611a7fae3f8a12f2f5137086c3821e55a77631..0000000000000000000000000000000000000000 --- a/test/stage2/sparcv9.zig +++ /dev/null @@ -1,39 +0,0 @@ -const std = @import("std"); -const TestContext = @import("../../src/test.zig").TestContext; - -const linux_sparcv9 = std.zig.CrossTarget{ - .cpu_arch = .sparcv9, - .os_tag = .linux, -}; - -pub fn addCases(ctx: *TestContext) !void { - { - var case = ctx.exe("sparcv9 hello world", linux_sparcv9); - // Regular old hello world - case.addCompareOutput( - \\const msg = "Hello, World!\n"; - \\ - \\pub export fn _start() noreturn { - \\ asm volatile ("ta 0x6d" - \\ : - \\ : [number] "{g1}" (4), - \\ [arg1] "{o0}" (1), - \\ [arg2] "{o1}" (@ptrToInt(msg)), - \\ [arg3] "{o2}" (msg.len) - \\ : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory" - \\ ); - \\ - \\ asm volatile ("ta 0x6d" - \\ : - \\ : [number] "{g1}" (1), - \\ [arg1] "{o0}" (0) - \\ : "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", "memory" - \\ ); - \\ - \\ unreachable; - \\} - , - "Hello, World!\n", - ); - } -} diff --git a/test/stage2/wasm.zig b/test/stage2/wasm.zig deleted file mode 100644 index 7c7e203b40b3f369dd3c967f2daf29117b532b6e..0000000000000000000000000000000000000000 --- a/test/stage2/wasm.zig +++ /dev/null @@ -1,796 +0,0 @@ -const std = @import("std"); -const TestContext = @import("../../src/test.zig").TestContext; - -const wasi = std.zig.CrossTarget{ - .cpu_arch = .wasm32, - .os_tag = .wasi, -}; - -pub fn addCases(ctx: *TestContext) !void { - { - var case = ctx.exe("wasm function calls", wasi); - - case.addCompareOutput( - \\pub fn main() void { - \\ foo(); - \\ bar(); - \\} - \\fn foo() void { - \\ bar(); - \\ bar(); - \\} - \\fn bar() void {} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ bar(); - \\ foo(); - \\ foo(); - \\ bar(); - \\ foo(); - \\ bar(); - \\} - \\fn foo() void { - \\ bar(); - \\} - \\fn bar() void {} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ bar(); - \\ foo(); - \\ return; - \\} - \\fn foo() void { - \\ bar(); - \\ bar(); - \\ bar(); - \\} - \\fn bar() void {} - , - "", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ foo(10, 20); - \\} - \\fn foo(x: u8, y: u8) void { _ = x; _ = y; } - , ""); - } - - { - var case = ctx.exe("wasm locals", wasi); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u8 = 5; - \\ var y: f32 = 42.0; - \\ var x: u8 = 10; - \\ if (false) { - \\ y; - \\ x; - \\ } - \\ if (i != 5) unreachable; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u8 = 5; - \\ var y: f32 = 42.0; - \\ _ = y; - \\ var x: u8 = 10; - \\ foo(i, x); - \\ i = x; - \\ if (i != 10) unreachable; - \\} - \\fn foo(x: u8, y: u8) void { - \\ _ = y; - \\ var i: u8 = 10; - \\ i = x; - \\} - , ""); - } - - { - var case = ctx.exe("wasm binary operands", wasi); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u8 = 5; - \\ i += 20; - \\ if (i != 25) unreachable; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: i32 = 2147483647; - \\ if (i +% 1 != -2147483648) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: i4 = 7; - \\ if (i +% 1 != 0) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 255; - \\ return i +% 1; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 5; - \\ i += 20; - \\ var result: u8 = foo(i, 10); - \\ return result - 35; - \\} - \\fn foo(x: u8, y: u8) u8 { - \\ return x + y; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 20; - \\ i -= 5; - \\ return i - 15; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: i32 = -2147483648; - \\ if (i -% 1 != 2147483647) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: i7 = -64; - \\ if (i -% 1 != 63) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u4 = 0; - \\ if(i -% 1 != 15) unreachable; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 5; - \\ i -= 3; - \\ var result: u8 = foo(i, 10); - \\ return result - 8; - \\} - \\fn foo(x: u8, y: u8) u8 { - \\ return y - x; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u32 = 5; - \\ i *= 7; - \\ var result: u32 = foo(i, 10); - \\ if (result != 350) unreachable; - \\ return; - \\} - \\fn foo(x: u32, y: u32) u32 { - \\ return x * y; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: i32 = 2147483647; - \\ const result = i *% 2; - \\ if (result != -2) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u3 = 3; - \\ if (i *% 3 != 1) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: i4 = 3; - \\ if (i *% 3 != 1) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u32 = 352; - \\ i /= 7; // i = 50 - \\ var result: u32 = foo(i, 7); - \\ if (result != 7) unreachable; - \\ return; - \\} - \\fn foo(x: u32, y: u32) u32 { - \\ return x / y; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 5; - \\ i &= 6; - \\ return i - 4; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 5; - \\ i |= 6; - \\ return i - 7; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 5; - \\ i ^= 6; - \\ return i - 3; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var b: bool = false; - \\ b = b or false; - \\ if (b) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var b: bool = true; - \\ b = b or false; - \\ if (!b) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var b: bool = false; - \\ b = b or true; - \\ if (!b) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var b: bool = true; - \\ b = b or true; - \\ if (!b) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var b: bool = false; - \\ b = b and false; - \\ if (b) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var b: bool = true; - \\ b = b and false; - \\ if (b) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var b: bool = false; - \\ b = b and true; - \\ if (b) unreachable; - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ var b: bool = true; - \\ b = b and true; - \\ if (!b) unreachable; - \\ return; - \\} - , ""); - } - - { - var case = ctx.exe("wasm conditions", wasi); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 5; - \\ if (i > @as(u8, 4)) { - \\ i += 10; - \\ } - \\ return i - 15; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 5; - \\ if (i < @as(u8, 4)) { - \\ i += 10; - \\ } else { - \\ i = 2; - \\ } - \\ return i - 2; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 5; - \\ if (i < @as(u8, 4)) { - \\ i += 10; - \\ } else if(i == @as(u8, 5)) { - \\ i = 20; - \\ } - \\ return i - 20; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 11; - \\ if (i < @as(u8, 4)) { - \\ i += 10; - \\ } else { - \\ if (i > @as(u8, 10)) { - \\ i += 20; - \\ } else { - \\ i = 20; - \\ } - \\ } - \\ return i - 31; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ assert(foo(true) != @as(i32, 30)); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\fn foo(ok: bool) i32 { - \\ const x = if(ok) @as(i32, 20) else @as(i32, 10); - \\ return x; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ assert(foo(false) == @as(i32, 20)); - \\ assert(foo(true) == @as(i32, 30)); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - \\ - \\fn foo(ok: bool) i32 { - \\ const val: i32 = blk: { - \\ var x: i32 = 1; - \\ if (!ok) break :blk x + @as(i32, 9); - \\ break :blk x + @as(i32, 19); - \\ }; - \\ return val + 10; - \\} - , ""); - } - - { - var case = ctx.exe("wasm while loops", wasi); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 0; - \\ while(i < @as(u8, 5)){ - \\ i += 1; - \\ } - \\ - \\ return i - 5; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 0; - \\ while(i < @as(u8, 10)){ - \\ var x: u8 = 1; - \\ i += x; - \\ } - \\ return i - 10; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var i: u8 = 0; - \\ while(i < @as(u8, 10)){ - \\ var x: u8 = 1; - \\ i += x; - \\ if (i == @as(u8, 5)) break; - \\ } - \\ return i - 5; - \\} - , ""); - } - - { - var case = ctx.exe("wasm enum values", wasi); - - case.addCompareOutput( - \\const Number = enum { One, Two, Three }; - \\ - \\pub fn main() void { - \\ var number1 = Number.One; - \\ var number2: Number = .Two; - \\ if (false) { - \\ number1; - \\ number2; - \\ } - \\ const number3 = @intToEnum(Number, 2); - \\ if (@enumToInt(number3) != 2) { - \\ unreachable; - \\ } - \\ return; - \\} - , ""); - - case.addCompareOutput( - \\const Number = enum { One, Two, Three }; - \\ - \\pub fn main() void { - \\ var number1 = Number.One; - \\ var number2: Number = .Two; - \\ const number3 = @intToEnum(Number, 2); - \\ assert(number1 != number2); - \\ assert(number2 != number3); - \\ assert(@enumToInt(number1) == 0); - \\ assert(@enumToInt(number2) == 1); - \\ assert(@enumToInt(number3) == 2); - \\ var x: Number = .Two; - \\ assert(number2 == x); - \\ - \\ return; - \\} - \\fn assert(val: bool) void { - \\ if(!val) unreachable; - \\} - , ""); - } - - { - var case = ctx.exe("wasm structs", wasi); - - case.addCompareOutput( - \\const Example = struct { x: u8 }; - \\ - \\pub fn main() u8 { - \\ var example: Example = .{ .x = 5 }; - \\ return example.x - 5; - \\} - , ""); - - case.addCompareOutput( - \\const Example = struct { x: u8 }; - \\ - \\pub fn main() u8 { - \\ var example: Example = .{ .x = 5 }; - \\ example.x = 10; - \\ return example.x - 10; - \\} - , ""); - - case.addCompareOutput( - \\const Example = struct { x: u8, y: u8 }; - \\ - \\pub fn main() u8 { - \\ var example: Example = .{ .x = 5, .y = 10 }; - \\ return example.y + example.x - 15; - \\} - , ""); - - case.addCompareOutput( - \\const Example = struct { x: u8, y: u8 }; - \\ - \\pub fn main() u8 { - \\ var example: Example = .{ .x = 5, .y = 10 }; - \\ var example2: Example = .{ .x = 10, .y = 20 }; - \\ - \\ example = example2; - \\ return example.y + example.x - 30; - \\} - , ""); - - case.addCompareOutput( - \\const Example = struct { x: u8, y: u8 }; - \\ - \\pub fn main() u8 { - \\ var example: Example = .{ .x = 5, .y = 10 }; - \\ - \\ example = .{ .x = 10, .y = 20 }; - \\ return example.y + example.x - 30; - \\} - , ""); - } - - { - var case = ctx.exe("wasm switch", wasi); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var val: u8 = 1; - \\ var a: u8 = switch (val) { - \\ 0, 1 => 2, - \\ 2 => 3, - \\ 3 => 4, - \\ else => 5, - \\ }; - \\ - \\ return a - 2; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var val: u8 = 2; - \\ var a: u8 = switch (val) { - \\ 0, 1 => 2, - \\ 2 => 3, - \\ 3 => 4, - \\ else => 5, - \\ }; - \\ - \\ return a - 3; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var val: u8 = 10; - \\ var a: u8 = switch (val) { - \\ 0, 1 => 2, - \\ 2 => 3, - \\ 3 => 4, - \\ else => 5, - \\ }; - \\ - \\ return a - 5; - \\} - , ""); - - case.addCompareOutput( - \\const MyEnum = enum { One, Two, Three }; - \\ - \\pub fn main() u8 { - \\ var val: MyEnum = .Two; - \\ var a: u8 = switch (val) { - \\ .One => 1, - \\ .Two => 2, - \\ .Three => 3, - \\ }; - \\ - \\ return a - 2; - \\} - , ""); - } - - { - var case = ctx.exe("wasm error unions", wasi); - - case.addCompareOutput( - \\pub fn main() void { - \\ var e1 = error.Foo; - \\ var e2 = error.Bar; - \\ assert(e1 != e2); - \\ assert(e1 == error.Foo); - \\ assert(e2 == error.Bar); - \\} - \\ - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var e: anyerror!u8 = 5; - \\ const i = e catch 10; - \\ return i - 5; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var e: anyerror!u8 = error.Foo; - \\ const i = e catch 10; - \\ return i - 10; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var e = foo(); - \\ const i = e catch 69; - \\ return i - 5; - \\} - \\ - \\fn foo() anyerror!u8 { - \\ return 5; - \\} - , ""); - } - - { - var case = ctx.exe("wasm error union part 2", wasi); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var e = foo(); - \\ const i = e catch 69; - \\ return i - 69; - \\} - \\ - \\fn foo() anyerror!u8 { - \\ return error.Bruh; - \\} - , ""); - case.addCompareOutput( - \\pub fn main() u8 { - \\ var e = foo(); - \\ const i = e catch 42; - \\ return i - 42; - \\} - \\ - \\fn foo() anyerror!u8 { - \\ return error.Dab; - \\} - , ""); - } - - { - var case = ctx.exe("wasm integer widening", wasi); - - case.addCompareOutput( - \\pub fn main() void{ - \\ var x: u8 = 5; - \\ var y: u64 = x; - \\ _ = y; - \\ return; - \\} - , ""); - } - - { - var case = ctx.exe("wasm optionals", wasi); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var x: ?u8 = 5; - \\ var y: u8 = 0; - \\ if (x) |val| { - \\ y = val; - \\ } - \\ return y - 5; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var x: ?u8 = null; - \\ var y: u8 = 0; - \\ if (x) |val| { - \\ y = val; - \\ } - \\ return y; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var x: ?u8 = 5; - \\ return x.? - 5; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var x: u8 = 5; - \\ var y: ?u8 = x; - \\ return y.? - 5; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var val: ?u8 = 5; - \\ while (val) |*v| { - \\ v.* -= 1; - \\ if (v.* == 2) { - \\ val = null; - \\ } - \\ } - \\ return 0; - \\} - , ""); - } - - { - var case = ctx.exe("wasm pointers", wasi); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var x: u8 = 0; - \\ - \\ foo(&x); - \\ return x - 2; - \\} - \\ - \\fn foo(x: *u8)void { - \\ x.* = 2; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() u8 { - \\ var x: u8 = 0; - \\ - \\ foo(&x); - \\ bar(&x); - \\ return x - 4; - \\} - \\ - \\fn foo(x: *u8)void { - \\ x.* = 2; - \\} - \\ - \\fn bar(x: *u8) void { - \\ x.* += 2; - \\} - , ""); - } -} diff --git a/test/stage2/x86_64.zig b/test/stage2/x86_64.zig deleted file mode 100644 index 214b32b025bf01f4f03b4ae856736c1499a300a7..0000000000000000000000000000000000000000 --- a/test/stage2/x86_64.zig +++ /dev/null @@ -1,2288 +0,0 @@ -const std = @import("std"); -const CrossTarget = std.zig.CrossTarget; -const TestContext = @import("../../src/test.zig").TestContext; - -const linux_x64 = std.zig.CrossTarget{ - .cpu_arch = .x86_64, - .os_tag = .linux, -}; -const macos_x64 = CrossTarget{ - .cpu_arch = .x86_64, - .os_tag = .macos, -}; -const all_targets: []const CrossTarget = &[_]CrossTarget{ - linux_x64, - macos_x64, -}; - -pub fn addCases(ctx: *TestContext) !void { - try addLinuxTestCases(ctx); - try addMacOsTestCases(ctx); - - // Common tests - for (all_targets) |target| { - { - var case = ctx.exe("adding numbers at runtime and comptime", target); - case.addCompareOutput( - \\pub fn main() void { - \\ add(3, 4); - \\} - \\ - \\fn add(a: u32, b: u32) void { - \\ if (a + b != 7) unreachable; - \\} - , - "", - ); - // comptime function call - case.addCompareOutput( - \\pub fn main() void { - \\ if (x - 7 != 0) unreachable; - \\} - \\ - \\fn add(a: u32, b: u32) u32 { - \\ return a + b; - \\} - \\ - \\const x = add(3, 4); - , - "", - ); - // Inline function call - case.addCompareOutput( - \\pub fn main() void { - \\ var x: usize = 3; - \\ const y = add(1, 2, x); - \\ if (y - 6 != 0) unreachable; - \\} - \\ - \\fn add(a: usize, b: usize, c: usize) callconv(.Inline) usize { - \\ return a + b + c; - \\} - , - "", - ); - } - - { - var case = ctx.exe("subtracting numbers at runtime", target); - case.addCompareOutput( - \\pub fn main() void { - \\ sub(7, 4); - \\} - \\ - \\fn sub(a: u32, b: u32) void { - \\ if (a - b != 3) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("unused vars", target); - case.addError( - \\pub fn main() void { - \\ const x = 1; - \\} - , &.{":2:11: error: unused local constant"}); - } - - { - var case = ctx.exe("multiplying numbers at runtime and comptime", target); - case.addCompareOutput( - \\pub fn main() void { - \\ mul(3, 4); - \\} - \\ - \\fn mul(a: u32, b: u32) void { - \\ if (a * b != 12) unreachable; - \\} - , - "", - ); - // comptime function call - case.addCompareOutput( - \\pub fn main() void { - \\ if (x - 12 != 0) unreachable; - \\} - \\ - \\fn mul(a: u32, b: u32) u32 { - \\ return a * b; - \\} - \\ - \\const x = mul(3, 4); - , - "", - ); - // Inline function call - case.addCompareOutput( - \\pub fn main() void { - \\ var x: usize = 5; - \\ const y = mul(2, 3, x); - \\ if (y - 30 != 0) unreachable; - \\} - \\ - \\fn mul(a: usize, b: usize, c: usize) callconv(.Inline) usize { - \\ return a * b * c; - \\} - , - "", - ); - } - - { - var case = ctx.exe("assert function", target); - case.addCompareOutput( - \\pub fn main() void { - \\ add(3, 4); - \\} - \\ - \\fn add(a: u32, b: u32) void { - \\ assert(a + b == 7); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Tests copying a register. For the `c = a + b`, it has to - // preserve both a and b, because they are both used later. - case.addCompareOutput( - \\pub fn main() void { - \\ add(3, 4); - \\} - \\ - \\fn add(a: u32, b: u32) void { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ assert(e == 14); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // More stress on the liveness detection. - case.addCompareOutput( - \\pub fn main() void { - \\ add(3, 4); - \\} - \\ - \\fn add(a: u32, b: u32) void { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ const f = d + e; // 24 - \\ const g = e + f; // 38 - \\ const h = f + g; // 62 - \\ const i = g + h; // 100 - \\ assert(i == 100); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Requires a second move. The register allocator should figure out to re-use rax. - case.addCompareOutput( - \\pub fn main() void { - \\ add(3, 4); - \\} - \\ - \\fn add(a: u32, b: u32) void { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ const f = d + e; // 24 - \\ const g = e + f; // 38 - \\ const h = f + g; // 62 - \\ const i = g + h; // 100 - \\ const j = i + d; // 110 - \\ assert(j == 110); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Now we test integer return values. - case.addCompareOutput( - \\pub fn main() void { - \\ assert(add(3, 4) == 7); - \\ assert(add(20, 10) == 30); - \\} - \\ - \\fn add(a: u32, b: u32) u32 { - \\ return a + b; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Local mutable variables. - case.addCompareOutput( - \\pub fn main() void { - \\ assert(add(3, 4) == 7); - \\ assert(add(20, 10) == 30); - \\} - \\ - \\fn add(a: u32, b: u32) u32 { - \\ var x: u32 = undefined; - \\ x = 0; - \\ x += a; - \\ x += b; - \\ return x; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Optionals - case.addCompareOutput( - \\pub fn main() void { - \\ const a: u32 = 2; - \\ const b: ?u32 = a; - \\ const c = b.?; - \\ if (c != 2) unreachable; - \\} - , - "", - ); - - switch (target.getOsTag()) { - .linux => { - // While loops - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u32 = 0; - \\ while (i < 4) : (i += 1) print(); - \\ assert(i == 4); - \\} - \\ - \\fn print() void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("hello\n")), - \\ [arg3] "{rdx}" (6) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "hello\nhello\nhello\nhello\n", - ); - - // inline while requires the condition to be comptime known. - case.addError( - \\pub fn main() void { - \\ var i: u32 = 0; - \\ inline while (i < 4) : (i += 1) print(); - \\ assert(i == 4); - \\} - \\ - \\fn print() void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("hello\n")), - \\ [arg3] "{rdx}" (6) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , &[_][]const u8{":3:21: error: unable to resolve comptime value"}); - }, - .macos => { - // While loops - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ var i: u32 = 0; - \\ while (i < 4) : (i += 1) print(); - \\ assert(i == 4); - \\} - \\ - \\fn print() void { - \\ _ = write(1, @ptrToInt("hello\n"), 6); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "hello\nhello\nhello\nhello\n", - ); - - // inline while requires the condition to be comptime known. - case.addError( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ var i: u32 = 0; - \\ inline while (i < 4) : (i += 1) print(); - \\ assert(i == 4); - \\} - \\ - \\fn print() void { - \\ _ = write(1, @ptrToInt("hello\n"), 6); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , &[_][]const u8{":5:21: error: unable to resolve comptime value"}); - }, - else => unreachable, - } - - // Labeled blocks (no conditional branch) - case.addCompareOutput( - \\pub fn main() void { - \\ assert(add(3, 4) == 20); - \\} - \\ - \\fn add(a: u32, b: u32) u32 { - \\ const x: u32 = blk: { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ break :blk e; - \\ }; - \\ const y = x + a; // 17 - \\ const z = y + a; // 20 - \\ return z; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // This catches a possible bug in the logic for re-using dying operands. - case.addCompareOutput( - \\pub fn main() void { - \\ assert(add(3, 4) == 116); - \\} - \\ - \\fn add(a: u32, b: u32) u32 { - \\ const x: u32 = blk: { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ const f = d + e; // 24 - \\ const g = e + f; // 38 - \\ const h = f + g; // 62 - \\ const i = g + h; // 100 - \\ const j = i + d; // 110 - \\ break :blk j; - \\ }; - \\ const y = x + a; // 113 - \\ const z = y + a; // 116 - \\ return z; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Spilling registers to the stack. - case.addCompareOutput( - \\pub fn main() void { - \\ assert(add(3, 4) == 1221); - \\ assert(mul(3, 4) == 21609); - \\} - \\ - \\fn add(a: u32, b: u32) u32 { - \\ const x: u32 = blk: { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ const f = d + e; // 24 - \\ const g = e + f; // 38 - \\ const h = f + g; // 62 - \\ const i = g + h; // 100 - \\ const j = i + d; // 110 - \\ const k = i + j; // 210 - \\ const l = j + k; // 320 - \\ const m = l + c; // 327 - \\ const n = m + d; // 337 - \\ const o = n + e; // 351 - \\ const p = o + f; // 375 - \\ const q = p + g; // 413 - \\ const r = q + h; // 475 - \\ const s = r + i; // 575 - \\ const t = s + j; // 685 - \\ const u = t + k; // 895 - \\ const v = u + l; // 1215 - \\ break :blk v; - \\ }; - \\ const y = x + a; // 1218 - \\ const z = y + a; // 1221 - \\ return z; - \\} - \\ - \\fn mul(a: u32, b: u32) u32 { - \\ const x: u32 = blk: { - \\ const c = a * a * a * a; // 81 - \\ const d = a * a * a * b; // 108 - \\ const e = a * a * b * a; // 108 - \\ const f = a * a * b * b; // 144 - \\ const g = a * b * a * a; // 108 - \\ const h = a * b * a * b; // 144 - \\ const i = a * b * b * a; // 144 - \\ const j = a * b * b * b; // 192 - \\ const k = b * a * a * a; // 108 - \\ const l = b * a * a * b; // 144 - \\ const m = b * a * b * a; // 144 - \\ const n = b * a * b * b; // 192 - \\ const o = b * b * a * a; // 144 - \\ const p = b * b * a * b; // 192 - \\ const q = b * b * b * a; // 192 - \\ const r = b * b * b * b; // 256 - \\ const s = c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r; // 2401 - \\ break :blk s; - \\ }; - \\ const y = x * a; // 7203 - \\ const z = y * a; // 21609 - \\ return z; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Reusing the registers of dead operands playing nicely with conditional branching. - case.addCompareOutput( - \\pub fn main() void { - \\ assert(add(3, 4) == 791); - \\ assert(add(4, 3) == 79); - \\} - \\ - \\fn add(a: u32, b: u32) u32 { - \\ const x: u32 = if (a < b) blk: { - \\ const c = a + b; // 7 - \\ const d = a + c; // 10 - \\ const e = d + b; // 14 - \\ const f = d + e; // 24 - \\ const g = e + f; // 38 - \\ const h = f + g; // 62 - \\ const i = g + h; // 100 - \\ const j = i + d; // 110 - \\ const k = i + j; // 210 - \\ const l = k + c; // 217 - \\ const m = l + d; // 227 - \\ const n = m + e; // 241 - \\ const o = n + f; // 265 - \\ const p = o + g; // 303 - \\ const q = p + h; // 365 - \\ const r = q + i; // 465 - \\ const s = r + j; // 575 - \\ const t = s + k; // 785 - \\ break :blk t; - \\ } else blk: { - \\ const t = b + b + a; // 10 - \\ const c = a + t; // 14 - \\ const d = c + t; // 24 - \\ const e = d + t; // 34 - \\ const f = e + t; // 44 - \\ const g = f + t; // 54 - \\ const h = c + g; // 68 - \\ break :blk h + b; // 71 - \\ }; - \\ const y = x + a; // 788, 75 - \\ const z = y + a; // 791, 79 - \\ return z; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Character literals and multiline strings. - case.addCompareOutput( - \\pub fn main() void { - \\ const ignore = - \\ \\ cool thx - \\ \\ - \\ ; - \\ _ = ignore; - \\ add('ぁ', '\x03'); - \\} - \\ - \\fn add(a: u32, b: u32) void { - \\ assert(a + b == 12356); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Global const. - case.addCompareOutput( - \\pub fn main() void { - \\ add(aa, bb); - \\} - \\ - \\const aa = 'ぁ'; - \\const bb = '\x03'; - \\ - \\fn add(a: u32, b: u32) void { - \\ assert(a + b == 12356); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Array access. - case.addCompareOutput( - \\pub fn main() void { - \\ assert("hello"[0] == 'h'); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // Array access to a global array. - case.addCompareOutput( - \\const hello = "hello".*; - \\pub fn main() void { - \\ assert(hello[1] == 'e'); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - // 64bit set stack - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u64 = 0xFFEEDDCCBBAA9988; - \\ assert(i == 0xFFEEDDCCBBAA9988); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - switch (target.getOsTag()) { - .linux => { - // Basic for loop - case.addCompareOutput( - \\pub fn main() void { - \\ for ("hello") |_| print(); - \\} - \\ - \\fn print() void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("hello\n")), - \\ [arg3] "{rdx}" (6) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - , - "hello\nhello\nhello\nhello\nhello\n", - ); - }, - .macos => { - // Basic for loop - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ for ("hello") |_| print(); - \\} - \\ - \\fn print() void { - \\ _ = write(1, @ptrToInt("hello\n"), 6); - \\} - , - "hello\nhello\nhello\nhello\nhello\n", - ); - }, - else => unreachable, - } - } - - { - var case = ctx.exe("@TypeOf", target); - case.addCompareOutput( - \\pub fn main() void { - \\ var x: usize = 0; - \\ _ = x; - \\ const z = @TypeOf(x, @as(u128, 5)); - \\ assert(z == u128); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - case.addCompareOutput( - \\pub fn main() void { - \\ const z = @TypeOf(true); - \\ assert(z == bool); - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - case.addError( - \\pub fn main() void { - \\ _ = @TypeOf(true, 1); - \\} - , &[_][]const u8{ - ":2:9: error: incompatible types: 'bool' and 'comptime_int'", - ":2:17: note: type 'bool' here", - ":2:23: note: type 'comptime_int' here", - }); - } - - { - var case = ctx.exe("basic import", target); - case.addCompareOutput( - \\pub fn main() void { - \\ @import("print.zig").print(); - \\} - , - "Hello, World!\n", - ); - switch (target.getOsTag()) { - .linux => try case.files.append(.{ - .src = - \\pub fn print() void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (@as(usize, 1)), - \\ [arg1] "{rdi}" (@as(usize, 1)), - \\ [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{rdx}" (@as(usize, 14)) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - , - .path = "print.zig", - }), - .macos => try case.files.append(.{ - .src = - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn print() void { - \\ _ = write(1, @ptrToInt("Hello, World!\n"), 14); - \\} - , - .path = "print.zig", - }), - else => unreachable, - } - } - - { - var case = ctx.exe("redundant comptime", target); - case.addError( - \\pub fn main() void { - \\ var a: comptime u32 = 0; - \\} - , - &.{":2:12: error: redundant comptime keyword in already comptime scope"}, - ); - case.addError( - \\pub fn main() void { - \\ comptime { - \\ var a: u32 = comptime 0; - \\ } - \\} - , - &.{":3:22: error: redundant comptime keyword in already comptime scope"}, - ); - } - { - var case = ctx.exe("try in comptime in struct in test", target); - case.addError( - \\test "@unionInit on union w/ tag but no fields" { - \\ const S = struct { - \\ comptime { - \\ try expect(false); - \\ } - \\ }; - \\ _ = S; - \\} - , - &.{":4:13: error: 'try' outside function scope"}, - ); - } - { - var case = ctx.exe("import private", target); - case.addError( - \\pub fn main() void { - \\ @import("print.zig").print(); - \\} - , - &.{ - ":2:25: error: 'print' is not marked 'pub'", - "print.zig:2:1: note: declared here", - }, - ); - switch (target.getOsTag()) { - .linux => try case.files.append(.{ - .src = - \\// dummy comment to make print be on line 2 - \\fn print() void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (@as(usize, 1)), - \\ [arg1] "{rdi}" (@as(usize, 1)), - \\ [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{rdx}" (@as(usize, 14)) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - , - .path = "print.zig", - }), - .macos => try case.files.append(.{ - .src = - \\extern "c" fn write(usize, usize, usize) usize; - \\fn print() void { - \\ _ = write(1, @ptrToInt("Hello, World!\n"), 14); - \\} - , - .path = "print.zig", - }), - else => unreachable, - } - } - - ctx.compileError("function redeclaration", target, - \\// dummy comment - \\fn entry() void {} - \\fn entry() void {} - \\ - \\fn foo() void { - \\ var foo = 1234; - \\} - , &[_][]const u8{ - ":3:1: error: redeclaration of 'entry'", - ":2:1: note: other declaration here", - ":6:9: error: local shadows declaration of 'foo'", - ":5:1: note: declared here", - }); - - ctx.compileError("returns in try", target, - \\pub fn main() !void { - \\ try a(); - \\ try b(); - \\} - \\ - \\pub fn a() !void { - \\ defer try b(); - \\} - \\pub fn b() !void { - \\ defer return a(); - \\} - , &[_][]const u8{ - ":7:8: error: 'try' not allowed inside defer expression", - ":10:8: error: cannot return from defer expression", - }); - - ctx.compileError("ambiguous references", target, - \\const T = struct { - \\ const T = struct { - \\ fn f() void { - \\ _ = T; - \\ } - \\ }; - \\}; - , &.{ - ":4:17: error: ambiguous reference", - ":2:5: note: declared here", - ":1:1: note: also declared here", - }); - - ctx.compileError("inner func accessing outer var", target, - \\pub fn f() void { - \\ var bar: bool = true; - \\ const S = struct { - \\ fn baz() bool { - \\ return bar; - \\ } - \\ }; - \\ _ = S; - \\} - , &.{ - ":5:20: error: mutable 'bar' not accessible from here", - ":2:9: note: declared mutable here", - ":3:15: note: crosses namespace boundary here", - }); - - ctx.compileError("global variable redeclaration", target, - \\// dummy comment - \\var foo = false; - \\var foo = true; - , &[_][]const u8{ - ":3:1: error: redeclaration of 'foo'", - ":2:1: note: other declaration here", - }); - - ctx.compileError("compileError", target, - \\export fn foo() void { - \\ @compileError("this is an error"); - \\} - , &[_][]const u8{":2:3: error: this is an error"}); - - { - var case = ctx.exe("intToPtr", target); - case.addError( - \\pub fn main() void { - \\ _ = @intToPtr(*u8, 0); - \\} - , &[_][]const u8{ - ":2:24: error: pointer type '*u8' does not allow address zero", - }); - case.addError( - \\pub fn main() void { - \\ _ = @intToPtr(*u32, 2); - \\} - , &[_][]const u8{ - ":2:25: error: pointer type '*u32' requires aligned address", - }); - } - - { - var case = ctx.obj("variable shadowing", target); - case.addError( - \\pub fn main() void { - \\ var i: u32 = 10; - \\ var i: u32 = 10; - \\} - , &[_][]const u8{ - ":3:9: error: redeclaration of local variable 'i'", - ":2:9: note: previous declaration here", - }); - case.addError( - \\var testing: i64 = 10; - \\pub fn main() void { - \\ var testing: i64 = 20; - \\} - , &[_][]const u8{ - ":3:9: error: local shadows declaration of 'testing'", - ":1:1: note: declared here", - }); - case.addError( - \\fn a() type { - \\ return struct { - \\ pub fn b() void { - \\ const c = 6; - \\ const c = 69; - \\ } - \\ }; - \\} - , &[_][]const u8{ - ":5:19: error: redeclaration of local constant 'c'", - ":4:19: note: previous declaration here", - }); - case.addError( - \\pub fn main() void { - \\ var i = 0; - \\ for ("n") |_, i| { - \\ } - \\} - , &[_][]const u8{ - ":3:19: error: redeclaration of local variable 'i'", - ":2:9: note: previous declaration here", - }); - case.addError( - \\pub fn main() void { - \\ var i = 0; - \\ for ("n") |i| { - \\ } - \\} - , &[_][]const u8{ - ":3:16: error: redeclaration of local variable 'i'", - ":2:9: note: previous declaration here", - }); - case.addError( - \\pub fn main() void { - \\ var i = 0; - \\ while ("n") |i| { - \\ } - \\} - , &[_][]const u8{ - ":3:18: error: redeclaration of local variable 'i'", - ":2:9: note: previous declaration here", - }); - case.addError( - \\pub fn main() void { - \\ var i = 0; - \\ while ("n") |bruh| { - \\ _ = bruh; - \\ } else |i| { - \\ - \\ } - \\} - , &[_][]const u8{ - ":5:13: error: redeclaration of local variable 'i'", - ":2:9: note: previous declaration here", - }); - case.addError( - \\pub fn main() void { - \\ var i = 0; - \\ if (true) |i| {} - \\} - , &[_][]const u8{ - ":3:16: error: redeclaration of local variable 'i'", - ":2:9: note: previous declaration here", - }); - case.addError( - \\pub fn main() void { - \\ var i = 0; - \\ if (true) |i| {} else |e| {} - \\} - , &[_][]const u8{ - ":3:16: error: redeclaration of local variable 'i'", - ":2:9: note: previous declaration here", - }); - case.addError( - \\pub fn main() void { - \\ var i = 0; - \\ if (true) |_| {} else |i| {} - \\} - , &[_][]const u8{ - ":3:28: error: redeclaration of local variable 'i'", - ":2:9: note: previous declaration here", - }); - } - - { - // TODO make the test harness support checking the compile log output too - var case = ctx.obj("@compileLog", target); - // The other compile error prevents emission of a "found compile log" statement. - case.addError( - \\export fn _start() noreturn { - \\ const b = true; - \\ var f: u32 = 1; - \\ @compileLog(b, 20, f, x); - \\ @compileLog(1000); - \\ var bruh: usize = true; - \\ _ = bruh; - \\ unreachable; - \\} - \\export fn other() void { - \\ @compileLog(1234); - \\} - \\fn x() void {} - , &[_][]const u8{ - ":6:23: error: expected usize, found bool", - }); - - // Now only compile log statements remain. One per Decl. - case.addError( - \\export fn _start() noreturn { - \\ const b = true; - \\ var f: u32 = 1; - \\ @compileLog(b, 20, f, x); - \\ @compileLog(1000); - \\ unreachable; - \\} - \\export fn other() void { - \\ @compileLog(1234); - \\} - \\fn x() void {} - , &[_][]const u8{ - ":9:5: error: found compile log statement", - ":4:5: note: also here", - }); - } - - { - var case = ctx.obj("extern variable has no type", target); - case.addError( - \\comptime { - \\ const x = foo + foo; - \\ _ = x; - \\} - \\extern var foo: i32; - , &[_][]const u8{":2:15: error: unable to resolve comptime value"}); - case.addError( - \\export fn entry() void { - \\ _ = foo; - \\} - \\extern var foo; - , &[_][]const u8{":4:8: error: unable to infer variable type"}); - } - - { - var case = ctx.exe("break/continue", target); - - // Break out of loop - case.addCompareOutput( - \\pub fn main() void { - \\ while (true) { - \\ break; - \\ } - \\} - , - "", - ); - case.addCompareOutput( - \\pub fn main() void { - \\ foo: while (true) { - \\ break :foo; - \\ } - \\} - , - "", - ); - - // Continue in loop - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u64 = 0; - \\ while (true) : (i+=1) { - \\ if (i == 4) return; - \\ continue; - \\ } - \\} - , - "", - ); - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u64 = 0; - \\ foo: while (true) : (i+=1) { - \\ if (i == 4) return; - \\ continue :foo; - \\ } - \\} - , - "", - ); - } - - { - var case = ctx.exe("unused labels", target); - case.addError( - \\comptime { - \\ foo: {} - \\} - , &[_][]const u8{":2:5: error: unused block label"}); - case.addError( - \\comptime { - \\ foo: while (true) {} - \\} - , &[_][]const u8{":2:5: error: unused while loop label"}); - case.addError( - \\comptime { - \\ foo: for ("foo") |_| {} - \\} - , &[_][]const u8{":2:5: error: unused for loop label"}); - case.addError( - \\comptime { - \\ blk: {blk: {}} - \\} - , &[_][]const u8{ - ":2:11: error: redefinition of label 'blk'", - ":2:5: note: previous definition here", - }); - } - - { - var case = ctx.exe("bad inferred variable type", target); - case.addError( - \\pub fn main() void { - \\ var x = null; - \\ _ = x; - \\} - , &[_][]const u8{ - ":2:9: error: variable of type '@TypeOf(null)' must be const or comptime", - }); - } - - { - var case = ctx.exe("compile error in inline fn call fixed", target); - case.addError( - \\pub fn main() void { - \\ var x: usize = 3; - \\ const y = add(10, 2, x); - \\ if (y - 6 != 0) unreachable; - \\} - \\ - \\fn add(a: usize, b: usize, c: usize) callconv(.Inline) usize { - \\ if (a == 10) @compileError("bad"); - \\ return a + b + c; - \\} - , &[_][]const u8{ - ":8:18: error: bad", - ":3:18: note: called from here", - }); - - case.addCompareOutput( - \\pub fn main() void { - \\ var x: usize = 3; - \\ const y = add(1, 2, x); - \\ if (y - 6 != 0) unreachable; - \\} - \\ - \\fn add(a: usize, b: usize, c: usize) callconv(.Inline) usize { - \\ if (a == 10) @compileError("bad"); - \\ return a + b + c; - \\} - , - "", - ); - } - { - var case = ctx.exe("recursive inline function", target); - case.addCompareOutput( - \\pub fn main() void { - \\ const y = fibonacci(7); - \\ if (y - 21 != 0) unreachable; - \\} - \\ - \\fn fibonacci(n: usize) callconv(.Inline) usize { - \\ if (n <= 2) return n; - \\ return fibonacci(n - 2) + fibonacci(n - 1); - \\} - , - "", - ); - // This additionally tests that the compile error reports the correct source location. - // Without storing source locations relative to the owner decl, the compile error - // here would be off by 2 bytes (from the "7" -> "999"). - case.addError( - \\pub fn main() void { - \\ const y = fibonacci(999); - \\ if (y - 21 != 0) unreachable; - \\} - \\ - \\fn fibonacci(n: usize) callconv(.Inline) usize { - \\ if (n <= 2) return n; - \\ return fibonacci(n - 2) + fibonacci(n - 1); - \\} - , &[_][]const u8{":8:21: error: evaluation exceeded 1000 backwards branches"}); - } - { - var case = ctx.exe("orelse at comptime", target); - case.addCompareOutput( - \\pub fn main() void { - \\ const i: ?u64 = 0; - \\ const result = i orelse 5; - \\ assert(result == 0); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , - "", - ); - case.addCompareOutput( - \\pub fn main() void { - \\ const i: ?u64 = null; - \\ const result = i orelse 5; - \\ assert(result == 5); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("passing u0 to function", target); - case.addCompareOutput( - \\pub fn main() void { - \\ doNothing(0); - \\} - \\fn doNothing(arg: u0) void { - \\ _ = arg; - \\} - , - "", - ); - } - - { - var case = ctx.exe("catch at comptime", target); - case.addCompareOutput( - \\pub fn main() void { - \\ const i: anyerror!u64 = 0; - \\ const caught = i catch 5; - \\ assert(caught == 0); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , - "", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ const i: anyerror!u64 = error.B; - \\ const caught = i catch 5; - \\ assert(caught == 5); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , - "", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ const a: anyerror!comptime_int = 42; - \\ const b: *const comptime_int = &(a catch unreachable); - \\ assert(b.* == 42); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; // assertion failure - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ const a: anyerror!u32 = error.B; - \\ _ = &(a catch |err| assert(err == error.B)); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , ""); - - case.addCompareOutput( - \\pub fn main() void { - \\ const a: anyerror!u32 = error.Bar; - \\ a catch |err| assert(err == error.Bar); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , ""); - } - - { - var case = ctx.exe("runtime bitwise and", target); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u32 = 10; - \\ var j: u32 = 11; - \\ assert(i & 1 == 0); - \\ assert(j & 1 == 1); - \\ var m1: u32 = 0b1111; - \\ var m2: u32 = 0b0000; - \\ assert(m1 & 0b1010 == 0b1010); - \\ assert(m2 & 0b1010 == 0b0000); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("runtime bitwise or", target); - - case.addCompareOutput( - \\pub fn main() void { - \\ var i: u32 = 10; - \\ var j: u32 = 11; - \\ assert(i | 1 == 11); - \\ assert(j | 1 == 11); - \\ var m1: u32 = 0b1111; - \\ var m2: u32 = 0b0000; - \\ assert(m1 | 0b1010 == 0b1111); - \\ assert(m2 | 0b1010 == 0b1010); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , - "", - ); - } - - { - var case = ctx.exe("merge error sets", target); - - case.addCompareOutput( - \\pub fn main() void { - \\ const E = error{ A, B, D } || error { A, B, C }; - \\ E.A catch {}; - \\ E.B catch {}; - \\ E.C catch {}; - \\ E.D catch {}; - \\ const E2 = error { X, Y } || @TypeOf(error.Z); - \\ E2.X catch {}; - \\ E2.Y catch {}; - \\ E2.Z catch {}; - \\ assert(anyerror || error { Z } == anyerror); - \\} - \\fn assert(b: bool) void { - \\ if (!b) unreachable; - \\} - , - "", - ); - case.addError( - \\pub fn main() void { - \\ const z = true || false; - \\ _ = z; - \\} - , &.{ - ":2:15: error: expected error set type, found 'bool'", - ":2:20: note: '||' merges error sets; 'or' performs boolean OR", - }); - } - - { - var case = ctx.exe("comptime var", target); - - case.addError( - \\pub fn main() void { - \\ var a: u32 = 0; - \\ comptime var b: u32 = 0; - \\ if (a == 0) b = 3; - \\} - , &.{ - ":4:21: error: store to comptime variable depends on runtime condition", - ":4:11: note: runtime condition here", - }); - - case.addError( - \\pub fn main() void { - \\ var a: u32 = 0; - \\ comptime var b: u32 = 0; - \\ switch (a) { - \\ 0 => {}, - \\ else => b = 3, - \\ } - \\} - , &.{ - ":6:21: error: store to comptime variable depends on runtime condition", - ":4:13: note: runtime condition here", - }); - - switch (target.getOsTag()) { - .linux => case.addCompareOutput( - \\pub fn main() void { - \\ comptime var len: u32 = 5; - \\ print(len); - \\ len += 9; - \\ print(len); - \\} - \\ - \\fn print(len: usize) void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{rdx}" (len) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - , "HelloHello, World!\n"), - .macos => case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ comptime var len: u32 = 5; - \\ print(len); - \\ len += 9; - \\ print(len); - \\} - \\ - \\fn print(len: usize) void { - \\ _ = write(1, @ptrToInt("Hello, World!\n"), len); - \\} - , "HelloHello, World!\n"), - - else => unreachable, - } - - case.addError( - \\comptime { - \\ var x: i32 = 1; - \\ x += 1; - \\ if (x != 1) unreachable; - \\} - \\pub fn main() void {} - , &.{":4:17: error: unable to resolve comptime value"}); - - case.addError( - \\pub fn main() void { - \\ comptime var i: u64 = 0; - \\ while (i < 5) : (i += 1) {} - \\} - , &.{ - ":3:24: error: cannot store to comptime variable in non-inline loop", - ":3:5: note: non-inline loop here", - }); - - case.addCompareOutput( - \\pub fn main() void { - \\ var a: u32 = 0; - \\ if (a == 0) { - \\ comptime var b: u32 = 0; - \\ b = 1; - \\ } - \\} - \\comptime { - \\ var x: i32 = 1; - \\ x += 1; - \\ if (x != 2) unreachable; - \\} - , ""); - - switch (target.getOsTag()) { - .linux => case.addCompareOutput( - \\pub fn main() void { - \\ comptime var i: u64 = 2; - \\ inline while (i < 6) : (i+=1) { - \\ print(i); - \\ } - \\} - \\fn print(len: usize) void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("Hello")), - \\ [arg3] "{rdx}" (len) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - , "HeHelHellHello"), - .macos => case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ comptime var i: u64 = 2; - \\ inline while (i < 6) : (i+=1) { - \\ print(i); - \\ } - \\} - \\fn print(len: usize) void { - \\ _ = write(1, @ptrToInt("Hello"), len); - \\} - , "HeHelHellHello"), - else => unreachable, - } - } - - { - var case = ctx.exe("double ampersand", target); - - case.addError( - \\pub const a = if (true && false) 1 else 2; - , &[_][]const u8{":1:24: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND"}); - - case.addError( - \\pub fn main() void { - \\ const a = true; - \\ const b = false; - \\ _ = a & &b; - \\} - , &[_][]const u8{ - ":4:11: error: incompatible types: 'bool' and '*const bool'", - ":4:9: note: type 'bool' here", - ":4:13: note: type '*const bool' here", - }); - - case.addCompareOutput( - \\pub fn main() void { - \\ const b: u8 = 1; - \\ _ = &&b; - \\} - , ""); - } - - { - var case = ctx.exe("setting an address space on a local variable", target); - case.addError( - \\export fn entry() i32 { - \\ var foo: i32 addrspace(".general") = 1234; - \\ return foo; - \\} - , &[_][]const u8{ - ":2:28: error: cannot set address space of local variable 'foo'", - }); - } - - { - var case = ctx.exe("saving vars of different ABI size to stack", target); - - case.addCompareOutput( - \\pub fn main() void { - \\ assert(callMe(2) == 24); - \\} - \\ - \\fn callMe(a: u8) u8 { - \\ var b: u8 = a + 10; - \\ const c = 2 * b; - \\ return c; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ assert(callMe(2) == 24); - \\} - \\ - \\fn callMe(a: u16) u16 { - \\ var b: u16 = a + 10; - \\ const c = 2 * b; - \\ return c; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - - case.addCompareOutput( - \\pub fn main() void { - \\ assert(callMe(2) == 24); - \\} - \\ - \\fn callMe(a: u32) u32 { - \\ var b: u32 = a + 10; - \\ const c = 2 * b; - \\ return c; - \\} - \\ - \\pub fn assert(ok: bool) void { - \\ if (!ok) unreachable; // assertion failure - \\} - , - "", - ); - } - { - var case = ctx.exe("issue 7187: miscompilation with bool return type", target); - case.addCompareOutput( - \\pub fn main() void { - \\ var x: usize = 1; - \\ var y: bool = getFalse(); - \\ _ = y; - \\ - \\ assert(x == 1); - \\} - \\ - \\fn getFalse() bool { - \\ return false; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - } - - { - var case = ctx.exe("load-store via pointer deref", target); - case.addCompareOutput( - \\pub fn main() void { - \\ var x: u32 = undefined; - \\ set(&x); - \\ assert(x == 123); - \\} - \\ - \\fn set(x: *u32) void { - \\ x.* = 123; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - case.addCompareOutput( - \\pub fn main() void { - \\ var x: u16 = undefined; - \\ set(&x); - \\ assert(x == 123); - \\} - \\ - \\fn set(x: *u16) void { - \\ x.* = 123; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - case.addCompareOutput( - \\pub fn main() void { - \\ var x: u8 = undefined; - \\ set(&x); - \\ assert(x == 123); - \\} - \\ - \\fn set(x: *u8) void { - \\ x.* = 123; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - } - - { - var case = ctx.exe("optional payload", target); - case.addCompareOutput( - \\pub fn main() void { - \\ var x: u32 = undefined; - \\ const maybe_x = byPtr(&x); - \\ assert(maybe_x != null); - \\ maybe_x.?.* = 123; - \\ assert(x == 123); - \\} - \\ - \\fn byPtr(x: *u32) ?*u32 { - \\ return x; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - case.addCompareOutput( - \\pub fn main() void { - \\ var x: u32 = undefined; - \\ const maybe_x = byPtr(&x); - \\ assert(maybe_x == null); - \\} - \\ - \\fn byPtr(x: *u32) ?*u32 { - \\ _ = x; - \\ return null; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - case.addCompareOutput( - \\pub fn main() void { - \\ var x: u8 = undefined; - \\ const maybe_x = byPtr(&x); - \\ assert(maybe_x != null); - \\ maybe_x.?.* = 255; - \\ assert(x == 255); - \\} - \\ - \\fn byPtr(x: *u8) ?*u8 { - \\ return x; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - case.addCompareOutput( - \\pub fn main() void { - \\ var x: i8 = undefined; - \\ const maybe_x = byPtr(&x); - \\ assert(maybe_x != null); - \\ maybe_x.?.* = -1; - \\ assert(x == -1); - \\} - \\ - \\fn byPtr(x: *i8) ?*i8 { - \\ return x; - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - } - - { - var case = ctx.exe("unwrap error union - simple errors", target); - case.addCompareOutput( - \\pub fn main() void { - \\ maybeErr() catch unreachable; - \\} - \\ - \\fn maybeErr() !void { - \\ return; - \\} - , ""); - case.addCompareOutput( - \\pub fn main() void { - \\ maybeErr() catch return; - \\ unreachable; - \\} - \\ - \\fn maybeErr() !void { - \\ return error.NoWay; - \\} - , ""); - } - - { - var case = ctx.exe("access slice element by index - slice_elem_val", target); - case.addCompareOutput( - \\var array = [_]usize{ 0, 42, 123, 34 }; - \\var slice: []const usize = &array; - \\ - \\pub fn main() void { - \\ assert(slice[0] == 0); - \\ assert(slice[1] == 42); - \\ assert(slice[2] == 123); - \\ assert(slice[3] == 34); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - } - - { - var case = ctx.exe("lower unnamed constants - structs", target); - case.addCompareOutput( - \\const Foo = struct { - \\ a: u8, - \\ b: u32, - \\ - \\ fn first(self: *Foo) u8 { - \\ return self.a; - \\ } - \\ - \\ fn second(self: *Foo) u32 { - \\ return self.b; - \\ } - \\}; - \\ - \\pub fn main() void { - \\ var foo = Foo{ .a = 1, .b = 5 }; - \\ assert(foo.first() == 1); - \\ assert(foo.second() == 5); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - - case.addCompareOutput( - \\const Foo = struct { - \\ a: u8, - \\ b: u32, - \\ - \\ fn first(self: *Foo) u8 { - \\ return self.a; - \\ } - \\ - \\ fn second(self: *Foo) u32 { - \\ return self.b; - \\ } - \\}; - \\ - \\pub fn main() void { - \\ var foo = Foo{ .a = 1, .b = 5 }; - \\ assert(foo.first() == 1); - \\ assert(foo.second() == 5); - \\ - \\ foo.a = 10; - \\ foo.b = 255; - \\ - \\ assert(foo.first() == 10); - \\ assert(foo.second() == 255); - \\ - \\ var foo2 = Foo{ .a = 15, .b = 255 }; - \\ assert(foo2.first() == 15); - \\ assert(foo2.second() == 255); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - - case.addCompareOutput( - \\const Foo = struct { - \\ a: u8, - \\ b: u32, - \\ - \\ fn first(self: *Foo) u8 { - \\ return self.a; - \\ } - \\ - \\ fn second(self: *Foo) u32 { - \\ return self.b; - \\ } - \\}; - \\ - \\pub fn main() void { - \\ var foo2 = Foo{ .a = 15, .b = 255 }; - \\ assert(foo2.first() == 15); - \\ assert(foo2.second() == 255); - \\} - \\ - \\fn assert(ok: bool) void { - \\ if (!ok) unreachable; - \\} - , ""); - } - } -} - -fn addLinuxTestCases(ctx: *TestContext) !void { - // Linux tests - { - var case = ctx.exe("hello world with updates", linux_x64); - - case.addError("", &[_][]const u8{ - ":109:9: error: struct 'tmp.tmp' has no member named 'main'", - }); - - // Incorrect return type - case.addError( - \\pub export fn _start() noreturn { - \\} - , &[_][]const u8{":2:1: error: expected noreturn, found void"}); - - // Regular old hello world - case.addCompareOutput( - \\pub export fn _start() noreturn { - \\ print(); - \\ - \\ exit(); - \\} - \\ - \\fn print() void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{rdx}" (14) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - \\ - \\fn exit() noreturn { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (231), - \\ [arg1] "{rdi}" (0) - \\ : "rcx", "r11", "memory" - \\ ); - \\ unreachable; - \\} - , - "Hello, World!\n", - ); - - // Convert to pub fn main - case.addCompareOutput( - \\pub fn main() void { - \\ print(); - \\} - \\ - \\fn print() void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{rdx}" (14) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - , - "Hello, World!\n", - ); - - // Now change the message only - case.addCompareOutput( - \\pub fn main() void { - \\ print(); - \\} - \\ - \\fn print() void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), - \\ [arg3] "{rdx}" (104) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - , - "What is up? This is a longer message that will force the data to be relocated in virtual address space.\n", - ); - // Now we print it twice. - case.addCompareOutput( - \\pub fn main() void { - \\ print(); - \\ print(); - \\} - \\ - \\fn print() void { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), - \\ [arg3] "{rdx}" (104) - \\ : "rcx", "r11", "memory" - \\ ); - \\ return; - \\} - , - \\What is up? This is a longer message that will force the data to be relocated in virtual address space. - \\What is up? This is a longer message that will force the data to be relocated in virtual address space. - \\ - ); - } - - { - var case = ctx.exe("adding numbers at comptime", linux_x64); - case.addCompareOutput( - \\pub export fn _start() noreturn { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (1), - \\ [arg1] "{rdi}" (1), - \\ [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - \\ [arg3] "{rdx}" (10 + 4) - \\ : "rcx", "r11", "memory" - \\ ); - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (@as(usize, 230) + @as(usize, 1)), - \\ [arg1] "{rdi}" (0) - \\ : "rcx", "r11", "memory" - \\ ); - \\ unreachable; - \\} - , - "Hello, World!\n", - ); - } - - { - var case = ctx.exe("only 1 function and it gets updated", linux_x64); - case.addCompareOutput( - \\pub export fn _start() noreturn { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (60), // exit - \\ [arg1] "{rdi}" (0) - \\ : "rcx", "r11", "memory" - \\ ); - \\ unreachable; - \\} - , - "", - ); - case.addCompareOutput( - \\pub export fn _start() noreturn { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (231), // exit_group - \\ [arg1] "{rdi}" (0) - \\ : "rcx", "r11", "memory" - \\ ); - \\ unreachable; - \\} - , - "", - ); - } - { - var case = ctx.exe("inline assembly", linux_x64); - - case.addError( - \\pub fn main() void { - \\ const number = 1234; - \\ const x = asm volatile ("syscall" - \\ : [o] "{rax}" (-> number) - \\ : [number] "{rax}" (231), - \\ [arg1] "{rdi}" (60) - \\ : "rcx", "r11", "memory" - \\ ); - \\ _ = x; - \\} - , &[_][]const u8{":4:27: error: expected type, found comptime_int"}); - case.addError( - \\const S = struct { - \\ comptime { - \\ asm volatile ( - \\ \\zig_moment: - \\ \\syscall - \\ ); - \\ } - \\}; - \\pub fn main() void { - \\ _ = S; - \\} - , &.{":3:13: error: volatile is meaningless on global assembly"}); - case.addError( - \\pub fn main() void { - \\ var bruh: u32 = 1; - \\ asm ("" - \\ : - \\ : [bruh] "{rax}" (4) - \\ : "memory" - \\ ); - \\} - , &.{":3:5: error: assembly expression with no output must be marked volatile"}); - case.addError( - \\pub fn main() void {} - \\comptime { - \\ asm ("" - \\ : - \\ : [bruh] "{rax}" (4) - \\ : "memory" - \\ ); - \\} - , &.{":3:5: error: global assembly cannot have inputs, outputs, or clobbers"}); - } - - { - var case = ctx.exe("issue 10138: callee preserved regs working", linux_x64); - case.addCompareOutput( - \\pub fn main() void { - \\ const fd = open(); - \\ _ = write(fd, "a", 1); - \\ _ = close(fd); - \\} - \\ - \\fn open() usize { - \\ return 42; - \\} - \\ - \\fn write(fd: usize, a: [*]const u8, len: usize) usize { - \\ return syscall4(.WRITE, fd, @ptrToInt(a), len); - \\} - \\ - \\fn syscall4(n: enum { WRITE }, a: usize, b: usize, c: usize) usize { - \\ _ = n; - \\ _ = a; - \\ _ = b; - \\ _ = c; - \\ return 23; - \\} - \\ - \\fn close(fd: usize) usize { - \\ if (fd != 42) - \\ unreachable; - \\ return 0; - \\} - , ""); - } -} - -fn addMacOsTestCases(ctx: *TestContext) !void { - // macOS tests - { - var case = ctx.exe("darwin hello world with updates", macos_x64); - case.addError("", &[_][]const u8{ - ":109:9: error: struct 'tmp.tmp' has no member named 'main'", - }); - - // Incorrect return type - case.addError( - \\pub export fn main() noreturn { - \\} - , &[_][]const u8{ - ":2:1: error: expected noreturn, found void", - }); - - // Regular old hello world - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\extern "c" fn exit(usize) noreturn; - \\ - \\pub export fn main() noreturn { - \\ print(); - \\ - \\ exit(0); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("Hello, World!\n"); - \\ const len = 14; - \\ _ = write(1, msg, len); - \\} - , - "Hello, World!\n", - ); - - // Now using start.zig without an explicit extern exit fn - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ print(); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("Hello, World!\n"); - \\ const len = 14; - \\ _ = write(1, msg, len); - \\} - , - "Hello, World!\n", - ); - - // Print it 4 times and force growth and realloc. - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ print(); - \\ print(); - \\ print(); - \\ print(); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("Hello, World!\n"); - \\ const len = 14; - \\ _ = write(1, msg, len); - \\} - , - \\Hello, World! - \\Hello, World! - \\Hello, World! - \\Hello, World! - \\ - ); - - // Print it once, and change the message. - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ print(); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); - \\ const len = 104; - \\ _ = write(1, msg, len); - \\} - , - "What is up? This is a longer message that will force the data to be relocated in virtual address space.\n", - ); - - // Now we print it twice. - case.addCompareOutput( - \\extern "c" fn write(usize, usize, usize) usize; - \\ - \\pub fn main() void { - \\ print(); - \\ print(); - \\} - \\ - \\fn print() void { - \\ const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); - \\ const len = 104; - \\ _ = write(1, msg, len); - \\} - , - \\What is up? This is a longer message that will force the data to be relocated in virtual address space. - \\What is up? This is a longer message that will force the data to be relocated in virtual address space. - \\ - ); - } -}