| ... | ... | @@ -588,7 +588,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Inde |
| 588 | 588 | const ptr_val = ptr.castTag(.constant).?.val; |
| 589 | 589 | const inferred_alloc = ptr_val.castTag(.inferred_alloc).?; |
| 590 | 590 | const peer_inst_list = inferred_alloc.data.stored_inst_list.items; |
| 591 | | const final_elem_ty = try sema.resolvePeerTypes(block, peer_inst_list); |
| 591 | const final_elem_ty = try sema.resolvePeerTypes(block, ty_src, peer_inst_list); |
| 592 | 592 | const var_is_mut = switch (ptr.ty.tag()) { |
| 593 | 593 | .inferred_alloc_const => false, |
| 594 | 594 | .inferred_alloc_mut => true, |
| ... | ... | @@ -899,7 +899,7 @@ fn analyzeBlockBody( |
| 899 | 899 | // Need to set the type and emit the Block instruction. This allows machine code generation |
| 900 | 900 | // to emit a jump instruction to after the block when it encounters the break. |
| 901 | 901 | try parent_block.instructions.append(sema.gpa, &merges.block_inst.base); |
| 902 | | const resolved_ty = try sema.resolvePeerTypes(parent_block, merges.results.items); |
| 902 | const resolved_ty = try sema.resolvePeerTypes(parent_block, .todo, merges.results.items); |
| 903 | 903 | merges.block_inst.base.ty = resolved_ty; |
| 904 | 904 | merges.block_inst.body = .{ |
| 905 | 905 | .instructions = try sema.arena.dupe(*Inst, child_block.instructions.items), |
| ... | ... | @@ -2347,7 +2347,7 @@ fn zirBitwise(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError |
| 2347 | 2347 | const rhs = try sema.resolveInst(bin_inst.rhs); |
| 2348 | 2348 | |
| 2349 | 2349 | const instructions = &[_]*Inst{ lhs, rhs }; |
| 2350 | | const resolved_type = try sema.resolvePeerTypes(block, instructions); |
| 2350 | const resolved_type = try sema.resolvePeerTypes(block, src, instructions); |
| 2351 | 2351 | const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs.src); |
| 2352 | 2352 | const casted_rhs = try sema.coerce(block, resolved_type, rhs, rhs.src); |
| 2353 | 2353 | |
| ... | ... | @@ -2433,7 +2433,7 @@ fn zirArithmetic(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerEr |
| 2433 | 2433 | const rhs = try sema.resolveInst(extra.rhs); |
| 2434 | 2434 | |
| 2435 | 2435 | const instructions = &[_]*Inst{ lhs, rhs }; |
| 2436 | | const resolved_type = try sema.resolvePeerTypes(block, instructions); |
| 2436 | const resolved_type = try sema.resolvePeerTypes(block, src, instructions); |
| 2437 | 2437 | const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs_src); |
| 2438 | 2438 | const casted_rhs = try sema.coerce(block, resolved_type, rhs, rhs_src); |
| 2439 | 2439 | |
| ... | ... | @@ -2694,7 +2694,7 @@ fn zirTypeofPeer(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerEr |
| 2694 | 2694 | inst_list[i] = try sema.resolveInst(arg_ref); |
| 2695 | 2695 | } |
| 2696 | 2696 | |
| 2697 | | const result_type = try sema.resolvePeerTypes(block, inst_list); |
| 2697 | const result_type = try sema.resolvePeerTypes(block, src, inst_list); |
| 2698 | 2698 | return sema.mod.constType(sema.arena, src, result_type); |
| 2699 | 2699 | } |
| 2700 | 2700 | |
| ... | ... | @@ -4028,7 +4028,7 @@ fn wrapErrorUnion(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: *Inst |
| 4028 | 4028 | } |
| 4029 | 4029 | } |
| 4030 | 4030 | |
| 4031 | | fn resolvePeerTypes(sema: *Sema, block: *Scope.Block, instructions: []*Inst) !Type { |
| 4031 | fn resolvePeerTypes(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, instructions: []*Inst) !Type { |
| 4032 | 4032 | if (instructions.len == 0) |
| 4033 | 4033 | return Type.initTag(.noreturn); |
| 4034 | 4034 | |
| ... | ... | @@ -4079,7 +4079,7 @@ fn resolvePeerTypes(sema: *Sema, block: *Scope.Block, instructions: []*Inst) !Ty |
| 4079 | 4079 | } |
| 4080 | 4080 | |
| 4081 | 4081 | // TODO error notes pointing out each type |
| 4082 | | return sema.mod.fail(&block.base, candidate.src, "incompatible types: '{}' and '{}'", .{ chosen.ty, candidate.ty }); |
| 4082 | return sema.mod.fail(&block.base, src, "incompatible types: '{}' and '{}'", .{ chosen.ty, candidate.ty }); |
| 4083 | 4083 | } |
| 4084 | 4084 | |
| 4085 | 4085 | return chosen.ty; |