Repository navigation
codegen: request.currency_rate raises a run-time error only where it is evaluated (Fixes #228) - #254
Closed
luisleo526 wants to merge 5 commits into
Closed
luisleo526 wants to merge 5 commits into
luisleo526 wants to merge 5 commits into
Conversation
Red-first regression tests: the reporter's script and the never-taken trade branch must translate, an evaluated call must stop the run like runtime.error, a skipped call must run like a literal replacement, and a malformed call must still fail signature validation. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ted (#228) PineForge has no currency-conversion data, so request.currency_rate is no longer refused at analysis time. It translates to an expression that evaluates its arguments, stops the run with pine_runtime_error and has the float type, so a script whose call sits in a branch that never runs translates and runs, and an evaluated call stops the run like runtime.error. The call binds its from/to/ignore_invalid_currency signature through the existing builtin argument binder; the shared signature diagnostics name the actual callee (scripts/gen_diagnostics_catalog.py; the generated catalog follows in the next commit). Fixes #228 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… errors (#228) The short user_message of PF-E1088 / PF-W1088 now reads "The arguments to {name} do not match its Pine signature." as scripts/gen_diagnostics_catalog.py writes it, because request.currency_rate shares the nz / fixnan argument binder. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…keyword spelling from a test (#228) The first lab run (rj-20261026t033717-8ad6d7) failed two tests of this branch: - tests/test_diagnostic_notes.py requires the PF-W1088 user_message to differ from PF-E1088's and to say that a switch arm only warns; the catalog generator edit had given both the same sentence. PF-W1088 now keeps the switch-arm sentence after the callee-aware first sentence, in the generator and in the catalog. - the all-keyword call spelled `to = 'JPY'`, but `to` is a keyword token of the lexer and fails to parse as an argument name (ParseError: Unexpected token TO). That is a front-end limit independent of this change; the test now spells the optional argument by name after two positional ones. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The stop is the repo's own request_stop(request_stop_marker(node)) shim, the one request.financial / earnings / dividends / splits use, so a new engine reports the same coded no-data failure for the currency request (function request.currency_rate, the spelled call and its line) and an older engine keeps the original pine_runtime_error with the same English text. Arguments are still evaluated first and a skipped branch evaluates nothing. The tests derive the expected stop from a transpiled sibling no-data request instead of a runtime.error twin. AGENTS.md says request.currency_rate is not a hard reject: it translates and stops where it is evaluated. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
luisleo526
added a commit
that referenced
this pull request
Oct 26, 2026
…ialization, request.currency_rate, helper-local var color, one-line field assignment) (#261) ## What This branch carries five codegen fixes planned for 1.8.0. It is five merge commits on `main`, one per pull request, in this order, followed by one CHANGELOG commit. | Merged pull request | Fix | |---|---| | #260 | A `calc_on_order_fills` recalculation after a fill no longer rolls back the state of a deferred `request.security` evaluation (a silent wrong value, for example after a late margin-call liquidation). | | #259 | A persistent (`var`) UDT, array, map or matrix whose initializer reads an earlier computed value is initialized once, in statement order (Fixes #226). A `varip` declaration with the same dependency still reads the default; that gap is tracked in #258. | | #254 | `request.currency_rate` raises its error only where the call is evaluated, not where it merely appears in a branch that never runs (Fixes #228). | | #255 | `var color` state inside a `request.security` helper, explicit or inferred, with persistence, transparency and `na` (Part of #229). The refusal for any other unsupported helper-local `var` type has the new code `PF-E3093`. | | #253 | A UDT field assignment as the body of a one-line function or method (Part of #230). | The CHANGELOG commit puts all five entries in the planned 1.8.0 section, updates its summary and compatibility notes, and removes the separate planned-patch section one of the merged branches added. ## Scope and limits - The five merge commits resolved no code conflict; the only textual conflicts were in `CHANGELOG.md`, replaced once by the last commit. The name-status against `main` is the union of the five pull requests' own files (28 files). - Over the 555 corpus and fixture scripts the emitted C++ differs from `main` in 72 scripts, all from the #260 change and only inside `restore_script_state()`; the other 483 are byte-identical. The other four fixes change no script of the 555; their tests cover their shapes. - The user-facing text of two diagnostics (`PF-E1088`, `PF-W1088`) is reworded and one code is added (`PF-E3093`); the catalog schema is unchanged. - The second half of #229 (the history of a derived helper argument) and the `varip` gap (#258) are not in this branch; they follow as separate pull requests. ## Tests - Full suite on the head of this branch with the paired engine: 10725 passed, 221 skipped (private fixtures and empty parameter sets, the same 221 as `main`), 0 failed. - A parity sweep over the whole population (7989 graded probes): PASS, no regression and no improvement (hard gate: 1009 evaluated, no moves; coverage complete). - Every pull request above keeps the tests it was reviewed with; this branch adds no test of its own. Fixes #226, Fixes #228. Part of #229, Part of #230. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor
Author
|
Superseded by #261, which carried this fix into the 1.8.0 release. |
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.
codegen:
request.currency_rateraises a run-time error only where it is evaluatedPineForge has no currency-conversion data, so
request.currency_ratewas refused at analysis time even in a branch that can never run (#228). It now translates to an expression that evaluates its arguments, stops the run with the repo's coded no-data stop (the onerequest.financial/earnings/dividends/splitsuse), and has the float type. A script whose call sits in a branch that never runs translates and runs; an evaluated call stops the run. No data feed is added.request_stop(request_stop_marker(node))with the existing English text kept; older engines fall back topine_runtime_errorwith the same text.request.currency_rateleavesHARD_REJECT_FUNCand gets afrom/to/ignore_invalid_currencysignature;request.seed,request.quandlandrequest.economicstay refused.to(request.currency_rate(from='A', to='B')) does not parse, as before this change; positional arguments andignore_invalid_currency=are covered.Tests (red first, derived from controls, no typed expected text): the issue's script verbatim, an untaken branch that feeds a trade quantity, evaluated calls stopping like the coded no-data stop of a sibling request, skipped calls running like a literal replacement on a synthetic feed, argument side effects staying in the untaken expression, malformed calls still failing signature validation. Lab (CLOUD, paired engine main): red on the tests-only commit 20 failures (PF-E1025), green 10656 passed / 0 failed, compile-corpus 312 passed, and a raw-bytes comparison of 555 scripts (312 corpus + 243 fixtures) is identical to the base.
Fixes #228
🤖 Generated with Claude Code