Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,33 @@ supported as exact pairs; on the 0.x line they are independent. See the
that overlap collection-history or requested-context storage. Persistent
declarations in sibling blocks also retain distinct storage when a script
uses their generated spelling. Declarations, calls and history storage use
the same allocated identities. Regenerate C++ and relink affected strategies.

the same allocated identities, including when selecting reachable variants
for emission. Regenerate C++ and relink affected strategies.
- Persistent declarations accept a type qualifier after `var` or `varip`.
Lower-timeframe requests return independently typed arrays for inline and
helper-returned tuple payloads.
- Complete nested indentation levels can combine tabs and spaces. Requested
`na`/`nz` helper parameters retain their bindings beside time operations;
global tuple declarations and their member histories share one requested
sample. Uncalled forwarding helpers no longer allocate unresolved TA buffers
for their unreachable call variants (#372). Bare tuple-element history
payloads retain their located refusal. Tuple histories rendered through the
expression visitor, including reads through globals, retain their chart
series and warning. Resolvable variants of a reachable helper retain their
TA state even when registered through an uncalled caller. Requested builtin
tuples reuse their existing sampled results, and mixed-clock tuple history
uses the registered history diagnostic.

- Built-in size, position, line/label style and shape constants retain their
string values in variables, selections, function arguments and returns, and
string input defaults/options. This fixes ambiguous C++ assignments, NUL
strings, unsupported size inputs and null-pointer string construction (#389).
Sort-order constants retain their distinct `sort_order` identity through
defaults and comparisons; invalid string conversions are diagnosed at their
Pine location, including individual elements of string input options.
`array.sort_indices` honors a supplied sort direction.
Scalar function overloads no longer crash during type checking.
Regenerate C++ and relink affected strategies.
- A zone name the engine rejects now makes calendar-form `timestamp()` stop the
run at its first evaluation, instead of silently calculating a UTC value.
The paired engine reports a typed timezone error identifying the failed bar.
Expand Down
2 changes: 1 addition & 1 deletion docs/codegen-coverage-gaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ tables (`HARD_REJECT_FUNC`, `HARD_REJECT_NAMESPACE`, `NOT_YET_FUNC`,
| `visit_expr.py:443` | `session.<unknown>` → `"false"` | Known members being enumerated does not justify a value for an unknown member. The catch-all is a placeholder defect. |
| `visit_expr.py:448` | `syminfo.<unknown>` → `"0"` | The historical whitelist blocked unknown members upstream; the emitter placeholder is still a defect. |
| `visit_expr.py:459` | `color.<unknown>` → `"0"` | The historical whitelist covered known constants; an unknown-member placeholder is still a defect. |
| `visit_expr.py:461` | `SKIP_NAMESPACES` (table/label/line/box/polyline/chart/linefill/display/size/position) → `"0"` | The audit treated these as visual omissions. Substituting zero for a missing value lowering is a defect; each supported member needs its semantics. |
| `visit_expr.py:461` (historical audit) | Legacy visual namespace fallbacks → `"0"` | Inventoried size, position, line/label style and shape constants now use typed string values from `builtin_constants.py` before these fallbacks. Remaining missing value lowerings are defects; rendering omissions do not justify substituting zero for a value. |
| `visit_expr.py:484-507` | `strategy.oca.<unknown>`, `strategy.direction.<unknown>`, `strategy.commission.<unknown>`, `strategy.closedtrades.<unknown>`, `strategy.opentrades.<unknown>` catch-alls | Known enum values do not define unknown members. The catch-all defaults are placeholder defects. |
| `visit_call.py:357` | `map.<unknown>(...)` → `"0"` | The historical whitelist rejected unknown functions upstream; the emitter placeholder is still a defect. |
| `visit_call.py:404` | `array.<unknown>(...)` → `"0"` | The historical whitelist rejected unknown functions upstream; the emitter placeholder is still a defect. |
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/file-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ pineforge_codegen/
│ (after generation; the C++ unchanged).
├── session_reads.py The session.<flag>[k] reads the generated
│ C++ holds (analyzer and codegen share it).
├── builtin_constants.py Typed scalar constant values shared by
│ analysis, emission and input proofs;
│ nominal builtin enums retain TypeSpec identity.
├── signatures.py Pine v6 builtin signature registry
│ (TA / math / str / strategy / input /
│ map / built-ins) — single source of
Expand Down
35 changes: 35 additions & 0 deletions docs/reference/support-contracts.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
## Support contracts

Persistent typed declarations parse their storage prefix separately from their
qualifier: `var const float`, `varip const int`, and the corresponding `simple`
and `series` forms retain both annotations and their existing initialization.

`request.security_lower_tf` tuple payloads, written inline or returned by a
helper, produce one array per element. Each intrabar evaluates the tuple once
before distributing values to the independently typed arrays; clearing the
request clears every array together. Tuple-bound arrays retain collection
metadata in global and callable scopes.

A global tuple declaration read by `request.security` is sampled once in the
requested evaluator, in declaration order. Scalar and history reads share that
sample, including stateful helper results. Member history commits on completed
requested bars even when a lazy payload does not read the member on that bar.
Helper parameter bindings remain active through `na`/`nz` builtin emission in
both evaluator modes. These rules supersede the older tuple refusal limitations
described in the historical helper row below.

Complete mixed tab/space nested block prefixes use four columns per tab plus
the spaces. Previously accepted incomplete mixed prefixes, skipped first-body
widths and pending logical-line continuations retain their earlier handling
pending additional TradingView observations; they are not newly refused as part
of the nested-block correction.

Builtin `array.slice` on a resolved typed array in the script, a function or
method parameter, or a callable-local array opens the view gate and lowers the
script's array storage to typed handles:
Expand Down Expand Up @@ -277,6 +301,17 @@ This exception covers only constructs PineForge refuses today. A form that compi
The emission invariant (`AGENTS.md#emission-invariant`) states this rule for every emission path. The notes in this file describe existing behavior: a documented approximation or unsupported fallback is an implementation gap, not an exception to the invariant.

Input defaults use the input family's Pine type and qualifier contract.
Inventoried `size.*`, `position.*`, `line.style_*`, `label.style_*` and
`shape.*` members have string values independently of a visual call's
rendering support. `builtin_constants.py` supplies their value and semantic
type to analysis, emission and string-input proofs. Line styles also supply
box border styles. Assignments, selections and callable variants preserve
those types. `order.ascending` and `order.descending` instead retain nominal
`sort_order` TypeSpecs; their runtime storage does not permit a Pine string
conversion. Typed slots and operator contracts check that identity.
`tests/test_builtin_style_values.py` covers the value paths, named bindings
and nominal restrictions, including order arguments of collection sorting.

An explicit `const color` carrier with a proven initializer supplies its
packed value to the getter and settings descriptor before `on_bar`; the
manifest reads that descriptor. `codegen/constant_values.py` resolves lexical
Expand Down
Loading