| ... | @@ -43,58 +43,46 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -43,58 +43,46 @@ pub fn addCases(ctx: *TestContext) !void { |
| 43 | \\@1 = export(@0, "start") | 43 | \\@1 = export(@0, "start") |
| 44 | , &[_][]const u8{":4:9: error: unable to call function with naked calling convention"}); | 44 | , &[_][]const u8{":4:9: error: unable to call function with naked calling convention"}); |
| 45 | | 45 | |
| 46 | { | 46 | ctx.incrementalFailureZIR("exported symbol collision", linux_x64, |
| 47 | var case = ctx.objZIR("exported symbol collision", linux_x64); | 47 | \\@noreturn = primitive(noreturn) |
| 48 | // First, ensure we receive the error correctly | 48 | \\ |
| 49 | case.addError( | 49 | \\@start_fnty = fntype([], @noreturn) |
| 50 | \\@noreturn = primitive(noreturn) | 50 | \\@start = fn(@start_fnty, {}) |
| 51 | \\ | 51 | \\ |
| 52 | \\@start_fnty = fntype([], @noreturn) | 52 | \\@0 = str("_start") |
| 53 | \\@start = fn(@start_fnty, {}) | 53 | \\@1 = export(@0, "start") |
| 54 | \\ | 54 | \\@2 = export(@0, "start") |
| 55 | \\@0 = str("_start") | 55 | , &[_][]const u8{":8:13: error: exported symbol collision: _start"}, |
| 56 | \\@1 = export(@0, "start") | 56 | \\@noreturn = primitive(noreturn) |
| 57 | \\@2 = export(@0, "start") | 57 | \\ |
| 58 | , &[_][]const u8{":8:13: error: exported symbol collision: _start"}); | 58 | \\@start_fnty = fntype([], @noreturn) |
| 59 | // Next, ensure everything works properly on the next compilation with the problem fixed | 59 | \\@start = fn(@start_fnty, {}) |
| 60 | case.compiles( | 60 | \\ |
| 61 | \\@noreturn = primitive(noreturn) | 61 | \\@0 = str("_start") |
| 62 | \\ | 62 | \\@1 = export(@0, "start") |
| 63 | \\@start_fnty = fntype([], @noreturn) | 63 | ); |
| 64 | \\@start = fn(@start_fnty, {}) | 64 | |
| 65 | \\ | 65 | ctx.incrementalFailure("function redefinition", linux_x64, |
| 66 | \\@0 = str("_start") | 66 | \\fn entry() void {} |
| 67 | \\@1 = export(@0, "start") | 67 | \\fn entry() void {} |
| 68 | ); | 68 | , &[_][]const u8{":2:4: error: redefinition of 'entry'"}, |
| 69 | } | 69 | \\fn entry() void {} |
| | 70 | ); |
| | 71 | |
| 70 | // TODO: need to make sure this works with other variants of export. | 72 | // TODO: need to make sure this works with other variants of export. |
| 71 | // As is, the same error occurs without export. | 73 | ctx.incrementalFailure("function redefinition", linux_x64, |
| 72 | { | 74 | \\export fn entry() void {} |
| 73 | var case = ctx.obj("exported symbol collision", linux_x64); | 75 | \\export fn entry() void {} |
| 74 | case.addError( | 76 | , &[_][]const u8{":2:11: error: redefinition of 'entry'"}, |
| 75 | \\export fn entry() void {} | 77 | \\export fn entry() void {} |
| 76 | \\export fn entry() void {} | 78 | ); |
| 77 | , &[_][]const u8{":2:11: error: redefinition of 'entry'"}); | 79 | |
| 78 | case.compiles( | 80 | ctx.incrementalFailure("missing function name", linux_x64, |
| 79 | \\export fn entry() void {} | 81 | \\fn() void {} |
| 80 | ); | 82 | , &[_][]const u8{":1:3: error: missing function name"}, |
| 81 | case.addError( | 83 | \\fn a() void {} |
| 82 | \\fn entry() void {} | 84 | ); |
| 83 | \\fn entry() void {} | 85 | |
| 84 | , &[_][]const u8{":2:4: error: redefinition of 'entry'"}); | | |
| 85 | case.compiles( | | |
| 86 | \\export fn entry() void {} | | |
| 87 | ); | | |
| 88 | } | | |
| 89 | { | | |
| 90 | var case = ctx.obj("missing function name", linux_x64); | | |
| 91 | case.addError( | | |
| 92 | \\fn() void {} | | |
| 93 | , &[_][]const u8{":1:3: error: missing function name"}); | | |
| 94 | case.compiles( | | |
| 95 | \\fn a() void {} | | |
| 96 | ); | | |
| 97 | } | | |
| 98 | // TODO: re-enable these tests. | 86 | // TODO: re-enable these tests. |
| 99 | // https://github.com/ziglang/zig/issues/1364 | 87 | // https://github.com/ziglang/zig/issues/1364 |
| 100 | | 88 | |