authorgravatar for tgschultz@gmail.comtgschultz <tgschultz@gmail.com> 2018-08-25 10:51:49-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2018-08-25 10:51:49-05:00
log61c0c6d502b19a6aa232d91a201eba9d67aced5a
tree2d5535b402165f0d664c0765ef1a5105fe45a11a
parent4003cd4747019d79ff50aaa22415d2d3dfc15cf4
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Fixed compile error when passing enum to fmt

Caused by struct printing behavior. Enums are different enough from structs and unions that the field iteration behavior doesn't do what we want even if @memberName didn't error on enums.

1 files changed, 5 insertions(+), 0 deletions(-)

std/fmt/index.zig+5
......@@ -166,6 +166,11 @@ pub fn formatType(
166166
167167 if (has_cust_fmt) return value.format(fmt, context, Errors, output);
168168 try output(context, @typeName(T));
169 if (comptime @typeId(T) == builtin.TypeId.Enum) {
170 try output(context, ".");
171 try formatType(@tagName(value), "", context, Errors, output);
172 return;
173 }
169174 comptime var field_i = 0;
170175 inline while (field_i < @memberCount(T)) : (field_i += 1) {
171176 if (field_i == 0) {