diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-08-20 04:03:36 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-08-20 04:03:36 -0400 |
| commit | d9dd50d74c282aefcb89ca922523916b88a6236f (patch) | |
| tree | 56a6f6658059327ad975afbf20f6ace272a98805 /src | |
| parent | 8e19bdfc797cb419bddb4334e7d81abd382c11d9 (diff) | |
| download | zig-d9dd50d74c282aefcb89ca922523916b88a6236f.tar.gz zig-d9dd50d74c282aefcb89ca922523916b88a6236f.zip | |
fix not propagating parseh aliases through pub use decls
Diffstat (limited to 'src')
| -rw-r--r-- | src/analyze.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 05ec20aced..0b43f2d1e4 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -2922,13 +2922,17 @@ static void add_symbols_from_import(CodeGen *g, AstNode *src_use_node, AstNode * continue; } - auto existing_entry = dst_use_node->owner->decls_scope->decl_table.put_unique(target_tld->name, target_tld); + // Note: target_tld->name is not necessarily equal to entry->key because + // of aliases that parseh uses. + Buf *target_tld_name = entry->key; + + auto existing_entry = dst_use_node->owner->decls_scope->decl_table.put_unique(target_tld_name, target_tld); if (existing_entry) { Tld *existing_decl = existing_entry->value; if (existing_decl != target_tld) { ErrorMsg *msg = add_node_error(g, dst_use_node, buf_sprintf("import of '%s' overrides existing definition", - buf_ptr(target_tld->name))); + buf_ptr(target_tld_name))); add_error_note(g, msg, existing_decl->source_node, buf_sprintf("previous definition here")); add_error_note(g, msg, target_tld->source_node, buf_sprintf("imported definition here")); } @@ -2956,6 +2960,12 @@ void resolve_use_decl(CodeGen *g, AstNode *node) { void preview_use_decl(CodeGen *g, AstNode *node) { assert(node->type == NodeTypeUse); + if (node->data.use.resolution == TldResolutionOk || + node->data.use.resolution == TldResolutionInvalid) + { + return; + } + node->data.use.resolution = TldResolutionResolving; IrInstruction *result = analyze_const_value(g, &node->owner->decls_scope->base, node->data.use.expr, g->builtin_types.entry_namespace, nullptr); |
