diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-08-22 12:55:09 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-08-22 12:56:35 -0400 |
| commit | 0d6a6c76eabcd020c5f58dc4667766b0e2756dfa (patch) | |
| tree | fbdea15f00c303d136f38bfc9025baa736251227 /src | |
| parent | 8460d5617cc12d614abf39f55ab85c783c4b35a8 (diff) | |
| download | zig-0d6a6c76eabcd020c5f58dc4667766b0e2756dfa.tar.gz zig-0d6a6c76eabcd020c5f58dc4667766b0e2756dfa.zip | |
add missing "referenced here" notes for lazy values
Diffstat (limited to 'src')
| -rw-r--r-- | src/analyze.cpp | 6 | ||||
| -rw-r--r-- | src/ir.cpp | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 0a5de5fd36..ee67f259f0 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1918,7 +1918,7 @@ static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) { if (enum_type->data.enumeration.resolve_status != ResolveStatusInvalid) { enum_type->data.enumeration.resolve_status = ResolveStatusInvalid; g->trace_err = add_node_error(g, decl_node, - buf_sprintf("circular dependency: whether enum '%s' has non-zero size", + buf_sprintf("dependency loop: whether enum '%s' has non-zero size", buf_ptr(&enum_type->name))); } return ErrorSemanticAnalyzeFail; @@ -2095,7 +2095,7 @@ static Error resolve_struct_zero_bits(CodeGen *g, ZigType *struct_type) { if (struct_type->data.structure.resolve_status != ResolveStatusInvalid) { struct_type->data.structure.resolve_status = ResolveStatusInvalid; g->trace_err = add_node_error(g, decl_node, - buf_sprintf("circular dependency: whether struct '%s' has non-zero size", + buf_sprintf("dependency loop: whether struct '%s' has non-zero size", buf_ptr(&struct_type->name))); } return ErrorSemanticAnalyzeFail; @@ -2282,7 +2282,7 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) { if (union_type->data.unionation.resolve_status != ResolveStatusInvalid) { union_type->data.unionation.resolve_status = ResolveStatusInvalid; g->trace_err = add_node_error(g, decl_node, - buf_sprintf("circular dependency: whether union '%s' has non-zero size", + buf_sprintf("dependency loop: whether union '%s' has non-zero size", buf_ptr(&union_type->name))); } return ErrorSemanticAnalyzeFail; diff --git a/src/ir.cpp b/src/ir.cpp index 9c9a28ee56..e64098be01 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -10813,8 +10813,13 @@ ConstExprValue *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *nod ConstExprValue *result = ir_exec_const_result(codegen, analyzed_executable); if (!allow_lazy) { - if ((err = ir_resolve_lazy(codegen, node, result))) + if ((err = ir_resolve_lazy(codegen, node, result))) { + if (codegen->trace_err != nullptr) { + codegen->trace_err = add_error_note(codegen, codegen->trace_err, source_node, + buf_create_from_str("referenced here")); + } return &codegen->invalid_instruction->value; + } } return result; |
