zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 7405bc761804fa351f9633dc7992ed198742e332 (tree)
parent ca71373da1140149500b529d57b9196711929063
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Tue, 30 Oct 2018 17:28:03 -0400

remove implicit cast from number literal to enum

I missed this code when removing explicit cast syntax.

Diffstat:
Msrc/ir.cpp | 14+-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/ir.cpp b/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) ||