| 1 | #exe { |
| 2 | -Mroot=main.zig |
| 3 | #} |
| 4 | |
| 5 | #write main.zig { |
| 6 | const T = @import("foo.zig").T; |
| 7 | pub fn main() void { |
| 8 | @compileLog(T); |
| 9 | @compileLog(@tagName(@typeInfo(T))); |
| 10 | } |
| 11 | #} |
| 12 | #write foo.zig { |
| 13 | pub const T = struct { x: u8 }; |
| 14 | #} |
| 15 | #update "T is struct" |
| 16 | #check errors { |
| 17 | main.zig:3:5: error: found compile log statement |
| 18 | |
| 19 | Compile Log Output: |
| 20 | @as(type, foo.T) |
| 21 | @as(*const [6:0]u8, "struct") |
| 22 | #} |
| 23 | |
| 24 | #write foo.zig { |
| 25 | pub const T = union {}; |
| 26 | #} |
| 27 | #update "T is union" |
| 28 | #check errors { |
| 29 | main.zig:3:5: error: found compile log statement |
| 30 | |
| 31 | Compile Log Output: |
| 32 | @as(type, foo.T) |
| 33 | @as(*const [5:0]u8, "union") |
| 34 | #} |
| 35 | |
| 36 | #write foo.zig { |
| 37 | pub const T = enum {}; |
| 38 | #} |
| 39 | #update "T is enum" |
| 40 | #check errors { |
| 41 | main.zig:3:5: error: found compile log statement |
| 42 | |
| 43 | Compile Log Output: |
| 44 | @as(type, foo.T) |
| 45 | @as(*const [4:0]u8, "enum") |
| 46 | #} |
| 47 | |
| 48 | #write foo.zig { |
| 49 | pub const T = opaque {}; |
| 50 | #} |
| 51 | #update "T is opaque" |
| 52 | #check errors { |
| 53 | main.zig:3:5: error: found compile log statement |
| 54 | |
| 55 | Compile Log Output: |
| 56 | @as(type, foo.T) |
| 57 | @as(*const [6:0]u8, "opaque") |
| 58 | #} |
| 59 | |
| 60 | #write foo.zig { |
| 61 | pub const T = packed struct {}; |
| 62 | #} |
| 63 | #update "T is packed struct" |
| 64 | #check errors { |
| 65 | main.zig:3:5: error: found compile log statement |
| 66 | |
| 67 | Compile Log Output: |
| 68 | @as(type, foo.T) |
| 69 | @as(*const [6:0]u8, "struct") |
| 70 | #} |
| 71 | |
| 72 | #write foo.zig { |
| 73 | pub const T = packed union { x: void }; // packed unions need at least 1 field |
| 74 | #} |
| 75 | #update "T is packed union" |
| 76 | #check errors { |
| 77 | main.zig:3:5: error: found compile log statement |
| 78 | |
| 79 | Compile Log Output: |
| 80 | @as(type, foo.T) |
| 81 | @as(*const [5:0]u8, "union") |
| 82 | #} |
| 83 | |
| 84 | #write foo.zig { |
| 85 | pub const T = extern struct {}; |
| 86 | #} |
| 87 | #update "T is extern struct" |
| 88 | #check errors { |
| 89 | main.zig:3:5: error: found compile log statement |
| 90 | |
| 91 | Compile Log Output: |
| 92 | @as(type, foo.T) |
| 93 | @as(*const [6:0]u8, "struct") |
| 94 | #} |
| 95 | |
| 96 | #write foo.zig { |
| 97 | pub const T = extern union { x: void }; // extern unions need at least 1 field |
| 98 | #} |
| 99 | #update "T is extern union" |
| 100 | #check errors { |
| 101 | main.zig:3:5: error: found compile log statement |
| 102 | |
| 103 | Compile Log Output: |
| 104 | @as(type, foo.T) |
| 105 | @as(*const [5:0]u8, "union") |
| 106 | #} |