diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-07-29 10:30:10 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-30 00:17:49 +0300 |
| commit | f43ea43ac920d3fbd629175e4e7fbe4309c6eab5 (patch) | |
| tree | d0edfe385cedffe26a15c325421c5029a1081977 /src/value.zig | |
| parent | 4fc2acdaa4f2b649b17ddf958d2608abc4787a4e (diff) | |
| download | zig-f43ea43ac920d3fbd629175e4e7fbe4309c6eab5.tar.gz zig-f43ea43ac920d3fbd629175e4e7fbe4309c6eab5.zip | |
stage2: fix hashing of struct values
Closes #12279
Diffstat (limited to 'src/value.zig')
| -rw-r--r-- | src/value.zig | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/value.zig b/src/value.zig index 46624a822d..0d0be76542 100644 --- a/src/value.zig +++ b/src/value.zig @@ -2292,25 +2292,13 @@ pub const Value = extern union { } }, .Struct => { - if (ty.isTupleOrAnonStruct()) { - const fields = ty.tupleFields(); - for (fields.values) |field_val, i| { - field_val.hash(fields.types[i], hasher, mod); - } - return; - } - const fields = ty.structFields().values(); - if (fields.len == 0) return; switch (val.tag()) { - .empty_struct_value => { - for (fields) |field| { - field.default_val.hash(field.ty, hasher, mod); - } - }, + .empty_struct_value => {}, .aggregate => { const field_values = val.castTag(.aggregate).?.data; for (field_values) |field_val, i| { - field_val.hash(fields[i].ty, hasher, mod); + const field_ty = ty.structFieldType(i); + field_val.hash(field_ty, hasher, mod); } }, else => unreachable, |
