Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
85b9100
Resolve empty timeframe arguments to the chart period
luisleo526 Nov 14, 2026
6e90b5a
Integrate empty timeframe handling with current main
luisleo526 Nov 14, 2026
6453949
Preserve timeframe arguments and generated-name safety
luisleo526 Nov 14, 2026
cd3b13f
Update anchor test expectations for conditional timeframe calls
luisleo526 Nov 14, 2026
909baaf
Preserve reference types across fields and calls
luisleo526 Nov 14, 2026
9120d20
Combine reference-type support with current main
luisleo526 Nov 14, 2026
cb93e2d
Handle emitters without function metadata
luisleo526 Nov 14, 2026
96297f9
Retain structured value types across user function calls
luisleo526 Nov 14, 2026
9237e1b
Check compound values through native execution
luisleo526 Nov 14, 2026
2a8071d
Combine structured type support with current main
luisleo526 Nov 14, 2026
e004cbf
Bound type inference within expression queries
luisleo526 Nov 14, 2026
8802058
Validate timeframe argument types
luisleo526 Nov 14, 2026
7a28a29
Register the timeframe argument diagnostic
luisleo526 Nov 15, 2026
209b3dc
Refresh test reporting and timestamp controls
luisleo526 Nov 15, 2026
31f2d50
Refresh test reporting and timestamp controls
luisleo526 Nov 15, 2026
49cab86
Refresh test reporting and timestamp controls
luisleo526 Nov 15, 2026
c04553d
Disambiguate diagnostic templates by argument kinds
luisleo526 Nov 15, 2026
f2f6ec8
Validate timeframe arguments using semantic types
luisleo526 Nov 15, 2026
b2db977
fix(codegen): allocate function clone names against authored members
luisleo526 Nov 15, 2026
c9bb034
Use the generated timeframe type diagnostic presentation
luisleo526 Nov 15, 2026
5beedda
Locate helper argument expectations inside the builtin call
luisleo526 Nov 15, 2026
bd8a3c6
Resolve registered argument types and report their source starts
luisleo526 Nov 15, 2026
4da8042
fix(codegen): separate composed helper and lexical storage names
luisleo526 Nov 15, 2026
95e5924
Preserve sizing string values across expressions and host settings
luisleo526 Nov 15, 2026
149cb9b
Exercise v5 receiver shadowing through an imported library
luisleo526 Nov 15, 2026
95b26d8
Preserve integer risk type boundary codes
luisleo526 Nov 15, 2026
6e9d119
Strengthen sizing regression and reserve generated name
luisleo526 Nov 15, 2026
d9a643e
Lower computed risk type arms at numeric boundary
luisleo526 Nov 15, 2026
57d0db6
Convert sizing selection arms at host boundaries
luisleo526 Nov 15, 2026
6c1ff4f
fix(codegen): preserve established typed method names
luisleo526 Nov 15, 2026
a0afaa8
Assert the risk type conversion for reassigned sizing variables (#394)
luisleo526 Nov 15, 2026
db8b39a
Combine the empty timeframe and reference type fixes
luisleo526 Nov 15, 2026
ed1eb67
Combine with the generated name collision fix
luisleo526 Nov 15, 2026
45b8662
Preserve unresolved script selection history
luisleo526 Nov 15, 2026
43ec287
Combine corrected timeframe and compound type inference
luisleo526 Nov 15, 2026
40a9877
Combine the compound value type fix with the stacked fixes (#391)
luisleo526 Nov 15, 2026
0ba632a
Resolve empty timeframe arguments, keep reference types across calls,…
luisleo526 Nov 15, 2026
6fa5d2b
Merge main into the compound value type fix (#391)
luisleo526 Nov 15, 2026
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
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,36 @@ supported as exact pairs; on the 0.x line they are independent. See the

## Unreleased (next release)

- Strategy sizing constants retain their string values in expressions, aliases
and helper calls. Host order and risk settings convert these values to their
numeric representation only at the setting boundary.

- `timeframe.in_seconds` and `timeframe.change` resolve an evaluated empty
string to the chart period, including input, variable, function-return and
named arguments. The argument is evaluated once, and nonempty strings keep
their explicit period. Bare `na` remains accepted; the value returned by
`timeframe.change(na)` is still awaiting verification against TradingView.
Non-string timeframe arguments are refused before C++ emission with the
stable `PF-E2095` type diagnostic and a source location, including input
values, reassignments, indicator results and helper parameters. Equally
specific diagnostic templates distinguish primitive types from qualifiers
using their catalog argument kinds. Dotted builtin signatures retain supplied
arguments, including escaped string literals and VWAP anchors. (#394)
- Script identifiers spelled like integer-to-float conversion temporaries,
including the underscore suffixes of nested conversions, now use the
generator's reserved-name escaping.
- Reference-typed UDT fields keep their type when initialized or reassigned
with `na`, including array defaults. Drawing handles cross user-function
and tuple boundaries by value, and `label(na)` produces a missing label
handle. Polyline locals, arrays, fields and delete methods retain opaque
handles and argument evaluation while rendering remains a visual no-op.
- Generated function variants and persistent local copies avoid authored and
generated member names, including names ending in `_cs1` and composed names
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.

- 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 All @@ -37,6 +67,12 @@ supported as exact pairs; on the 0.x line they are independent. See the
bytes: the timezone macro block and newly reserved names remain.
Regenerate C++ and relink affected strategies.

- User functions retain array, object and string result types through branch
returns and history clones. Untyped arguments retain collection element
types through nested calls and tuple bindings, and reassigned matrix locals
keep their initializer's matrix type. (#391)
- Deeply nested user-function calls share type-inference work within each
expression query, including when a return type remains unresolved.
- `array.sort_indices` returns integer indices, accepts typed `array<int>`
results and honors ascending/default or descending order in namespace and
method calls, including named arguments. Numeric `na` values sort last in
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/support-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ lowering. Structural mutation, collection reassignment/escape, history and
pair-binder iteration retain PF-E5086 pending TV evidence/provenance support;
declaration tails yielding collections as callable/selection values are refused.
`polyline.all` retains PF-E5085 until the engine has a Polyline handle/arena.
Polyline locals, array elements and UDT fields retain opaque typed handles;
default construction and bare `na` use a missing handle, and copies retain
its identity. `polyline.new` and functional or method-form `delete` keep the
existing visual-only rendering contract, while evaluating their arguments
once in parameter order. Opaque ID allocation joins script reset and rollback
state. This does not supply the live arena required by `polyline.all`.
`var`/`varip` aliases retain PF-E5086 until a TradingView capture establishes
their lifetime semantics. Whether a later creation in the same bar is visible
through the alias is not yet measured against TradingView.
Expand Down
286 changes: 250 additions & 36 deletions pineforge_codegen/analyzer/base.py

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion pineforge_codegen/analyzer/call_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,7 @@ def _handle_user_func_call(self, func_name: str, node: FuncCall) -> PineType:
for i in range(len(param_specs)):
if param_specs[i] is None and i < len(arg_specs):
param_specs[i] = arg_specs[i]
self._callable_bound_param_specs_by_node[id(node)] = tuple(param_specs)
self._record_deferred_param_call_edge(
node,
func_name,
Expand Down Expand Up @@ -2171,13 +2172,43 @@ def _handle_user_func_call(self, func_name: str, node: FuncCall) -> PineType:
# scalar fallbacks. Propagate the concrete specs through the exact
# definition-time call edges and infer returns in post-order before
# codegen snapshots the FuncInfo table.
self._propagate_deferred_map_callable_specs(
self._propagate_deferred_callable_specs(
func_name,
{
name: spec
for name, spec in zip(func_def.params, param_specs)
},
)
value_specs = [*param_specs, fi.return_type_spec]
exact_return = (
self._callable_value_return_spec(
func_def, dict(zip(func_def.params, param_specs)),
)
if any(
spec is not None
and (spec.kind != "primitive" or spec.name == "string")
for spec in value_specs
)
else None
)
if exact_return is not None and (
exact_return.kind != "primitive" or exact_return.name == "string"
):
self._callable_bound_return_specs_by_node[id(node)] = exact_return
self._callable_return_specs_by_profile[
(func_name, tuple(param_specs))
] = exact_return
if (fi.return_type_spec is None
or fi.return_type_spec.kind == "primitive"):
fi.return_type_spec = exact_return
self._func_return_type_specs[func_name] = exact_return
if exact_return.kind == "primitive":
return_type = self._primitive_pine_type_from_spec(exact_return)
fi.return_type = return_type
self._func_return_types[func_name] = return_type
elif exact_return.kind == "udt":
fi.udt_return_type = exact_return.name
self._func_udt_return_types[func_name] = exact_return.name

if return_type == PineType.NA:
self._na_return_callables[id(node)] = func_def
Expand Down
6 changes: 6 additions & 0 deletions pineforge_codegen/analyzer/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ class AnalyzerContext:
# helper called with both ``bar_index`` and ``close``).
func_callsite_param_types: dict = field(default_factory=dict)
func_callsite_return_types: dict = field(default_factory=dict)
# Exact argument/return value types retain collection element types, object
# identities and strings independently of the coarse primitive profiles.
func_callsite_param_specs: dict = field(default_factory=dict)
func_callsite_return_specs: dict = field(default_factory=dict)
func_value_call_edges: dict = field(default_factory=dict)
func_value_return_specs: dict = field(default_factory=dict)
# Declaration-time parameter specs, before any call-site inference fills
# untyped slots on the legacy FuncInfo record. Codegen uses this to apply
# variant overrides only to genuinely untyped parameters.
Expand Down
Loading