From 02619edf413cd3b8b01a6a3514ecd257d7c08b6e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 9 Jul 2020 23:24:21 -0700 Subject: [PATCH] Revert "use correct cast function when doing `@floatCast` at comptime" This reverts commit 2e1bdd0d14f490a80bbed3ee0e0479a908715d33. Test failures --- src/ir.cpp | 2 +- test/stage1/behavior/cast.zig | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/ir.cpp b/src/ir.cpp index 81b7f14f84..a45455ad39 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -26718,7 +26718,7 @@ static IrInstGen *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstSrcFlo } if (instr_is_comptime(target) || dest_type->id == ZigTypeIdComptimeFloat) { - return ir_analyze_widen_or_shorten(ira, &instruction->target->base, target, dest_type); + return ir_implicit_cast2(ira, &instruction->target->base, target, dest_type); } if (target->value->type->id != ZigTypeIdFloat) { diff --git a/test/stage1/behavior/cast.zig b/test/stage1/behavior/cast.zig index 4325b0b9e4..77cdacc307 100644 --- a/test/stage1/behavior/cast.zig +++ b/test/stage1/behavior/cast.zig @@ -384,19 +384,6 @@ test "@intCast i32 to u7" { expect(z == 0xff); } -test "@floatCast cast down" { - { - var double: f64 = 0.001534; - var single = @floatCast(f32, double); - expect(@TypeOf(single) == f32); - } - { - const double: f64 = 0.001534; - const single = @floatCast(f32, double); - expect(@TypeOf(single) == f32); - } -} - test "implicit cast undefined to optional" { expect(MakeType(void).getNull() == null); expect(MakeType(void).getNonNull() != null);