Skip to content

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

Open
CaelmBleidd wants to merge 20 commits into
mainfrom
caelmbleidd/ts-457-runtime-instanceof
Open

CaelmBleidd wants to merge 20 commits into
mainfrom
caelmbleidd/ts-457-runtime-instanceof

Conversation

@CaelmBleidd

@CaelmBleidd CaelmBleidd commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Runtime constructor values now retain their project-class identity through locals, returned values and TypeScript assertions. instanceof evaluates the actual right-hand constructor and the left-hand object's declared ancestry; represented constructor values also return "function" from typeof.

Related to #457. This PR is stacked on #455 and requires the new IR from JacoDB #399. The repository's published JacoDB dependency pin is unchanged.

  • Handle direct and conditional constructors, inherited checks, primitive and nullish left operands, and constructor-valued left operands against project classes.
  • Produce a terminal JavaScript TypeError object for a known non-callable right operand.
  • Report unknown constructor identity, computed static members that may implement Symbol.hasInstance, and constructor-valued entrypoint inputs as explicit unsupported outcomes. Inspect nested types and inherited fields conservatively; superclass generic specialization remains limited by JacoDB [TS PBT] Search bounded generator choices while preserving dependent input structure #400.
  • Check ordinary supported source behavior with discoverProperties and invariants. Retain the direct machine API for unsupported outcomes, exception objects, stop reasons and generated Node replay cases.
  • The concrete inherited-number input test checks only that the constructor-input guard allows the method. It does not establish witness reconstruction: TsTestResolver currently rejects an unresolved inherited field sort for that input.

Current head: bab79630bbf10cb08559ce1410cf69c1e3c2601e. Parent: #455 at e5527a3b67f476045aebea61a66bdc6e93c7b965. The production patch is unchanged by the test-style update and rebase.

Final combined stack at #466 acb1283d458d979a775dee8818d7ec5d1a29ba0f: 20 RuntimeInstanceofTest, 12 RuntimeNewTest and 6 TsStringEqualityTest cases passed, with no skips, failures or errors. :usvm-ts:detektTest and git diff --check passed. These local checks used the frozen JacoDB #399 commit b5e10a1a0c5d279492c373caf907f6387fff998f through -PuseLocalJacodb=/private/tmp/jacodb-ts-398-build.

Prototype mutation, unknown/function-object identities and custom Symbol.hasInstance remain outside the supported model. Catching the terminal TypeError inside the analyzed program requires the separate catch-routing change. CI with the older JacoDB artifact cannot validate the new IR dependency.

Implement supported string equality cases and preserve explicit unsupported outcomes for unbacked symbolic witnesses. Reuse shared Node replay tests.
@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
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