Commit 7405bc7618

Andrew Kelley <superjoe30@gmail.com>
2018-10-30 22:28:03
remove implicit cast from number literal to enum
I missed this code when removing explicit cast syntax.
1 parent ca71373
Changed files (1)
src
src/ir.cpp
@@ -10624,19 +10624,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
     if (actual_type->id == ZigTypeIdComptimeFloat ||
         actual_type->id == ZigTypeIdComptimeInt)
     {
-        if ((err = ensure_complete_type(ira->codegen, wanted_type)))
-            return ira->codegen->invalid_instruction;
-        if (wanted_type->id == ZigTypeIdEnum) {
-            IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.enumeration.tag_int_type, value);
-            if (type_is_invalid(cast1->value.type))
-                return ira->codegen->invalid_instruction;
-
-            IrInstruction *cast2 = ir_analyze_cast(ira, source_instr, wanted_type, cast1);
-            if (type_is_invalid(cast2->value.type))
-                return ira->codegen->invalid_instruction;
-
-            return cast2;
-        } else if (ir_num_lit_fits_in_other_type(ira, value, wanted_type, true)) {
+        if (ir_num_lit_fits_in_other_type(ira, value, wanted_type, true)) {
             CastOp op;
             if ((actual_type->id == ZigTypeIdComptimeFloat &&
                  wanted_type->id == ZigTypeIdFloat) ||