mirror of
https://github.com/ziglang/zig.git
synced 2026-01-12 10:25:13 +00:00
This re-factor is intended to make it easier to track what kind of operator/expression consumes a result location, without overloading the ResultLoc union for this purpose. This is used in the following commit to keep track of initializer expressions of `const` variables to avoid popping error traces pre-maturely. Hopefully this will also be useful for implementing RLS temporaries in the future.
22 lines
546 B
Zig
22 lines
546 B
Zig
const std = @import("std");
|
|
const builtin = @import("builtin");
|
|
|
|
test "issue12891" {
|
|
const f = 10.0;
|
|
var i: usize = 0;
|
|
try std.testing.expect(i < f);
|
|
}
|
|
test "nan" {
|
|
if (builtin.zig_backend == .stage1) return error.SkipZigTest; // TODO
|
|
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
|
|
|
const f = comptime std.math.nan(f64);
|
|
var i: usize = 0;
|
|
try std.testing.expect(!(f < i));
|
|
}
|
|
test "inf" {
|
|
const f = comptime std.math.inf(f64);
|
|
var i: usize = 0;
|
|
try std.testing.expect(f > i);
|
|
}
|