Skip to content

Preserve compound value types across user function calls - #406

Merged
luisleo526 merged 38 commits into
mainfrom
fix/issue-391-stacked-h3
Nov 15, 2026
Merged

luisleo526 merged 38 commits into
mainfrom
fix/issue-391-stacked-h3

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

This pull request adds the compound value type fix (#391) on top of #405, which it contains unchanged. Once #405 has merged, the remaining change here is #391's. It supersedes #404.

Compound value types across user function calls (#391)

Valid Pine v6 scripts could generate C++ that did not compile, because an array, matrix, UDT or string was inferred as double at a function return, an untyped parameter or a reassigned local.

The fix:

  • infers compound types through branch returns, nested calls, tuple arguments and local assignments;
  • keeps separate callable variants for different array element types;
  • shares inference work within an expression query.

The admission of an unresolved script-level selection is unchanged, so its history output stays the same.

Reproduction tests:

  • tests/test_callable_compound_type_flow.py::test_callable_boundaries_keep_the_value_type[array-block-return]
  • tests/test_callable_compound_type_flow.py::test_untyped_array_calls_keep_distinct_element_types
  • tests/test_callable_compound_type_flow.py::test_reassigned_matrix_local_keeps_its_initializer_type

Fixes #391

Resolve dotted builtin signatures consistently and preserve explicit strings,
chart-period fallback and single evaluation. Reserve generated conversion names.
The existing symbol-clock anchor tests now check both calls in the emitted
empty-argument conditional. Add pure-Python checks of branch direction and
single evaluation, and make the temporary-name sweep reach the argument lambda.

Product code is unchanged by this test update.
Lower missing reference values to their destination storage and retain drawing
handle types through user functions and tuple returns. Support declared
polyline types, fields and deletion arguments.
Read optional function metadata safely when inferring reference casts, so bare
emitters retain matrix element types without raising an AttributeError.
Use the established integer storage and matrix alias in type-flow assertions.
Check array specializations, mutations, matrix values and copy independence.
Share operand and value inference while an expression query is active, then
release cached results before bindings can change. Preserve ordinary matrix
member initialization when the declaration expression is still available.
Use the chart period for a generic missing timeframe argument and refuse
numeric values for string parameters during analysis. Cover named arguments,
helper calls, source locations and generated translation units.
Include only the stock-generated PF-E2095 definition and pin. Preserve all
prior catalog entry bytes and their existing order.
Merge the current main while retaining the feature correction.
Merge the current main while retaining the feature correction.
Merge the current main while retaining the feature correction.
Use recognized Pine types in declared type slots to resolve equally literal
diagnostic templates. Keep stable code order for other ties and preserve
qualifier identities, raw arguments and rendering. Pin the timeframe type
diagnostic and its named arguments with direct regression controls.
Reject non-string timeframe arguments through the intrinsic signature before
C++ lowering, including helper parameters and boolean values. Preserve valid
string calls and exercise complete native controls at distinct optimization
levels. Declare the new diagnostic in the existing catalog delta fixture.
Keep generated state and callable clone identities distinct from authored
members and use the same allocated identities at declarations and calls.
Preserve noncolliding names and duplicate-state assertions.
Carry the generated argument-type entry and its pin into the member while
preserving all other catalog bytes and order. Use the grammatical message
and exact approved user presentation with the existing argument kinds.
Retain the same numeric refusal cases and qualifier controls.
Use the argument occurrence within the call instead of an identically
named helper parameter. Keep the exact line and column assertions and
all source inputs, diagnostic identities and test rows unchanged.
Carry registered namespace types through the semantic query used for written
helper calls while respecting lexical shadowing and version boundaries.
Reuse the existing expression-start locator for timeframe type refusals.
Allocate composed callable and persistent-storage identities outside reserved
helper families, and reserve all authored spellings before sibling-block
qualification. Keep declarations, calls and history consumers on the same
allocated identity. Exercise collision cases through the public pipeline.
Keep raw typed-method names on the function channel when they collide with
authored data members. Continue allocating encoded names and collisions with
generated storage so method definitions, calls and state stay distinct.
Sizing constants keep their Pine string type for the string consumers this
change fixes, so a reassigned sizing variable reaches the risk host boundary
as a string and is converted to its integer code there. Keeping the integer
comparison would need integer storage for these variables, which the string
consumers cannot use. The test still requires the call to read t after its
write, never its initializer, and now also checks the code chosen for the
assigned value.
Merge the empty timeframe argument fix (#394) with the reference type fix for
fields and function calls (#390). Both changelog entries are kept.
Merge the generated clone and storage name fix (#350) into the combined
#394 and #390 fixes. All changelog entries are kept.
Keep the established admission policy for non-nullable script selections while
retaining exact compound value joins inside functions and methods. This avoids
introducing collection history for previously unresolved global selections.
Resolve the analyzer type-query conflict by retaining both lexical namespace
typing and callable compound return profiles. Preserve the corrected script
selection history admission and both changelog entries. No test expectation
or additional product behavior is changed in this merge resolution.
Merge the compound value type fix for user function calls (#391) onto the
combined #394, #390 and #350 fixes. All changelog entries are kept.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Not checked: tests were not run; formal verification proved 0 of 54 changed function(s) (2 sampled, not proven, 52 not verified).

Formal verification. PR-changed functions: 2/54 verified (0 proven, 2 may-equivalent, 0 distinguished) · 52 not verified (23 unsupported, 29 over cap).

Not verified on this run: \_\_init\_\_ (unsupported), \_analyze (unsupported), \_operator\_operand\_type (unsupported), \_propagate\_call\_site\_counts (unsupported), \_untyped\_param\_family\_conflicts (unsupported), \_visit\_FuncCall (unsupported), \_visit\_FuncDef (unsupported), \_visit\_MemberAccess (unsupported), \_visit\_TupleAssign (unsupported), \_visit\_VarDecl (unsupported), and 13 more; 29 changed function(s) beyond the cap and 0 skipped when the time budget ran out.


Graphify review — findings

Adds exact value-profile tracking for user-function call sites, so callee variants get the array, object and string parameter and return types the emitter actually uses, and conflicting structured argument types (e.g. vector<int>& vs vector<double>) split into separate variants. Tightens timeframe.in_seconds and timeframe.change so an evaluated empty string resolves to the chart period (argument evaluated once), while non-string arguments are refused before emission with PF-E2095. Keeps strategy sizing constants as strings until the host setting boundary, escapes int-to-float temporary names, and gives polyline and UDT na fields opaque typed handles, with the new string specialization at risk of contradicting an already-established return spec.

Worth a look

  • Exact string specialization can contradict the established return spec — pineforge_codegen/analyzer/call_handlers.py:2212 · Escalate · medium
    • unverified hypothesis — survived the adversarial refute pass; needs human review

Review partial — this diff was larger than one review pass covers, so later files were not reviewed; some findings may be missing.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 6688 functions depend on the 2252 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: Analyzer — 113 callers, 15 callees
  • worse: CodeGen — 69 callers, 14 callees
  • worse: _Fold — 4 callers, 8 callees
  • new: get_variable_type_spec() — 4 callers, 3 callees
  • new: argument_runs() — 0 callers, 8 callees
  • new: test_numeric_timeframe_is_refused_during_analysis() — 0 callers, 7 callees
  • new: test_open_numeric_domain_is_not_reported_as_a_guessed_float() — 0 callers, 7 callees
  • new: test_non_string_timeframes_are_refused_by_semantic_type() — 0 callers, 7 callees
  • …and 1 more — each is listed as a finding

Verification — 6688 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 5803 function(s) in the blast radius were not formally verified this run

Cross-repo impact

Cross-repo impact

This change impacts 2 symbol(s) across 1 peer repo(s) — blast radius over derived cross-repo edges:

  • pineforge-4pass/pineforge-hpo — python/pineforge_hpo/transpile.py (via import_moniker, heuristic), tests/python/test_transpile.py (via import_moniker, heuristic)

1 peer repo(s) in this group are not yet indexed — cross-repo impact may be incomplete.

Cross-repo linkage is derived (SCIP-moniker matches are sound; name/contract matches are heuristic) and ADVISORY — it never affects this check's conclusion.

Test selection

Test selection

536 of 536 test file(s) selected (100%) via static blast radius.

Escalated to a full run for safety (noncode-change, uncovered-code) — the selection is not trustworthy on its own (see below). CI should run the whole suite.

  • tests/test_action_pins.py — full-run-safety
  • tests/test_allow_entry_in_qualifier.py — impact, full-run-safety
  • tests/test_allow_entry_in_request_const.py — impact, full-run-safety
  • tests/test_analyzer.py — impact, full-run-safety
  • tests/test_analyzer_matrix_inference.py — impact, full-run-safety
  • tests/test_analyzer_ta_return_types.py — impact, full-run-safety
  • tests/test_anchor_tf_change.py — impact, changed-test, full-run-safety
  • tests/test_anchor_time.py — impact, full-run-safety
  • tests/test_anchor_vwap.py — impact, changed-test, full-run-safety
  • tests/test_array_bounds_insert_fill_slice.py — impact, full-run-safety
  • tests/test_array_checked_access.py — impact, full-run-safety
  • tests/test_array_empty_aggregates.py — impact, full-run-safety
  • tests/test_array_history.py — impact, full-run-safety
  • tests/test_array_missing_integer_index.py — impact, full-run-safety
  • tests/test_array_new_color_fill_and_na_size.py — impact, full-run-safety
  • tests/test_array_new_defaults_and_order.py — impact, full-run-safety
  • tests/test_array_reference_semantics.py — impact, full-run-safety
  • tests/test_array_retained_alias.py — impact, full-run-safety
  • tests/test_array_slice_view.py — impact, full-run-safety
  • tests/test_array_sort_indices.py — impact, full-run-safety
  • tests/test_array_terminal_returns.py — impact, full-run-safety
  • tests/test_arrseg_coded_run_stops.py — impact, full-run-safety
  • tests/test_arrseg_review_fixes.py — impact, full-run-safety
  • tests/test_binop_operand_order.py — impact, full-run-safety
  • tests/test_block_shadow_primitive_types.py — impact, full-run-safety
  • tests/test_block_var_plain_siblings.py — impact, full-run-safety
  • tests/test_bool_na_refusal.py — impact, full-run-safety
  • tests/test_bool_na_refusals_2.py — impact, full-run-safety
  • tests/test_bool_na_values.py — impact, full-run-safety
  • tests/test_bool_string_inference.py — impact, full-run-safety
  • tests/test_builtin_name_shadow.py — impact, full-run-safety
  • tests/test_builtin_named_locals_compile.py — impact, full-run-safety
  • tests/test_builtin_named_locals_price_refusal.py — impact, full-run-safety
  • tests/test_builtin_named_locals_receipt.py — impact, full-run-safety
  • tests/test_builtin_named_locals_scope.py — impact, full-run-safety
  • tests/test_builtin_named_parameters.py — impact, full-run-safety
  • tests/test_builtin_named_parameters_reference.py — full-run-safety
  • tests/test_calc_on_order_fills_codegen.py — impact, full-run-safety
  • tests/test_calendar_lambda_locals.py — impact, full-run-safety
  • tests/test_call_argument_order.py — impact, full-run-safety
  • tests/test_callable_compound_type_flow.py — impact, changed-test, full-run-safety
  • tests/test_callable_local_histories.py — impact, full-run-safety
  • tests/test_callable_series_param_types.py — impact, full-run-safety
  • tests/test_callable_string_series_type.py — impact, full-run-safety
  • tests/test_callable_ta_forwarded_length.py — impact, full-run-safety
  • tests/test_callable_var_first_reach.py — impact, full-run-safety
  • tests/test_checked_settings.py — impact, full-run-safety
  • tests/test_ci_engine_main_touched.py — full-run-safety
  • tests/test_clone_name_allocation.py — impact, changed-test, full-run-safety
  • tests/test_closed_trade_fold.py — full-run-safety
  • … and 486 more

non-code file(s) changed (CHANGELOG.md, docs/reference/support-contracts.md, pineforge_codegen/diagnostics_catalog.json, tests/fixtures/diagnostic_codes_pin.json, tests/fixtures/diagnostic_notes/delta.json …) → running the full suite for safety (a code graph can't see config/fixture/data deps)

changed code file(s) with no mapped test (CHANGELOG.md, docs/reference/support-contracts.md, pineforge_codegen/analyzer/call_handlers.py, pineforge_codegen/codegen/drawing.py, pineforge_codegen/codegen/emit_top.py …) — a coverage gap or a missing link — running the full suite rather than only the selected tests

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Docs that may be stale (advisory)

Formal verification

Could not verify: Could not verify \_\_init\_\_.

The verifier did not have enough to check \_\_init\_\_, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_analyze.

The verifier did not have enough to check \_analyze, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_operator\_operand\_type.

The verifier did not have enough to check \_operator\_operand\_type, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_propagate\_call\_site\_counts.

The verifier did not have enough to check \_propagate\_call\_site\_counts, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_untyped\_param\_family\_conflicts.

The verifier did not have enough to check \_untyped\_param\_family\_conflicts, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_visit\_FuncCall.

The verifier did not have enough to check \_visit\_FuncCall, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_visit\_FuncDef.

The verifier did not have enough to check \_visit\_FuncDef, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_visit\_MemberAccess.

The verifier did not have enough to check \_visit\_MemberAccess, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_visit\_TupleAssign.

The verifier did not have enough to check \_visit\_TupleAssign, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_visit\_VarDecl.

The verifier did not have enough to check \_visit\_VarDecl, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_handle\_user\_func\_call.

The verifier did not have enough to check \_handle\_user\_func\_call, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_\_init\_\_.

The verifier did not have enough to check \_\_init\_\_, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_check\_node.

The verifier did not have enough to check \_check\_node, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

No difference found (not proven): No behavior difference found in \_selection\_type\_spec (not a proof).

The verifier ran both versions of \_selection\_type\_spec on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.

Guarantee: Empirical: the synth_receiver tier. A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.

Note: An input the sampler did not try could still differ.

No difference found (not proven): No behavior difference found in \_type\_spec\_from\_expr (not a proof).

The verifier ran both versions of \_type\_spec\_from\_expr on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.

Guarantee: Empirical: the synth_receiver tier. A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.

Note: An input the sampler did not try could still differ.

Could not verify: Could not verify \_visit.

The verifier did not have enough to check \_visit, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_\_init\_\_.

The verifier did not have enough to check \_\_init\_\_, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_build\_func\_instances.

The verifier did not have enough to check \_build\_func\_instances, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_generate\_cpp.

The verifier did not have enough to check \_generate\_cpp, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_inline\_history\_contexts\_for\_owner.

The verifier did not have enough to check \_inline\_history\_contexts\_for\_owner, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_is\_default\_drawing\_initializer.

The verifier did not have enough to check \_is\_default\_drawing\_initializer, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_is\_omitted\_udt\_field.

The verifier did not have enough to check \_is\_omitted\_udt\_field, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_is\_skip\_expr.

The verifier did not have enough to check \_is\_skip\_expr, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_prepare\_inline\_history\_members.

The verifier did not have enough to check \_prepare\_inline\_history\_members, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

Could not verify: Could not verify \_prepare\_runtime\_scalar\_var\_initializers.

The verifier did not have enough to check \_prepare\_runtime\_scalar\_var\_initializers, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

· 6 grounded finding(s) anchored inline below; 3 more finding(s) on lines outside this diff (see the check run).

return STRATEGY_SIZING_CONSTANTS.get(f"{namespace}.{name}")


def get_variable_type_spec(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — get_variable_type_spec()

high coupling complexity (Ca·Ce = 12).

Grounded coupling-delta finding (deterministic), not an LLM guess.

@pytest.mark.parametrize("stem", [
"_pf_collection_hist", "_sec7", "_precalc", "_strat",
])
def test_composed_reserved_storage_avoids_a_parameter_at_its_escape(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — test_composed_reserved_storage_avoids_a_parameter_at_its_escape()

fans out to 6 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.



@pytest.fixture(scope="module")
def argument_runs(tmp_path_factory):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — argument_runs()

fans out to 8 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

("1.25", "float"),
("-2.5", "float"),
])
def test_numeric_timeframe_is_refused_during_analysis(function, named, argument, pine_type):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — test_numeric_timeframe_is_refused_during_analysis()

fans out to 7 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.



@pytest.mark.parametrize("function", ("change", "in_seconds"))
def test_open_numeric_domain_is_not_reported_as_a_guessed_float(function):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — test_open_numeric_domain_is_not_reported_as_a_guessed_float()

fans out to 7 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

])
@pytest.mark.parametrize("conversion", [False, True], ids=["alone", "bool-to-text"])
@pytest.mark.parametrize("declarations,argument,pine_type", NON_STRINGS)
def test_non_string_timeframes_are_refused_by_semantic_type(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — test_non_string_timeframes_are_refused_by_semantic_type()

fans out to 7 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

… and keep generated names distinct (#405)

* Resolve empty timeframe arguments to the chart period

* Preserve timeframe arguments and generated-name safety

Resolve dotted builtin signatures consistently and preserve explicit strings,
chart-period fallback and single evaluation. Reserve generated conversion names.

* Update anchor test expectations for conditional timeframe calls

The existing symbol-clock anchor tests now check both calls in the emitted
empty-argument conditional. Add pure-Python checks of branch direction and
single evaluation, and make the temporary-name sweep reach the argument lambda.

Product code is unchanged by this test update.

* Preserve reference types across fields and calls

Lower missing reference values to their destination storage and retain drawing
handle types through user functions and tuple returns. Support declared
polyline types, fields and deletion arguments.

* Handle emitters without function metadata

Read optional function metadata safely when inferring reference casts, so bare
emitters retain matrix element types without raising an AttributeError.

* Validate timeframe argument types

Use the chart period for a generic missing timeframe argument and refuse
numeric values for string parameters during analysis. Cover named arguments,
helper calls, source locations and generated translation units.

* Register the timeframe argument diagnostic

Include only the stock-generated PF-E2095 definition and pin. Preserve all
prior catalog entry bytes and their existing order.

* Disambiguate diagnostic templates by argument kinds

Use recognized Pine types in declared type slots to resolve equally literal
diagnostic templates. Keep stable code order for other ties and preserve
qualifier identities, raw arguments and rendering. Pin the timeframe type
diagnostic and its named arguments with direct regression controls.

* Validate timeframe arguments using semantic types

Reject non-string timeframe arguments through the intrinsic signature before
C++ lowering, including helper parameters and boolean values. Preserve valid
string calls and exercise complete native controls at distinct optimization
levels. Declare the new diagnostic in the existing catalog delta fixture.

* fix(codegen): allocate function clone names against authored members

Keep generated state and callable clone identities distinct from authored
members and use the same allocated identities at declarations and calls.
Preserve noncolliding names and duplicate-state assertions.

* Use the generated timeframe type diagnostic presentation

Carry the generated argument-type entry and its pin into the member while
preserving all other catalog bytes and order. Use the grammatical message
and exact approved user presentation with the existing argument kinds.
Retain the same numeric refusal cases and qualifier controls.

* Locate helper argument expectations inside the builtin call

Use the argument occurrence within the call instead of an identically
named helper parameter. Keep the exact line and column assertions and
all source inputs, diagnostic identities and test rows unchanged.

* Resolve registered argument types and report their source starts

Carry registered namespace types through the semantic query used for written
helper calls while respecting lexical shadowing and version boundaries.
Reuse the existing expression-start locator for timeframe type refusals.

* fix(codegen): separate composed helper and lexical storage names

Allocate composed callable and persistent-storage identities outside reserved
helper families, and reserve all authored spellings before sibling-block
qualification. Keep declarations, calls and history consumers on the same
allocated identity. Exercise collision cases through the public pipeline.

* Preserve sizing string values across expressions and host settings

* Exercise v5 receiver shadowing through an imported library

* Preserve integer risk type boundary codes

* Strengthen sizing regression and reserve generated name

* Lower computed risk type arms at numeric boundary

* Convert sizing selection arms at host boundaries

* fix(codegen): preserve established typed method names

Keep raw typed-method names on the function channel when they collide with
authored data members. Continue allocating encoded names and collisions with
generated storage so method definitions, calls and state stay distinct.

* Assert the risk type conversion for reassigned sizing variables (#394)

Sizing constants keep their Pine string type for the string consumers this
change fixes, so a reassigned sizing variable reaches the risk host boundary
as a string and is converted to its integer code there. Keeping the integer
comparison would need integer storage for these variables, which the string
consumers cannot use. The test still requires the call to read t after its
write, never its initializer, and now also checks the code chosen for the
assigned value.
Bring the branch up to date with main after #405 merged. No conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant