Skip to content

[TS] Construct project instances from runtime constructor values - #466

Merged
CaelmBleidd merged 9 commits into
mainfrom
caelmbleidd/ts-465-runtime-new
Oct 12, 2026
Merged

CaelmBleidd merged 9 commits into
mainfrom
caelmbleidd/ts-465-runtime-new

Conversation

@CaelmBleidd

@CaelmBleidd CaelmBleidd commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Dynamic new consumes the evaluated constructor value and allocates the exact selected project class before the existing constructor call. Conditional and returned constructors, local aliases, and binding changes during argument evaluation preserve the captured identity and execute the selected constructor exactly once.

Closes #465. Based on main at a9b9ddb77a12c19d8552219b6cdcb188b31746aa, which includes #464. Uses JacoDB bcad76ffd7. Current head: d2ee18ad938ca581046f50d83c7aee75addf8d46.

Use the allocated runtime class to choose storage for ambiguous common-name fields, including computed property access through any. Deduplicate inherited declarations before choosing a field. Preserve property presence, deletion and write tracking from #458.

Keep mixed-kind wrappers intact when adding an undeclared own field: their address storage is not the payload's runtime kind. Propagate an aborted field-write step through named and computed writes so incompatible declared-field writes retain explicit unsupported outcomes instead of disappearing during an invalid step continuation. Source regressions cover numbers, booleans, strings, functions, class instances, arrays, null and undefined, along with aliases and incompatible alternatives.

Reuse the shared constructor validation instead of duplicating resolveNonConstructorNew. The shared check distinguishes new's [[Construct]] requirement from instanceof's Symbol.hasInstance protocol. An ordinary object with that symbol still throws TypeError when used with new. Other known non-constructable values, including modeled computed strings, produce catchable JavaScript TypeError objects.

Unresolved constructor identities and SDK constructor execution remain explicitly unsupported. Writes that change a declared field's runtime sort remain unsupported, including incompatible union alternatives; #467 tracks broader support. The merged #464 loads Object, Function and Array declarations from the TypeScript library bundled in JacoDB. Instance inputs are treated as structural field maps; unsupported initial constructor fields are checked when read, leaving unrelated and overwritten fields analyzable.

Local validation:

The boxed primitive write and stopped-step regressions fail before their fixes and pass afterward. Ordinary supported behavior uses discoverProperties and invariants; direct checks cover unsupported paths, exception details, completion and generated replay cases. Tests use the published JacoDB dependency without a composite-build override.

The current head has the same Git tree (6c3b65896741f888b9259b2ab97cce6fd2ffa248) as the validated 52e4ea0d39830cd0db8d3030058de0af81d2a694. All nine child patches are unchanged after rebasing onto the squash merge of #464.

@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-465-runtime-new branch from 787814f to 1e15cb5 Compare October 3, 2026 03:54
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-457-runtime-instanceof branch from 9812a2b to 70847b1 Compare October 3, 2026 05:28
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-465-runtime-new branch 2 times, most recently from ac1876f to e3392c8 Compare October 3, 2026 05:54
@CaelmBleidd
CaelmBleidd marked this pull request as ready for review October 3, 2026 06:44
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-457-runtime-instanceof branch from 887e7ba to bab7963 Compare October 3, 2026 22:33
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-465-runtime-new branch from e3392c8 to acb1283 Compare October 3, 2026 22:33
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-465-runtime-new branch from acb1283 to 50a9fe5 Compare October 12, 2026 11:13
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-457-runtime-instanceof branch from bab7963 to 161b3fd Compare October 12, 2026 11:13
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-465-runtime-new branch 2 times, most recently from 2d23276 to 52e4ea0 Compare October 12, 2026 13:33
Base automatically changed from caelmbleidd/ts-457-runtime-instanceof to main October 12, 2026 13:53
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-465-runtime-new branch from 52e4ea0 to d2ee18a Compare October 12, 2026 13:57
@CaelmBleidd
CaelmBleidd merged commit f9aa3a3 into main Oct 12, 2026
@CaelmBleidd
CaelmBleidd deleted the caelmbleidd/ts-465-runtime-new branch October 12, 2026 13:58
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.

[TS] Construct project class instances from runtime constructor values

1 participant