Skip to content

fix(interpreter): detect cyclic nameref to prevent wrong resolution#465

Merged
chaliy merged 1 commit intomainfrom
claude/fix-426-Y2nIj
Mar 2, 2026
Merged

fix(interpreter): detect cyclic nameref to prevent wrong resolution#465
chaliy merged 1 commit intomainfrom
claude/fix-426-Y2nIj

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Mar 2, 2026

Summary

  • Cyclic namerefs (a->b->a) silently resolved to a wrong variable
  • Added HashSet-based visited tracking in resolve_nameref() to detect cycles
  • Returns the original name when a cycle is detected

Test plan

  • Unit test: test_cyclic_nameref_detected

Closes #426

…lution

resolve_nameref now tracks visited names. If a cycle is detected
(a->b->a), returns the original name instead of silently resolving
to an arbitrary variable after 10 iterations.

Closes #426

https://claude.ai/code/session_01WZjYqxm5xMPAEe7FSHJkDy
@chaliy chaliy force-pushed the claude/fix-426-Y2nIj branch from ac6452c to bc1be21 Compare March 2, 2026 01:26
@chaliy chaliy merged commit 0388c46 into main Mar 2, 2026
17 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.

[L-2] Cyclic nameref silently resolves to wrong variable

2 participants