| ... | ... | @@ -1,64 +0,0 @@ |
| 1 | | const TestContext = @import("../../src-self-hosted/test.zig").TestContext; |
| 2 | | const std = @import("std"); |
| 3 | | |
| 4 | | const ErrorMsg = @import("../../src-self-hosted/Module.zig").ErrorMsg; |
| 5 | | |
| 6 | | const linux_x64 = std.zig.CrossTarget{ |
| 7 | | .cpu_arch = .x86_64, |
| 8 | | .os_tag = .linux, |
| 9 | | }; |
| 10 | | |
| 11 | | pub fn addCases(ctx: *TestContext) !void { |
| 12 | | ctx.compileErrorZIR("call undefined local", linux_x64, |
| 13 | | \\@noreturn = primitive(noreturn) |
| 14 | | \\ |
| 15 | | \\@start_fnty = fntype([], @noreturn, cc=Naked) |
| 16 | | \\@start = fn(@start_fnty, { |
| 17 | | \\ %0 = call(%test, []) |
| 18 | | \\}) |
| 19 | | // TODO: address inconsistency in this message and the one in the next test |
| 20 | | , &[_][]const u8{":5:13: error: unrecognized identifier: %test"}); |
| 21 | | |
| 22 | | ctx.compileErrorZIR("call with non-existent target", linux_x64, |
| 23 | | \\@noreturn = primitive(noreturn) |
| 24 | | \\ |
| 25 | | \\@start_fnty = fntype([], @noreturn, cc=Naked) |
| 26 | | \\@start = fn(@start_fnty, { |
| 27 | | \\ %0 = call(@notafunc, []) |
| 28 | | \\}) |
| 29 | | \\@0 = str("_start") |
| 30 | | \\@1 = export(@0, "start") |
| 31 | | , &[_][]const u8{":5:13: error: decl 'notafunc' not found"}); |
| 32 | | |
| 33 | | // TODO: this error should occur at the call site, not the fntype decl |
| 34 | | ctx.compileErrorZIR("call naked function", linux_x64, |
| 35 | | \\@noreturn = primitive(noreturn) |
| 36 | | \\ |
| 37 | | \\@start_fnty = fntype([], @noreturn, cc=Naked) |
| 38 | | \\@s = fn(@start_fnty, {}) |
| 39 | | \\@start = fn(@start_fnty, { |
| 40 | | \\ %0 = call(@s, []) |
| 41 | | \\}) |
| 42 | | \\@0 = str("_start") |
| 43 | | \\@1 = export(@0, "start") |
| 44 | | , &[_][]const u8{":4:9: error: unable to call function with naked calling convention"}); |
| 45 | | |
| 46 | | ctx.incrementalFailureZIR("exported symbol collision", linux_x64, |
| 47 | | \\@noreturn = primitive(noreturn) |
| 48 | | \\ |
| 49 | | \\@start_fnty = fntype([], @noreturn) |
| 50 | | \\@start = fn(@start_fnty, {}) |
| 51 | | \\ |
| 52 | | \\@0 = str("_start") |
| 53 | | \\@1 = export(@0, "start") |
| 54 | | \\@2 = export(@0, "start") |
| 55 | | , &[_][]const u8{":8:13: error: exported symbol collision: _start"}, |
| 56 | | \\@noreturn = primitive(noreturn) |
| 57 | | \\ |
| 58 | | \\@start_fnty = fntype([], @noreturn) |
| 59 | | \\@start = fn(@start_fnty, {}) |
| 60 | | \\ |
| 61 | | \\@0 = str("_start") |
| 62 | | \\@1 = export(@0, "start") |
| 63 | | ); |
| 64 | | } |