| author | |
| committer | |
| log | 22432b15e31d506d070171b2932d5df71e9a1b9e |
| tree | 9562bb32559ea9554c3866e4a26e2475b71058df |
| parent | 215797749d0e0d911feaaf45dc70836c3d12f18e |
| signature | Commit is signed but in an unrecognized format. |
3 files changed, 14 insertions(+), 5 deletions(-)
lib/std/fmt.zig+2-4| ... | ... | @@ -414,10 +414,9 @@ pub fn formatType( |
| 414 | 414 | if (max_depth == 0) { |
| 415 | 415 | return output(context, "{ ... }"); |
| 416 | 416 | } |
| 417 | comptime var field_i = 0; | |
| 418 | 417 | try output(context, "{"); |
| 419 | inline for (StructT.fields) |f| { | |
| 420 | if (field_i == 0) { | |
| 418 | inline for (StructT.fields) |f, i| { | |
| 419 | if (i == 0) { | |
| 421 | 420 | try output(context, " ."); |
| 422 | 421 | } else { |
| 423 | 422 | try output(context, ", ."); |
| ... | ... | @@ -425,7 +424,6 @@ pub fn formatType( |
| 425 | 424 | try output(context, f.name); |
| 426 | 425 | try output(context, " = "); |
| 427 | 426 | try formatType(@field(value, f.name), fmt, options, context, Errors, output, max_depth - 1); |
| 428 | field_i += 1; | |
| 429 | 427 | } |
| 430 | 428 | try output(context, " }"); |
| 431 | 429 | }, |
src-self-hosted/ir.zig+1-1| ... | ... | @@ -1803,7 +1803,7 @@ pub const Builder = struct { |
| 1803 | 1803 | |
| 1804 | 1804 | // Look at the params and ref() other instructions |
| 1805 | 1805 | inline for (@typeInfo(I.Params).Struct.fields) |f| { |
| 1806 | switch (f.fiedl_type) { | |
| 1806 | switch (f.field_type) { | |
| 1807 | 1807 | *Inst => @field(inst.params, f.name).ref(self), |
| 1808 | 1808 | *BasicBlock => @field(inst.params, f.name).ref(self), |
| 1809 | 1809 | ?*Inst => if (@field(inst.params, f.name)) |other| other.ref(self), |
test/stage1/behavior/cast.zig+11| ... | ... | @@ -491,6 +491,17 @@ test "@intToEnum passed a comptime_int to an enum with one item" { |
| 491 | 491 | expect(x == E.A); |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | test "@intToEnum runtime to an extern enum with duplicate values" { | |
| 495 | const E = extern enum(u8) { | |
| 496 | A = 1, | |
| 497 | B = 1, | |
| 498 | }; | |
| 499 | var a: u8 = 1; | |
| 500 | var x = @intToEnum(E, a); | |
| 501 | expect(x == E.A); | |
| 502 | expect(x == E.B); | |
| 503 | } | |
| 504 | ||
| 494 | 505 | test "@intCast to u0 and use the result" { |
| 495 | 506 | const S = struct { |
| 496 | 507 | fn doTheTest(zero: u1, one: u1, bigzero: i32) void { |