behavior: if-@as-if chain

Closes #8952
This commit is contained in:
r00ster91 2023-05-28 03:15:49 +02:00
parent c647799e5e
commit 2cc9c99ebf

View File

@ -151,3 +151,15 @@ test "result location with inferred type ends up being pointer to comptime_int"
} else @as(u32, 0);
try expect(c == 1);
}
test "if-@as-if chain" {
var fast = true;
var very_fast = false;
const num_frames = if (fast)
@as(u32, if (very_fast) 16 else 4)
else
1;
try expect(num_frames == 4);
}