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

This commit is contained in:
mlugg 2024-11-28 18:29:32 +00:00 committed by Andrew Kelley
parent 88d57917b7
commit c3821fe4ca
4 changed files with 4 additions and 4 deletions

View File

@ -314,7 +314,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error
.undefined,
=> try writer.print("@TypeOf({s})", .{@tagName(s)}),
.enum_literal => try writer.print("@TypeOf(.{s})", .{@tagName(s)}),
.enum_literal => try writer.writeAll("@Type(.enum_literal)"),
.generic_poison => unreachable,
},

View File

@ -8,4 +8,4 @@ export fn entry() void {
// backend=stage2
// target=native
//
// :3:10: error: expected type 'error{Hi}', found '@TypeOf(.enum_literal)'
// :3:10: error: expected type 'error{Hi}', found '@Type(.enum_literal)'

View File

@ -6,4 +6,4 @@ export fn entry() void {
// error
//
// :3:19: error: expected type 'error{Foo}', found '@TypeOf(.enum_literal)'
// :3:19: error: expected type 'error{Foo}', found '@Type(.enum_literal)'

View File

@ -7,4 +7,4 @@ export fn foobar() void {
// error
//
// :4:5: error: value with comptime-only type '@TypeOf(.enum_literal)' depends on runtime control flow
// :4:5: error: value with comptime-only type '@Type(.enum_literal)' depends on runtime control flow