codegen: Pine int is 64-bit — epoch-millisecond int arrays and out-of-int32 literal products (round 8 family U, latibonit15) - #123
Merged
Conversation
…conds is std::vector<int64_t>, and an int-literal product beyond int32 is a 64-bit literal (round 8 family U, latibonit15) latibonit15 execution-signals-confluence (six non-excellent lanes under baseline 6c1ec7f: NQ1@15 moderate 94.6, ES1 96.5, F 97.1, XAUUSD 99.8, EURUSD 99.8, AAPL +1) keeps its 1H level creation times in ``var int[] levelTimes = array.new_int()`` and expires a level when ``(time - existingTime) > 90 * 24 * 60 * 60 * 1000``. Generated as ``std::vector<int> levelTimes`` the ms stamp truncated on push, the element read into ``int existingTime`` again, and ``((((90 * 24) * 60) * 60) * 1000)`` wrapped to -813 934 592 in C++ int arithmetic -- so every nearby level "expired" and was replaced on day 1 where TradingView blocks the duplicate for three months (lab tv u-lati-levels-nq15 vs the engine, 2026-09-05: first divergence at the 2025-04-02 05:45Z hour, TV code=1102 blocked / engine 1012 expired+added; 2038 of 6385 hours then differ in level count, 744 in the added level, 1092 in the removal code; the confluence flips entries on and off because TradingView drops every over-equity confluence entry, family O). Two rules, both by the codegen's existing wide-int idiom (the epoch-ms builtins are already promoted to int64_t at member/local/parameter sites): 1. A Pine int array is wide -- TypeSpec element ``int64`` -> ``int64_t`` -- when it receives a wide value through array.push/unshift/set/insert/fill (functional or method form) or is built by array.new_int / array.new<int> / array.from from one (``_wide_int_array_names``, a fixpoint over the whole AST). The widened spec is applied wherever the name resolves (``_collection_spec_for_name``, the registration sites, the member declaration) and its constructors spell the same type (``_array_ctor_target_name`` at the declaration / first-bar init sites). An element read off a wide array (get/first/last/pop/shift/remove/max/min) carries the provenance, so ``existingTime = array.get(levelTimes, i)`` is ``int64_t``. A user method on ``array<int>`` still binds to it. 2. An int-literal-only ``+ - *`` tree whose exact value leaves int32 is folded in Python and emitted as ``static_cast<int64_t>(7776000000LL)``; the tree is wide for declaration typing. In-range trees are emitted exactly as before. Population effect (transpile of 4116 scrapper + corpus sources): 15 generated files change -- latibonit15 on its 9 lanes and jevondijefferson-big-breakout on 6 (its ``var array<int> times`` receives ``time``); every other script is byte-identical. tests/test_wide_int_arrays_and_literals.py pins both rules and the narrow-array control. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013m9vtaC12Wn76TRmknMMY9
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.
What
var int[] levelTimes = array.new_int()holdingtimestamps was emitted asstd::vector<int>(truncating epoch milliseconds) and90*24*60*60*1000was folded in C++int(wrapping to −813,934,592), so latibonit15's 3-month level expiry fired on day one. Now: an int array that receives a wide value (time/time_close/timestamp/wide callable) via push/unshift/set/insert/fill or built by new_int/new/from → elementint64(std::vector<int64_t>) at every resolution/registration/declaration/constructor site, element reads carry the provenance; an int-literal-only +−* tree beyond int32 is folded and emitted as a 64-bit literal (in-range trees byte-identical). Population transpile diff over 4116 sources: 15 generated files (latibonit ×9, jevondijefferson ×6 — trades byte-identical). +5 pin tests; full suite green.Gate
Composite with engine PR pineforge-engine
round9/candidate-p(2185c9f):pineforge-pr-gateexecutionpineforge-pr-gate-qwb9cPASS (score +6, hard 0), recorded for engine 2185c9f / codegen c80926f. latibonit NQ1@15 moderate → excellent, ES1@15 strong → excellent (with the engine side). Merged by fast-forward; promoted withlab promote --composite.🤖 Generated with Claude Code
https://claude.ai/code/session_01793pKdqw3UST3YdPVsdgpa