stage2: Handle lazy values for the % operator

This commit is contained in:
Isaac Freund
2022-08-10 13:21:47 +02:00
parent 49a270b203
commit bb1c3e8b7e
3 changed files with 72 additions and 40 deletions

View File

@@ -1721,3 +1721,18 @@ fn testAbsFloat() !void {
fn testAbsFloatOne(in: f32, out: f32) !void {
try expect(@fabs(@as(f32, in)) == @as(f32, out));
}
test "mod lazy values" {
{
const X = struct { x: u32 };
const x = @sizeOf(X);
const y = 1 % x;
_ = y;
}
{
const X = struct { x: u32 };
const x = @sizeOf(X);
const y = x % 1;
_ = y;
}
}