stage1: fix regression of shift by negative value error

The previous commit (38b2d62092) regressed
the compile error test case for when doing saturating shift left of a
comptime-known negative RHS.

This commit additionally fixes the error for regular shifts in addition
to saturating shifts.
This commit is contained in:
Andrew Kelley
2021-12-08 19:09:37 -07:00
parent 38b2d62092
commit 8031783539
2 changed files with 27 additions and 11 deletions

View File

@@ -8913,7 +8913,7 @@ pub fn addCases(ctx: *TestContext) !void {
});
ctx.objErrStage1("saturating arithmetic does not allow floats",
\\pub fn main() !void {
\\export fn a() void {
\\ _ = @as(f32, 1.0) +| @as(f32, 1.0);
\\}
, &[_][]const u8{
@@ -8921,7 +8921,7 @@ pub fn addCases(ctx: *TestContext) !void {
});
ctx.objErrStage1("saturating shl does not allow negative rhs at comptime",
\\pub fn main() !void {
\\export fn a() void {
\\ _ = @as(i32, 1) <<| @as(i32, -2);
\\}
, &[_][]const u8{
@@ -8929,7 +8929,7 @@ pub fn addCases(ctx: *TestContext) !void {
});
ctx.objErrStage1("saturating shl assign does not allow negative rhs at comptime",
\\pub fn main() !void {
\\export fn a() void {
\\ comptime {
\\ var x = @as(i32, 1);
\\ x <<|= @as(i32, -2);