fix(codegen): bare ta.<prop> read must bind to a LIVE ta site, not a dead one#46
Merged
Merged
Conversation
…dead one The bare property-read resolver for ta.vwap / argless-implicit-compute TAs (visit_expr.py) picked the FIRST ta_call_sites entry whose member matched `_ta_<prop>_`, with no dead-code check. When the first such site is owned by a never-called (dead) function, its member declaration is pruned by the dead-code pass — so a LIVE bare read (top-level or inside request.security) referenced an undeclared member. Regression exemplar: nightowlxtrader-azt — `f5()`/`f15()` are defined but never called (dead), so their `ta.vwap` sites (`_ta_vwap_10`/`_ta_vwap_13`) are pruned; the live `vwap2 = ta.vwap` and two `request.security(..., ta.vwap, ...)` reads all resolved to `_ta_vwap_10` → `error: use of undeclared identifier '_ta_vwap_10'` (compile-error; the strategy was carrying a STALE old-codegen excellent CSV). Fix: skip `_dead_ta_indices` in the resolver so a live read binds to the first LIVE matching site (here `_ta_vwap_37`, owner=None). Truly-dead sites stay pruned — dead-code elimination is preserved. Corpus emission BYTE-IDENTICAL (265/265 corpus strategies, SHA-256 fix vs base — no corpus strategy has a dead-owned property site before a live read). pytest 1446 passed. nightowlxtrader now compiles + grades a genuine excellent (was stale). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
The bare property-read resolver for
ta.vwap/ argless-implicit-compute TAs (visit_expr.py) picked the firstta_call_sitesentry matching_ta_<prop>_, with no dead-code check. When that first site is owned by a never-called (dead) function, its member declaration is pruned by the dead-code pass — so a live bare read referenced an undeclared member →error: use of undeclared identifier.Exemplar
nightowlxtrader-azt:f5()/f15()defined but never called → theirta.vwapsites (_ta_vwap_10/_13) pruned; the livevwap2 = ta.vwap+ tworequest.security(..., ta.vwap, ...)reads all resolved to_ta_vwap_10→ compile-error. (It was carrying a stale old-codegen excellent CSV, masking this.)Fix
Skip
_dead_ta_indicesin the resolver → a live read binds to the first live matching site (_ta_vwap_37). Truly-dead sites stay pruned — dead-code elimination preserved.Verification (fresh-context R7 = GO)
clang++exit 0, grades a genuine excellent (was stale).🤖 Generated with Claude Code