Skip to content

[TS] Evaluate instanceof against runtime constructor values - #464

Merged
CaelmBleidd merged 17 commits into
mainfrom
caelmbleidd/ts-457-runtime-instanceof
Oct 12, 2026
Merged

CaelmBleidd merged 17 commits into
mainfrom
caelmbleidd/ts-457-runtime-instanceof

Conversation

@CaelmBleidd

@CaelmBleidd CaelmBleidd commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

The instanceof interpreter preserves evaluated constructor identity through locals, conditional expressions, returned values and assertions. It compares declared runtime ancestry and reports "function" from typeof for represented constructor values.

Related to #457. Based on main at c47c6b4a34f15ab234d3d07a7b59ae640c2df512, using JacoDB bcad76ffd7. Current head: f175f2d47ab17424287dd47fa43086c2d4098788.

Load Object, Function and Array from the actual lib.es5.d.ts bundled with that JacoDB version. Keep their original members and signatures and preserve SDK declarations supplied by the caller. Cache converted declaration DTOs and create fresh scene-owned classes for each machine. Function and Array keep their dedicated runtime representations and are excluded from ordinary class-instance witnesses. Declarations enable prototype membership; executing SDK APIs still needs interpreter support or a model. Model bodies remain behind their dispatcher and domain guards.

Treat instance inputs as structural field maps. An unread constructor field, nested field, or generic argument no longer excludes the entire entrypoint. Check unsupported constructor-valued and unresolved generic initial fields when they are read; writes, deletions, and paths that do not use those initial values remain analyzable. Direct constructor-valued parameters and containers still require unsupported callable input witnesses.

Known non-callable right operands produce catchable JavaScript TypeError objects. Unknown constructor identities, prototype mutation and custom Symbol.hasInstance remain unsupported. Nominal ancestry is documented separately from structural field matching.

Local validation:

All four new regressions fail on the previous implementation: structural inputs, overwriting a constructor field before reading, preserving paths that skip the field, and retaining actual SDK members. Ordinary source behavior uses discoverProperties and invariants; direct checks cover unsupported paths and low-level contracts. Tests use the published JacoDB dependency without a composite-build override.

@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-457-runtime-instanceof branch from d6843cd to 9812a2b Compare October 3, 2026 03:46
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-422-string-value-equality branch from 7927e93 to 127ecb5 Compare October 3, 2026 05:21
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-457-runtime-instanceof branch from 9812a2b to 70847b1 Compare October 3, 2026 05:28
@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-422-string-value-equality branch from e5527a3 to 7217c2a Compare October 4, 2026 19:51
Base automatically changed from caelmbleidd/ts-422-string-value-equality to main October 5, 2026 12:37
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-457-runtime-instanceof branch from bab7963 to 161b3fd Compare October 12, 2026 11:13
@CaelmBleidd
CaelmBleidd merged commit a9b9ddb into main Oct 12, 2026
@CaelmBleidd
CaelmBleidd deleted the caelmbleidd/ts-457-runtime-instanceof branch October 12, 2026 13:53
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