Repository navigation
parser: a UDT field assignment as a one-line function or method body (Part of #230) - #253
Closed
luisleo526 wants to merge 3 commits into
Closed
luisleo526 wants to merge 3 commits into
luisleo526 wants to merge 3 commits into
Conversation
… part 1) Red-first tests: the reporter's one-line `set(State s) => s.value := 1`, the method form, a compound operator and comma-joined statements must translate to exactly the C++ of the same body written on an indented line; the value the script plots is 1 on every bar; a plain expression body stays one ExprStmt with is_single_expr; a plain-name assignment keeps its parser error. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…n or method body (#230, part 1) `set(State s) => s.value := 1` stopped at the colon-equals token because the one-line body of a function or method was read as a single expression. The body now takes the same expression-or-assignment shape as a switch arm's line, restricted to field and element targets (and their compound operators, comma-joined statements included). An assignment body is a real statement, so it is represented as an ordinary block (is_single_expr false) and translates exactly like the same body on its own indented line. A plain expression body keeps its one-ExprStmt form, and a plain-name assignment keeps its parser error. Part of #230 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…jected shapes; changelog (#230, part 1) A history subscript is not an assignable target in Pine, so the one-line function or method body takes only a field (member access) target; an assignment operator after any other target stays unconsumed and keeps the old parser error. Two rows pin it: a plain-name second statement after a field assignment (`s.value := 1, x := 2`) and a subscript target (`s[1] := 2`), both rejected with the COLON_EQUALS parser diagnostic. CHANGELOG gets the entry. Part of #230 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.
parser: a UDT field assignment as a one-line function or method body
set(State s) => s.value := 1stopped at the:=token because the one-line body of a function or method was read as a single expression (#230, part 1; part 2, line endings, shipped earlier). The body now takes the expression-or-assignment shape a switch arm's line already has, restricted to a field (member access) target, with the compound operators and comma-joined statements. An assignment body is a real statement, represented as an ordinary block, so it translates exactly like the same body on its own indented line. A plain expression body keeps its one-ExprStmt form; a plain-name assignment (f() => x := 1), a plain-name second statement (s.value := 1, x := 2) and a subscript target (s[1] := 2) keep the old parser error.The switch-arm line parser now calls the same helper with its previous any-target behaviour (default argument), so it parses as before.
Tests (red first): the one-line function, the method, a compound operator and comma-joined statements must produce the same C++ as the indented form (compared with each other, not typed); a native row checks the plotted field value on a synthetic feed; a control keeps plain expression bodies as one ExprStmt; the rejected shapes keep their parser error. Lab (CLOUD, paired engine main): red 5 failures with the issue's own error, green 10642 passed / 0 failed, raw-bytes comparison of 555 scripts identical to the base.
Part of #230
🤖 Generated with Claude Code