diff --git a/test/incremental/assert_function.0.zig b/test/incremental/assert_function.0.zig deleted file mode 100644 index 889c9b15723392dc284e886b58bcaa72c1e06309..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.0.zig +++ /dev/null @@ -1,15 +0,0 @@ -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,x86_64-macos -// diff --git a/test/incremental/assert_function.1.zig b/test/incremental/assert_function.1.zig deleted file mode 100644 index ac2df25d8556c661b48a9382d200283073d5d00b..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.1.zig +++ /dev/null @@ -1,17 +0,0 @@ -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/assert_function.10.zig b/test/incremental/assert_function.10.zig deleted file mode 100644 index b3f1610cd62b71553f20959ef9cf4cec51d8f498..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.10.zig +++ /dev/null @@ -1,27 +0,0 @@ -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/assert_function.11.zig b/test/incremental/assert_function.11.zig deleted file mode 100644 index d64130a6775b250ca18a5900e912391dc732a7f7..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.11.zig +++ /dev/null @@ -1,66 +0,0 @@ -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/assert_function.12.zig b/test/incremental/assert_function.12.zig deleted file mode 100644 index 4f64c1e0626879a2004d66080292dc7cf962065d..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.12.zig +++ /dev/null @@ -1,47 +0,0 @@ -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/assert_function.13.zig b/test/incremental/assert_function.13.zig deleted file mode 100644 index 240abf0108dbe8c08040533524872e543fd6d621..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.13.zig +++ /dev/null @@ -1,19 +0,0 @@ -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/assert_function.14.zig b/test/incremental/assert_function.14.zig deleted file mode 100644 index d25100dccee2bda1f615c2d870ee477c1252bed3..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.14.zig +++ /dev/null @@ -1,17 +0,0 @@ -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/assert_function.15.zig b/test/incremental/assert_function.15.zig deleted file mode 100644 index 33ae1ed5af1279b74f089003e7b9665b55c2489b..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.15.zig +++ /dev/null @@ -1,10 +0,0 @@ -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/assert_function.16.zig b/test/incremental/assert_function.16.zig deleted file mode 100644 index eef113642324434c4af1723aac512a57192ce726..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.16.zig +++ /dev/null @@ -1,11 +0,0 @@ -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/assert_function.17.zig b/test/incremental/assert_function.17.zig deleted file mode 100644 index ac9dce3079f6444476afd65757675726390946cf..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.17.zig +++ /dev/null @@ -1,11 +0,0 @@ -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/assert_function.18.zig b/test/incremental/assert_function.18.zig deleted file mode 100644 index 31cf1207f3dc07541a4210641ee136eb0ba385b0..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.18.zig +++ /dev/null @@ -1,35 +0,0 @@ -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/assert_function.2.zig b/test/incremental/assert_function.2.zig deleted file mode 100644 index 8c1c510486185f4116841577473c901e13528283..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.2.zig +++ /dev/null @@ -1,21 +0,0 @@ -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/assert_function.3.zig b/test/incremental/assert_function.3.zig deleted file mode 100644 index a6829f8e0239f8c01f0a1e4e1cf42e9ed035176b..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.3.zig +++ /dev/null @@ -1,22 +0,0 @@ -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/assert_function.4.zig b/test/incremental/assert_function.4.zig deleted file mode 100644 index 69df4354c3eb8d72d4c91b226fbf4b4c0eddedaf..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.4.zig +++ /dev/null @@ -1,15 +0,0 @@ -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/assert_function.5.zig b/test/incremental/assert_function.5.zig deleted file mode 100644 index 89f3f7df4fd3f42da6650c27dff3c8160b281860..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.5.zig +++ /dev/null @@ -1,19 +0,0 @@ -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/assert_function.6.zig b/test/incremental/assert_function.6.zig deleted file mode 100644 index 1b1b75e68ea72902208bd0889c38202922b89a51..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.6.zig +++ /dev/null @@ -1,9 +0,0 @@ -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/assert_function.7.zig b/test/incremental/assert_function.7.zig deleted file mode 100644 index f2f3ffcc3dca6e018a185bae752d009ecddd7eef..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.7.zig +++ /dev/null @@ -1,40 +0,0 @@ -const builtin = @import("builtin"); - -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 { - 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, - } -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// -// hello -// hello -// hello -// hello -// diff --git a/test/incremental/assert_function.8.zig b/test/incremental/assert_function.8.zig deleted file mode 100644 index f845de9aa0441bcaca612ba56080ed18fdf4eaac..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.8.zig +++ /dev/null @@ -1,36 +0,0 @@ -const builtin = @import("builtin"); - -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 { - 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, - } -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// error -// -// :7:21: error: unable to resolve comptime value diff --git a/test/incremental/assert_function.9.zig b/test/incremental/assert_function.9.zig deleted file mode 100644 index c754bb771133d8b3a595ec9fe46c48c4c6408e61..0000000000000000000000000000000000000000 --- a/test/incremental/assert_function.9.zig +++ /dev/null @@ -1,22 +0,0 @@ -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/comptime_var.0.zig b/test/incremental/comptime_var.0.zig deleted file mode 100644 index 019cf78abb05240d76c1566a4a228734f73db665..0000000000000000000000000000000000000000 --- a/test/incremental/comptime_var.0.zig +++ /dev/null @@ -1,12 +0,0 @@ -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,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/comptime_var.1.zig b/test/incremental/comptime_var.1.zig deleted file mode 100644 index efc51aafe3e7572bb8815d5e75ec4e4b00761499..0000000000000000000000000000000000000000 --- a/test/incremental/comptime_var.1.zig +++ /dev/null @@ -1,13 +0,0 @@ -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/comptime_var.2.zig b/test/incremental/comptime_var.2.zig deleted file mode 100644 index e91c0540efc403070b34d902f519056fb48a93c1..0000000000000000000000000000000000000000 --- a/test/incremental/comptime_var.2.zig +++ /dev/null @@ -1,34 +0,0 @@ -const builtin = @import("builtin"); - -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 { - switch (builtin.os.tag) { - .linux => { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - [arg3] "{rdx}" (len), - : "rcx", "r11", "memory" - ); - }, - .macos => { - _ = write(1, @ptrToInt("Hello, World!\n"), len); - }, - else => unreachable, - } -} - -// run -// -// HelloHello, World! -// diff --git a/test/incremental/comptime_var.3.zig b/test/incremental/comptime_var.3.zig deleted file mode 100644 index d4e6d85d9d38fa74e139ece4b911521069f80acd..0000000000000000000000000000000000000000 --- a/test/incremental/comptime_var.3.zig +++ /dev/null @@ -1,10 +0,0 @@ -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/comptime_var.4.zig b/test/incremental/comptime_var.4.zig deleted file mode 100644 index 74da6ef448edd5534b49b1f850673863b4188b99..0000000000000000000000000000000000000000 --- a/test/incremental/comptime_var.4.zig +++ /dev/null @@ -1,9 +0,0 @@ -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/comptime_var.5.zig b/test/incremental/comptime_var.5.zig deleted file mode 100644 index 76a06f3d4b5931e8fd23271dcc593e07ff414a7f..0000000000000000000000000000000000000000 --- a/test/incremental/comptime_var.5.zig +++ /dev/null @@ -1,15 +0,0 @@ -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/comptime_var.6.zig b/test/incremental/comptime_var.6.zig deleted file mode 100644 index 0eb743a05b11d0d8cb664918f551910b931681a6..0000000000000000000000000000000000000000 --- a/test/incremental/comptime_var.6.zig +++ /dev/null @@ -1,32 +0,0 @@ -const builtin = @import("builtin"); - -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 { - switch (builtin.os.tag) { - .linux => { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("Hello")), - [arg3] "{rdx}" (len), - : "rcx", "r11", "memory" - ); - }, - .macos => { - _ = write(1, @ptrToInt("Hello"), len); - }, - else => unreachable, - } -} - -// run -// -// HeHelHellHello 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 index 592c82691df3a2c3505381ac5a076fffe5a48ac0..cf43513159d1fb4ffe7e5a913833f2f343578e7e 100644 --- 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 @@ -8,5 +8,5 @@ pub fn main() void { // error // output_mode=Exe // backend=llvm -// target=x86_64-linux +// 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 index 2e342dc8529f71b9181fca61d75cb6a26a176590..5907c1dad5e961a35d9116f4c1c94a4dc0fbb4da 100644 --- a/test/incremental/llvm/address_spaces_pointer_access_chaining_array_pointer.zig +++ b/test/incremental/llvm/address_spaces_pointer_access_chaining_array_pointer.zig @@ -8,5 +8,5 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index 5e616bd1da57d6b0af75b012d41df650a558f3b4..ece0614f73040a8a73e22dd356721b815dc115db 100644 --- a/test/incremental/llvm/address_spaces_pointer_access_chaining_complex.zig +++ b/test/incremental/llvm/address_spaces_pointer_access_chaining_complex.zig @@ -9,5 +9,5 @@ pub fn main() void { // error // output_mode=Exe // backend=llvm -// target=x86_64-linux +// 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 index 519833a0e87382b8a819ae63270baee50ba97c10..9175bcbc0ea9165f083ec8973f606ef5baa57040 100644 --- a/test/incremental/llvm/address_spaces_pointer_access_chaining_struct_pointer.zig +++ b/test/incremental/llvm/address_spaces_pointer_access_chaining_struct_pointer.zig @@ -9,5 +9,5 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index af37ebf25d1a1dfb51aff8292405a11681ee32e7..c155d044976655e1becf111027c00d25edadbb90 100644 --- a/test/incremental/llvm/any_typed_null_to_any_typed_optional.zig +++ b/test/incremental/llvm/any_typed_null_to_any_typed_optional.zig @@ -6,6 +6,6 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index a2fbfeb6180226b22337bf43b6ed637ff854f3d0..c64909c7fea640a33c5fcf793f6ed82fe3189ba6 100644 --- a/test/incremental/llvm/blocks.zig +++ b/test/incremental/llvm/blocks.zig @@ -18,5 +18,5 @@ pub fn main() void { // run // backend=stage2,llvm -// target=x86_64-linux +// 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 index bc5c3d5b81f63141f022dc8f116cc47a386100f1..8f3670075717006113252c90086f21059337b61f 100644 --- a/test/incremental/llvm/dereferencing_though_multiple_pointers_with_address_spaces.zig +++ b/test/incremental/llvm/dereferencing_though_multiple_pointers_with_address_spaces.zig @@ -8,5 +8,5 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// target=x86_64-linux,x86_64-macos // diff --git a/test/incremental/llvm/for_loop.zig b/test/incremental/llvm/for_loop.zig index f58350f59c8e62667fef5f05f2b660c3e56d9bc4..e7e701aafaa88ddd9617e9b24db34fe27b71133e 100644 --- a/test/incremental/llvm/for_loop.zig +++ b/test/incremental/llvm/for_loop.zig @@ -12,5 +12,5 @@ pub fn main() void { // run // backend=stage2,llvm -// target=x86_64-linux +// target=x86_64-linux,x86_64-macos // diff --git a/test/incremental/llvm/hello_world.zig b/test/incremental/llvm/hello_world.zig index bcd9d9f795893bc24350568106288f601b2c19ec..4243191b0fb7a82da70c8f00ad28e72439b968f1 100644 --- a/test/incremental/llvm/hello_world.zig +++ b/test/incremental/llvm/hello_world.zig @@ -6,7 +6,7 @@ pub fn main() void { // run // backend=llvm -// target=x86_64-linux +// 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 index e46b327bcfc7e766a744a2465dd2df042f485b6e..6b72f1d5a8ada2bebfecc79b0b780d9af20eb3d8 100644 --- a/test/incremental/llvm/invalid_address_space_coercion.zig +++ b/test/incremental/llvm/invalid_address_space_coercion.zig @@ -8,6 +8,6 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index 18b3bebc4dfbea652d6c05015d74387406b87b76..26f68ce7895207a301eb192fc679156573e9d39d 100644 --- 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 @@ -8,6 +8,6 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index 974315df96ac6a013db07ffef7f6e2c369c2781f..47b6c5069bffb04c825bd70c695eaca0d7854269 100644 --- a/test/incremental/llvm/nested_blocks.zig +++ b/test/incremental/llvm/nested_blocks.zig @@ -20,5 +20,5 @@ pub fn main() void { // run // backend=stage2, llvm -// target=x86_64-linux +// target=x86_64-linux,x86_64-macos // diff --git a/test/incremental/llvm/optionals.zig b/test/incremental/llvm/optionals.zig index 05c221a8a80bcda225f47b1dd04ba93382d62c45..7d52fc0f17d73b201c3aad46adf461cfe0fe5de2 100644 --- a/test/incremental/llvm/optionals.zig +++ b/test/incremental/llvm/optionals.zig @@ -41,5 +41,5 @@ pub fn main() void { // run // backend=llvm -// target=x86_64-linux +// 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 index 3d3718c83e453d988f60afcca55602f76845891b..bfd40566f840e493e335031ae44b30c7059e9cf0 100644 --- a/test/incremental/llvm/pointer_keeps_address_space.zig +++ b/test/incremental/llvm/pointer_keeps_address_space.zig @@ -8,5 +8,5 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index 541522e3af1cf5f86b17f608aefdec80f5f868ed..8114e86c5da0b836592fbb851fc82d9d0c0ea56c 100644 --- 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 @@ -8,5 +8,5 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index ff8ae13dab23e8798d4be78d50c18142c5bf773c..78bc3e4bd6f42e5babba073ffa042ce04fffb071 100644 --- 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 @@ -8,5 +8,5 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index eaeb669775a5537724d6c9d93c2b2ec26abc9374..8fbd8b07cfccbcd8f8897881ca38d868c68eff4b 100644 --- a/test/incremental/llvm/pointer_with_different_address_spaces.zig +++ b/test/incremental/llvm/pointer_with_different_address_spaces.zig @@ -8,6 +8,6 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index aed6093ec72bf1b8f8b1aaf80083641d765146ce..39e5e6a6d176e58fd8237a425e06a9517edf3590 100644 --- a/test/incremental/llvm/pointers_with_different_address_spaces.zig +++ b/test/incremental/llvm/pointers_with_different_address_spaces.zig @@ -8,6 +8,6 @@ pub fn main() void { // error // output_mode=Exe // backend=stage2,llvm -// target=x86_64-linux +// 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 index 679932d3c2085ae483e2fe5af0813ebd9480cb13..9804338ea6f946fbac06a3e8737929002ab5bf0b 100644 --- a/test/incremental/llvm/rem.zig +++ b/test/incremental/llvm/rem.zig @@ -11,5 +11,5 @@ pub fn main() void { // run // backend=stage2,llvm -// target=x86_64-linux +// 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 index 91d324d0841bd3b9e5cc2deefd1f845a5afb9132..23b733c4934ba1dc65ea50ecac37ef447142104a 100644 --- a/test/incremental/llvm/shift_right_plus_left.0.zig +++ b/test/incremental/llvm/shift_right_plus_left.0.zig @@ -8,5 +8,5 @@ fn assert(a: u32, b: u32) void { // run // backend=llvm -// target=x86_64-linux +// target=x86_64-linux,x86_64-macos // diff --git a/test/incremental/llvm/simple_addition_and_subtraction.zig b/test/incremental/llvm/simple_addition_and_subtraction.zig index 59011c9d0053a9b65d19735162776857695c2fd4..8a6f419f4a5c64649aa3f7618394c0264b667304 100644 --- a/test/incremental/llvm/simple_addition_and_subtraction.zig +++ b/test/incremental/llvm/simple_addition_and_subtraction.zig @@ -16,5 +16,5 @@ fn assert(ok: bool) void { // run // backend=stage2,llvm -// target=x86_64-linux +// 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 index 436fd48e3f0a77ba84124b757498df9a6920b72e..73cf08cda2b45477f87b222dbf5b46cadd6917d9 100644 --- a/test/incremental/llvm/simple_if_statement.zig +++ b/test/incremental/llvm/simple_if_statement.zig @@ -12,5 +12,5 @@ pub fn main() void { // run // backend=stage2,llvm -// target=x86_64-linux +// target=x86_64-linux,x86_64-macos // diff --git a/test/incremental/llvm/while_loops.zig b/test/incremental/llvm/while_loops.zig index 3c092be628aa90ee7f7566590cdae6f9da2f04d7..3b9276cf7f31fd3fc22e5db640533026ce6f0834 100644 --- a/test/incremental/llvm/while_loops.zig +++ b/test/incremental/llvm/while_loops.zig @@ -14,5 +14,5 @@ pub fn main() void { // run // backend=stage2,llvm -// target=x86_64-linux +// target=x86_64-linux,x86_64-macos // 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..4ce3ec08444b95dbf8fcfc97eae92703b942374a --- /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 +// +// :5: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-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