Allow floats values to use integer constants

dev
Louis Pearson 2022-08-03 16:22:40 -06:00
parent 9b92fcea44
commit 511e3d5d88
1 changed files with 2 additions and 0 deletions

View File

@ -669,6 +669,8 @@ fn float(value_opt: ?std.json.Value) ?f64 {
const value = value_opt orelse return null; const value = value_opt orelse return null;
return switch (value) { return switch (value) {
.Float => |float| float, .Float => |float| float,
// Integers are valid floats
.Integer => |int| @intToFloat(f64, int),
else => null, else => null,
}; };
} }