Skip to content

Preserve native Math identity and exact constants - #600

Open
CaelmBleidd wants to merge 2 commits into
caelmbleidd/ts-function-reference-typesfrom
caelmbleidd/ts-native-math-identity
Open

CaelmBleidd wants to merge 2 commits into
caelmbleidd/ts-function-reference-typesfrom
caelmbleidd/ts-native-math-identity

Conversation

@CaelmBleidd

@CaelmBleidd CaelmBleidd commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Module initializers and closures such as export const DEG_TO_RAD = Math.PI / 180 could stop before entering real class methods because the native Math global had no runtime object. Frontend local tables also include unbound global reads, which made const numeric = Math read an uninitialized register instead of the native global.

Load the SDK Math identity as an ordinary per-state object and initialize its eight readonly binary64 constants exactly once. Aliases share its identity and typeof is object. Genuine local, parameter, module, and import bindings retain priority. Native constant writes/deletes remain explicitly unsupported; this change does not add general property-descriptor semantics or approximate new Math APIs.

Depends on #559 for SDK/runtime reference contracts. This PR contains only the additional native Math identity change and its source regressions.

Validation: 11 focused tests pass, zero failures or skips: 6 new source/native-oracle regressions plus all 5 existing builtin-owner boundary tests. Strict TS main/test detekt reports zero issues. On exact parent d6e4629fc56279b7b6af57ca0b6703d131fe8f5c, the same module-initializer regression produces no analysis results; restoring the fix makes it pass. Full suites are left to CI. The real-corpus control and aggregate coverage impact will be checked on the combined experiment runtime.

CI on runtime-fix head 4e433cbd8 completed 1,781 TS tests with one failure and 138 skips: the existing missing-global prefix fixture still expected Math to be unsupported. All six new NativeMathIdentity tests passed. The test-only follow-up 7935d7b4c switches that negative fixture to the still-unmodeled JSON global and keeps every limitation-prefix assertion. No runtime code changed. This follow-up was not rerun locally while the frozen campaign held the shared lock; CI validates it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant