mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-10-28 19:00:52 +08:00
115 lines
1.9 KiB
Plaintext
115 lines
1.9 KiB
Plaintext
#exe {
|
|
-Mroot=main.zig
|
|
#}
|
|
|
|
#write main.zig {
|
|
const T = @import("foo.zig").T;
|
|
pub fn main() void {
|
|
@compileLog(T);
|
|
@compileLog(@tagName(@typeInfo(T)));
|
|
}
|
|
#}
|
|
#write foo.zig {
|
|
pub const T = struct { x: u8 };
|
|
#}
|
|
#update {
|
|
T is struct#}
|
|
#check errors {
|
|
main.zig:3:5: error: found compile log statement
|
|
|
|
Compile Log Output:
|
|
@as(type, foo.T)
|
|
@as(*const [6:0]u8, "struct")
|
|
#}
|
|
|
|
#write foo.zig {
|
|
pub const T = union {};
|
|
#}
|
|
#update {
|
|
T is union#}
|
|
#check errors {
|
|
main.zig:3:5: error: found compile log statement
|
|
|
|
Compile Log Output:
|
|
@as(type, foo.T)
|
|
@as(*const [5:0]u8, "union")
|
|
#}
|
|
|
|
#write foo.zig {
|
|
pub const T = enum {};
|
|
#}
|
|
#update {
|
|
T is enum#}
|
|
#check errors {
|
|
main.zig:3:5: error: found compile log statement
|
|
|
|
Compile Log Output:
|
|
@as(type, foo.T)
|
|
@as(*const [4:0]u8, "enum")
|
|
#}
|
|
|
|
#write foo.zig {
|
|
pub const T = opaque {};
|
|
#}
|
|
#update {
|
|
T is opaque#}
|
|
#check errors {
|
|
main.zig:3:5: error: found compile log statement
|
|
|
|
Compile Log Output:
|
|
@as(type, foo.T)
|
|
@as(*const [6:0]u8, "opaque")
|
|
#}
|
|
|
|
#write foo.zig {
|
|
pub const T = packed struct {};
|
|
#}
|
|
#update {
|
|
T is packed struct#}
|
|
#check errors {
|
|
main.zig:3:5: error: found compile log statement
|
|
|
|
Compile Log Output:
|
|
@as(type, foo.T)
|
|
@as(*const [6:0]u8, "struct")
|
|
#}
|
|
|
|
#write foo.zig {
|
|
pub const T = packed union { x: void }; // packed unions need at least 1 field
|
|
#}
|
|
#update {
|
|
T is packed union#}
|
|
#check errors {
|
|
main.zig:3:5: error: found compile log statement
|
|
|
|
Compile Log Output:
|
|
@as(type, foo.T)
|
|
@as(*const [5:0]u8, "union")
|
|
#}
|
|
|
|
#write foo.zig {
|
|
pub const T = extern struct {};
|
|
#}
|
|
#update {
|
|
T is extern struct#}
|
|
#check errors {
|
|
main.zig:3:5: error: found compile log statement
|
|
|
|
Compile Log Output:
|
|
@as(type, foo.T)
|
|
@as(*const [6:0]u8, "struct")
|
|
#}
|
|
|
|
#write foo.zig {
|
|
pub const T = extern union { x: void }; // extern unions need at least 1 field
|
|
#}
|
|
#update {
|
|
T is extern union#}
|
|
#check errors {
|
|
main.zig:3:5: error: found compile log statement
|
|
|
|
Compile Log Output:
|
|
@as(type, foo.T)
|
|
@as(*const [5:0]u8, "union")
|
|
#}
|