mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
1c35962428
This used to trigger bugs, but works correctly as of Zig 0.16.0. Resolves: https://github.com/ziglang/zig/issues/24217
62 lines
1.9 KiB
Plaintext
62 lines
1.9 KiB
Plaintext
#update=initial version, T is struct
|
|
#file=main.zig
|
|
const T = @import("foo.zig").T;
|
|
pub fn main() void {
|
|
@compileLog(T);
|
|
@compileLog(@tagName(@typeInfo(T)));
|
|
}
|
|
#file=foo.zig
|
|
pub const T = struct { x: u8 };
|
|
#expect_error=main.zig:3:5: error: found compile log statement
|
|
#expect_compile_log=@as(type, foo.T)
|
|
#expect_compile_log=@as(*const [6:0]u8, "struct")
|
|
|
|
#update=T is union
|
|
#file=foo.zig
|
|
pub const T = union {};
|
|
#expect_error=main.zig:3:5: error: found compile log statement
|
|
#expect_compile_log=@as(type, foo.T)
|
|
#expect_compile_log=@as(*const [5:0]u8, "union")
|
|
|
|
#update=T is enum
|
|
#file=foo.zig
|
|
pub const T = enum {};
|
|
#expect_error=main.zig:3:5: error: found compile log statement
|
|
#expect_compile_log=@as(type, foo.T)
|
|
#expect_compile_log=@as(*const [4:0]u8, "enum")
|
|
|
|
#update=T is opaque
|
|
#file=foo.zig
|
|
pub const T = opaque {};
|
|
#expect_error=main.zig:3:5: error: found compile log statement
|
|
#expect_compile_log=@as(type, foo.T)
|
|
#expect_compile_log=@as(*const [6:0]u8, "opaque")
|
|
|
|
#update=T is packed struct
|
|
#file=foo.zig
|
|
pub const T = packed struct {};
|
|
#expect_error=main.zig:3:5: error: found compile log statement
|
|
#expect_compile_log=@as(type, foo.T)
|
|
#expect_compile_log=@as(*const [6:0]u8, "struct")
|
|
|
|
#update=T is packed union
|
|
#file=foo.zig
|
|
pub const T = packed union { x: void }; // packed unions need at least 1 field
|
|
#expect_error=main.zig:3:5: error: found compile log statement
|
|
#expect_compile_log=@as(type, foo.T)
|
|
#expect_compile_log=@as(*const [5:0]u8, "union")
|
|
|
|
#update=T is extern struct
|
|
#file=foo.zig
|
|
pub const T = extern struct {};
|
|
#expect_error=main.zig:3:5: error: found compile log statement
|
|
#expect_compile_log=@as(type, foo.T)
|
|
#expect_compile_log=@as(*const [6:0]u8, "struct")
|
|
|
|
#update=T is extern union
|
|
#file=foo.zig
|
|
pub const T = extern union { x: void }; // extern unions need at least 1 field
|
|
#expect_error=main.zig:3:5: error: found compile log statement
|
|
#expect_compile_log=@as(type, foo.T)
|
|
#expect_compile_log=@as(*const [5:0]u8, "union")
|