authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-11-28 18:29:32+00:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-11-29 15:26:58-05:00
logc3821fe4ca8d98d07454fddf2bf25bfc8d7817f2
treebfeee503f4ffb237833d19bf75b64f39f1e831b7
parent88d57917b7df1f0c59d27a923bd564f5d21f7846

compiler: use `@Type` instead of `@TypeOf` to print enum literal type


4 files changed, 4 insertions(+), 4 deletions(-)

src/Type.zig+1-1
...@@ -314,7 +314,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error...@@ -314,7 +314,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error
314 .undefined,314 .undefined,
315 => try writer.print("@TypeOf({s})", .{@tagName(s)}),315 => try writer.print("@TypeOf({s})", .{@tagName(s)}),
316316
317 .enum_literal => try writer.print("@TypeOf(.{s})", .{@tagName(s)}),317 .enum_literal => try writer.writeAll("@Type(.enum_literal)"),
318318
319 .generic_poison => unreachable,319 .generic_poison => unreachable,
320 },320 },
test/cases/compile_errors/attempt_to_cast_enum_literal_to_error.zig+1-1
...@@ -8,4 +8,4 @@ export fn entry() void {...@@ -8,4 +8,4 @@ export fn entry() void {
8// backend=stage28// backend=stage2
9// target=native9// target=native
10//10//
11// :3:10: error: expected type 'error{Hi}', found '@TypeOf(.enum_literal)'11// :3:10: error: expected type 'error{Hi}', found '@Type(.enum_literal)'
test/cases/compile_errors/error_set_decl_literal.zig+1-1
...@@ -6,4 +6,4 @@ export fn entry() void {...@@ -6,4 +6,4 @@ export fn entry() void {
66
7// error7// error
8//8//
9// :3:19: error: expected type 'error{Foo}', found '@TypeOf(.enum_literal)'9// :3:19: error: expected type 'error{Foo}', found '@Type(.enum_literal)'
test/cases/compile_errors/runtime_condition_comptime_type_in_destructure.zig+1-1
...@@ -7,4 +7,4 @@ export fn foobar() void {...@@ -7,4 +7,4 @@ export fn foobar() void {
77
8// error8// error
9//9//
10// :4:5: error: value with comptime-only type '@TypeOf(.enum_literal)' depends on runtime control flow10// :4:5: error: value with comptime-only type '@Type(.enum_literal)' depends on runtime control flow