diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-06-24 16:58:19 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-24 16:58:19 -0700 |
| commit | 146b79af153bbd5dafda0ba12a040385c7fc58f8 (patch) | |
| tree | 67e3db8b444d65c667e314770fc983a7fc8ba293 /test/behavior/bool.zig | |
| parent | 13853bef0df3c90633021850cc6d6abaeea03282 (diff) | |
| parent | 21ac0beb436f49fe49c6982a872f2dc48e4bea5e (diff) | |
| download | zig-146b79af153bbd5dafda0ba12a040385c7fc58f8.tar.gz zig-146b79af153bbd5dafda0ba12a040385c7fc58f8.zip | |
Merge pull request #16163 from mlugg/feat/builtins-infer-dest-ty
Infer destination type of cast builtins using result type
Diffstat (limited to 'test/behavior/bool.zig')
| -rw-r--r-- | test/behavior/bool.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/behavior/bool.zig b/test/behavior/bool.zig index 50a098c111..5d09e5f8a0 100644 --- a/test/behavior/bool.zig +++ b/test/behavior/bool.zig @@ -15,8 +15,8 @@ test "cast bool to int" { const f = false; try expectEqual(@as(u32, 1), @intFromBool(t)); try expectEqual(@as(u32, 0), @intFromBool(f)); - try expectEqual(-1, @bitCast(i1, @intFromBool(t))); - try expectEqual(0, @bitCast(i1, @intFromBool(f))); + try expectEqual(-1, @as(i1, @bitCast(@intFromBool(t)))); + try expectEqual(0, @as(i1, @bitCast(@intFromBool(f)))); try expectEqual(u1, @TypeOf(@intFromBool(t))); try expectEqual(u1, @TypeOf(@intFromBool(f))); try nonConstCastIntFromBool(t, f); @@ -25,8 +25,8 @@ test "cast bool to int" { fn nonConstCastIntFromBool(t: bool, f: bool) !void { try expectEqual(@as(u32, 1), @intFromBool(t)); try expectEqual(@as(u32, 0), @intFromBool(f)); - try expectEqual(@as(i1, -1), @bitCast(i1, @intFromBool(t))); - try expectEqual(@as(i1, 0), @bitCast(i1, @intFromBool(f))); + try expectEqual(@as(i1, -1), @as(i1, @bitCast(@intFromBool(t)))); + try expectEqual(@as(i1, 0), @as(i1, @bitCast(@intFromBool(f)))); try expectEqual(u1, @TypeOf(@intFromBool(t))); try expectEqual(u1, @TypeOf(@intFromBool(f))); } |
