Commit a2acc27872

Andrew Kelley <andrew@ziglang.org>
2019-11-08 00:13:17
behavior tests passing
1 parent 8954a1b
Changed files (2)
src
test
src/ir.cpp
@@ -17542,6 +17542,10 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh
     if (peer_parent != nullptr && ir_result_has_type(peer_parent->parent)) {
         if (peer_parent->parent->id == ResultLocIdReturn) {
             resolved_type = ira->explicit_return_type;
+        } else if (peer_parent->parent->id == ResultLocIdCast) {
+            resolved_type = ir_resolve_type(ira, peer_parent->parent->source_instruction->child);
+            if (type_is_invalid(resolved_type))
+                return ira->codegen->invalid_instruction;
         } else {
             ZigType *resolved_loc_ptr_type = peer_parent->parent->resolved_loc->value.type;
             ir_assert(resolved_loc_ptr_type->id == ZigTypeIdPointer, &phi_instruction->base);
test/stage1/behavior.zig
@@ -59,7 +59,7 @@ comptime {
     _ = @import("behavior/eval.zig");
     _ = @import("behavior/field_parent_ptr.zig");
     _ = @import("behavior/floatop.zig");
-    //_ = @import("behavior/fn.zig");
+    _ = @import("behavior/fn.zig");
     _ = @import("behavior/fn_in_struct_in_comptime.zig");
     _ = @import("behavior/fn_delegation.zig");
     _ = @import("behavior/for.zig");