mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
compiler: use @Type instead of @TypeOf to print enum literal type
This commit is contained in:
parent
88d57917b7
commit
c3821fe4ca
@ -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,
|
||||
},
|
||||
|
||||
@ -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)'
|
||||
|
||||
@ -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)'
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user