diff --git a/BRANCH_TODO b/BRANCH_TODO index 8feb2601d..2f253670a 100644 --- a/BRANCH_TODO +++ b/BRANCH_TODO @@ -10,5 +10,3 @@ get an empty file compiling successfully (with no panic fn override) uncomment all the behavior tests -look at all the ir_gen_node ir_gen_node_extra calls and make sure result locations are properly propagated - return ir_gen_comptime(irb, scope, node, lval); diff --git a/src/all_types.hpp b/src/all_types.hpp index 218df5b42..c74c8fd4b 100644 --- a/src/all_types.hpp +++ b/src/all_types.hpp @@ -3247,8 +3247,8 @@ struct IrInstructionTypeName { struct IrInstructionDeclRef { IrInstruction base; - Tld *tld; LVal lval; + Tld *tld; }; struct IrInstructionPanic { diff --git a/src/ir.cpp b/src/ir.cpp index 42e5b23ce..b9bd3a9d5 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -4166,8 +4166,14 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node, } Tld *tld = find_decl(irb->codegen, scope, variable_name); - if (tld) - return ir_build_decl_ref(irb, scope, node, tld, lval); + if (tld) { + IrInstruction *decl_ref = ir_build_decl_ref(irb, scope, node, tld, lval); + if (lval == LValPtr) { + return decl_ref; + } else { + return ir_expr_wrap(irb, scope, decl_ref, result_loc); + } + } if (get_container_scope(node->owner)->any_imports_failed) { // skip the error message since we had a failing import in this file @@ -16503,7 +16509,7 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh IrInstruction *branch_instruction = predecessor->instruction_list.pop(); ir_set_cursor_at_end(&ira->new_irb, predecessor); IrInstruction *casted_value = ir_implicit_cast(ira, new_value, resolved_type); - if (casted_value == ira->codegen->invalid_instruction) { + if (type_is_invalid(casted_value->value.type)) { return ira->codegen->invalid_instruction; } new_incoming_values.items[i] = casted_value;