authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-12-18 21:15:40-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-12-18 21:15:40-05:00
log956ff8a7f98cad2f5f9b043e8a896609ea41f952
treee0dfd01974856834d7bec3946dc119a0b83187d3
parent132e2fa5d9cc17088082cf4797701214c20845f1

better error message generic instantiations


1 files changed, 9 insertions(+), 1 deletions(-)

src/ir.cpp+9-1
......@@ -4172,13 +4172,16 @@ IrInstruction *ir_gen_fn(CodeGen *codegen, FnTableEntry *fn_entry) {
41724172static void add_call_stack_errors(CodeGen *codegen, IrExecutable *exec, ErrorMsg *err_msg, int limit) {
41734173 if (!exec || !exec->source_node || limit < 0) return;
41744174 add_error_note(codegen, err_msg, exec->source_node, buf_sprintf("called from here"));
4175
41754176 add_call_stack_errors(codegen, exec->parent_exec, err_msg, limit - 1);
41764177}
41774178
41784179static ErrorMsg *ir_add_error(IrAnalyze *ira, IrInstruction *source_instruction, Buf *msg) {
41794180 ira->new_irb.exec->invalid = true;
41804181 ErrorMsg *err_msg = add_node_error(ira->codegen, source_instruction->source_node, msg);
4181 add_call_stack_errors(ira->codegen, ira->new_irb.exec, err_msg, 10);
4182 if (ira->new_irb.exec->parent_exec) {
4183 add_call_stack_errors(ira->codegen, ira->new_irb.exec, err_msg, 10);
4184 }
41824185 return err_msg;
41834186}
41844187
......@@ -6243,6 +6246,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
62436246 if (impl_fn->type_entry->id == TypeTableEntryIdInvalid)
62446247 return ira->codegen->builtin_types.entry_invalid;
62456248
6249 impl_fn->ir_executable.source_node = call_instruction->base.source_node;
6250 impl_fn->ir_executable.parent_exec = ira->new_irb.exec;
6251 impl_fn->analyzed_executable.source_node = call_instruction->base.source_node;
6252 impl_fn->analyzed_executable.parent_exec = ira->new_irb.exec;
6253
62466254 ira->codegen->fn_protos.append(impl_fn);
62476255 ira->codegen->fn_defs.append(impl_fn);
62486256 }