Skip to content

fix(parsers/zig): scope local const-alias resolution per function - #141

Merged
gadievron merged 1 commit into
masterfrom
fix/zig-alias-per-function-scope
Jul 14, 2026
Merged

fix(parsers/zig): scope local const-alias resolution per function#141
gadievron merged 1 commit into
masterfrom
fix/zig-alias-per-function-scope

Conversation

@gadievron

Copy link
Copy Markdown
Collaborator

_build_alias_index keyed the const fn-alias map by file_path, so two functions
in the same file binding the same alias name to different targets
(const doit = foo in one, const doit = bar in another) clobbered each
other last-writer-wins: one caller resolved to the wrong target and the other's
real edge was lost, falsely orphaning a live same-file function.

Key the alias map by the caller func_id and thread caller_id through
_resolve_call so each function resolves its own aliases. A Zig const is
immutable within a function, so a plain per-function binding is sufficient.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com


Found by a deep reachability/call-graph validation of the parser corpus: the 2026 release fixed this bug class at some parser sites but left this sibling. Ships with a RED->GREEN regression test driving the real parser/detector pipeline (not a mock). One of a 9-PR series of independent, region-disjoint fixes; verified together (full suite green, no collisions).

🤖 Generated with Claude Code

_build_alias_index keyed the const fn-alias map by file_path, so two functions
in the same file binding the same alias name to different targets
(`const doit = foo` in one, `const doit = bar` in another) clobbered each
other last-writer-wins: one caller resolved to the wrong target and the other's
real edge was lost, falsely orphaning a live same-file function.

Key the alias map by the caller func_id and thread caller_id through
_resolve_call so each function resolves its own aliases. A Zig const is
immutable within a function, so a plain per-function binding is sufficient.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gadievron
gadievron marked this pull request as ready for review July 10, 2026 18:17
@gadievron
gadievron merged commit 0f35ea0 into master Jul 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant