Sat shl neg rhs (#9949)
* saturating shl - check for negative rhs at comptime - adds expected compile_errors case for negative rhs * add expected compile error for sat shl assign
This commit is contained in:
@@ -8869,6 +8869,25 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
"error: invalid operands to binary expression: 'f32' and 'f32'",
|
||||
});
|
||||
|
||||
ctx.objErrStage1("saturating shl does not allow negative rhs at comptime",
|
||||
\\pub fn main() !void {
|
||||
\\ _ = @as(i32, 1) <<| @as(i32, -2);
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"error: shift by negative value -2",
|
||||
});
|
||||
|
||||
ctx.objErrStage1("saturating shl assign does not allow negative rhs at comptime",
|
||||
\\pub fn main() !void {
|
||||
\\ comptime {
|
||||
\\ var x = @as(i32, 1);
|
||||
\\ x <<|= @as(i32, -2);
|
||||
\\ }
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"error: shift by negative value -2",
|
||||
});
|
||||
|
||||
ctx.objErrStage1("undeclared identifier in unanalyzed branch",
|
||||
\\export fn a() void {
|
||||
\\ if (false) {
|
||||
|
||||
Reference in New Issue
Block a user