| author | |
| committer | |
| log | 5626bb45d24cd4a57a4f6a1c0f41ec0feb276f7b |
| tree | ea4653e4d5d85451891f1c03fe6c4a00d22d4b2c |
| parent | 58943fc6276c49b138c98bda5abac8be2806f94f |
2 files changed, 5 insertions(+), 3 deletions(-)
src/Sema.zig+2-2| ... | @@ -7236,8 +7236,8 @@ fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -7236,8 +7236,8 @@ fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 7236 | ), | 7236 | ), |
| 7237 | } | 7237 | } |
| 7238 | 7238 | ||
| 7239 | if (try sema.isComptimeKnown(block, operand_src, operand)) { | 7239 | if (try sema.resolveMaybeUndefVal(block, operand_src, operand)) |operand_val| { |
| 7240 | return sema.coerce(block, dest_ty, operand, operand_src); | 7240 | return sema.addConstant(dest_ty, try operand_val.floatCast(sema.arena, dest_ty, target)); |
| 7241 | } | 7241 | } |
| 7242 | if (dest_is_comptime_float) { | 7242 | if (dest_is_comptime_float) { |
| 7243 | return sema.fail(block, src, "unable to cast runtime value to 'comptime_float'", .{}); | 7243 | return sema.fail(block, src, "unable to cast runtime value to 'comptime_float'", .{}); |
test/behavior/cast.zig+3-1| ... | @@ -630,7 +630,9 @@ test "vector casts" { | ... | @@ -630,7 +630,9 @@ test "vector casts" { |
| 630 | } | 630 | } |
| 631 | 631 | ||
| 632 | test "@floatCast cast down" { | 632 | test "@floatCast cast down" { |
| 633 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | 633 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 634 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 635 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 634 | 636 | ||
| 635 | { | 637 | { |
| 636 | var double: f64 = 0.001534; | 638 | var double: f64 = 0.001534; |