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