diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2023-06-13 15:17:31 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2023-06-13 21:48:18 +0100 |
| commit | c9531eb833e1e2c432dc2bfb0ca3b25622b7001e (patch) | |
| tree | 7cdae51f8762b670aed003b3654ff429a731146d /src/Module.zig | |
| parent | 854f26ad8ac8dc39ef7ad60f86588c0c5dba131a (diff) | |
| download | zig-c9531eb833e1e2c432dc2bfb0ca3b25622b7001e.tar.gz zig-c9531eb833e1e2c432dc2bfb0ca3b25622b7001e.zip | |
Sema: rewrite peer type resolution
The existing logic for peer type resolution was quite convoluted and
buggy. This rewrite makes it much more resilient, readable, and
extensible. The algorithm works by first iterating over the types to
select a "strategy", then applying that strategy, possibly applying peer
resolution recursively.
Several new tests have been added to cover cases which the old logic did
not correctly handle.
Resolves: #15138
Resolves: #15644
Resolves: #15693
Resolves: #15709
Resolves: #15752
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Module.zig b/src/Module.zig index d60f3919a5..e8cea97b8f 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -6978,7 +6978,7 @@ pub fn intBitsForValue(mod: *Module, val: Value, sign: bool) u16 { assert(sign); // Protect against overflow in the following negation. if (x == std.math.minInt(i64)) return 64; - return Type.smallestUnsignedBits(@intCast(u64, -x - 1)) + 1; + return Type.smallestUnsignedBits(@intCast(u64, -(x + 1))) + 1; }, .u64 => |x| { return Type.smallestUnsignedBits(x) + @boolToInt(sign); |
