Skip to content

Preserve extracted native Object.assign identity - #609

Open
CaelmBleidd wants to merge 1 commit into
caelmbleidd/ts-null-array-boundaryfrom
caelmbleidd/ts-native-object-assign-identity
Open

CaelmBleidd wants to merge 1 commit into
caelmbleidd/ts-null-array-boundaryfrom
caelmbleidd/ts-native-object-assign-identity

Conversation

@CaelmBleidd

Copy link
Copy Markdown
Member

Bundled JavaScript such as Vest stores Object.assign in a module variable (var assign_default = Object.assign) and calls it later. The method-property capture previously recognized only an immediately matching receiver call; extraction could become a mixed-kind value and stop at the correct function-field runtime-sort guard.

Give the exact native SDK Object.assign property a stable callable identity even without an immediate call. Retain its native owner/name for later unbound calls while each invocation keeps its own argument/result types and passes through the ordinary native mutation/nullish-target boundary. Captured native functions retain function typeof and can be recovered from boxed storage. The runtime-sort guard is unchanged.

Reuse the existing written/deleted property metadata so a replacement or deletion takes precedence on a later property read. Already extracted original functions retain their native target after either mutation. Project/source objects named Object keep their own method behavior. This PR does not implement Object.assign property copying; that remains the selected model/residual-call policy.

Depends on #589 for nullish native Object targets, which in turn depends on #559. This PR contains one additional callable-identity commit.

Validation: 18 focused tests pass with zero failures or skips (5 new source/native-oracle tests, 8 nullable Object-boundary tests, 5 builtin-owner tests). Strict TS main/test lint reports zero issues. Removing only the new native capture entry point makes the source alias/function-identity check return 0 instead of 1; restoring it passes. This discriminates lost native identity without claiming that this focused fixture reproduces the original corpus sort-guard exception. A separate method-bearing object-literal shadow fixture stopped before the subject operation; its exact source/hash and failed trace are preserved as a separate finding, with root cause unverified. The shadow regression here uses the existing supported declared-source-class pattern and retains the same native oracle result. Another preserved fixture exposes deferred module initialization when a module original is first read only after replacing the native property; the retention tests explicitly read the original into a local before mutation to isolate callable identity. Eager module side-effect semantics are outside this change. Full suites are left to CI; real corpus impact is checked on the combined runtime.

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