aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNoam Preil <pleasantatk@gmail.com>2020-06-26 03:17:13 -0400
committerNoam Preil <pleasantatk@gmail.com>2020-06-26 03:17:13 -0400
commit4a17e008daa90d5dbb0fc917d53e52c1ec990f2d (patch)
tree88ee5dcbcfe5c9d8ff1cac5923e21eb02b44eae2 /test
parente5a3cb8d7134d7c4e4db03a609c5b7b6de00edfc (diff)
downloadzig-4a17e008daa90d5dbb0fc917d53e52c1ec990f2d.tar.gz
zig-4a17e008daa90d5dbb0fc917d53e52c1ec990f2d.zip
Stage2: exported symbol collision detection
Diffstat (limited to 'test')
-rw-r--r--test/stage2/compile_errors.zig32
1 files changed, 28 insertions, 4 deletions
diff --git a/test/stage2/compile_errors.zig b/test/stage2/compile_errors.zig
index 905f106f94..79b67da2c2 100644
--- a/test/stage2/compile_errors.zig
+++ b/test/stage2/compile_errors.zig
@@ -43,13 +43,37 @@ pub fn addCases(ctx: *TestContext) !void {
\\@1 = export(@0, "start")
, &[_][]const u8{":4:9: error: unable to call function with naked calling convention"});
+ {
+ var case = ctx.objZIR("exported symbol collision", linux_x64);
+ // First, ensure we receive the error correctly
+ case.addError(
+ \\@noreturn = primitive(noreturn)
+ \\
+ \\@start_fnty = fntype([], @noreturn)
+ \\@start = fn(@start_fnty, {})
+ \\
+ \\@0 = str("_start")
+ \\@1 = export(@0, "start")
+ \\@2 = export(@0, "start")
+ , &[_][]const u8{":8:13: error: exported symbol collision: _start"});
+ // Next, ensure everything works properly on the next compilation with the problem fixed
+ case.compiles(
+ \\@noreturn = primitive(noreturn)
+ \\
+ \\@start_fnty = fntype([], @noreturn)
+ \\@start = fn(@start_fnty, {})
+ \\
+ \\@0 = str("_start")
+ \\@1 = export(@0, "start")
+ );
+ }
// TODO: re-enable these tests.
// https://github.com/ziglang/zig/issues/1364
- // ctx.addError("Export same symbol twice", linux_x64, .Zig,
- // \\export fn entry() void {}
- // \\export fn entry() void {}
- // , &[_][]const u8{":2:1: error: exported symbol collision"});
+ // ctx.compileError("Export same symbol twice", linux_x64,
+ // \\export fn entry() void {}
+ // \\export fn entry() void {}
+ // , &[_][]const u8{":2:1: error: exported symbol collision"});
// ctx.addError("Missing function name", linux_x64, .Zig,
// \\fn() void {}