diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-10-30 17:28:03 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-10-30 17:28:03 -0400 |
| commit | 7405bc761804fa351f9633dc7992ed198742e332 (patch) | |
| tree | 74fec2614188ac2e7225796daa3d1703476f4296 /src | |
| parent | ca71373da1140149500b529d57b9196711929063 (diff) | |
| download | zig-7405bc761804fa351f9633dc7992ed198742e332.tar.gz zig-7405bc761804fa351f9633dc7992ed198742e332.zip | |
remove implicit cast from number literal to enum
I missed this code when removing explicit cast syntax.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 5f26791584..82350d0c54 100644 --- 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) || |
