You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[TS] Evaluate instanceof against the runtime constructor value #457
Runtime instanceof uses evaluated constructor identity and nominal ancestry, with catchable TypeError for represented non-callable RHS values and explicit unsupported custom/prototype cases. Implementation: usvm #464.
Validation: All 24 RuntimeInstanceofTest regressions passed, including source-level outcomes and Node replay.
Original report and acceptance context, retained for traceability
Problem
The current instanceof evaluator uses the static checkType from EtsIR. For a dynamic right-hand side, that type does not identify which constructor object the program actually selected. JacoDB PR #395 therefore marks dynamic checks unsupported instead of reporting a possibly false Boolean.
Minimal TypeScript example
classA{}classB{}exportfunctioncheck(useA: boolean): boolean{constctor=useA ? A : B;returnnewA()instanceofctor;}
Node.js returns true for check(true) and false for check(false). The ctor expression must be evaluated once; the membership check must use that runtime value, not its static union type.
Expected support
Use the right-hand constructor value and the left-hand object's prototype chain for the supported class-constructor model. Preserve JavaScript behavior for a non-callable RHS (TypeError) where that value is representable. If custom Symbol.hasInstance is outside the current model, report that case as unsupported explicitly.
Acceptance criteria
A focused symbolic test obtains both outcomes with the same static RHS type and distinguishes unsupported from failure.
Generated inputs and results replay in Node.js.
Direct value instanceof A remains covered and correct.
Dependencies: JacoDB #390 (RHS evaluation) and UnitTestBot/jacodb#396 (declared class runtime values). Implement this as a separate USVM PR.
Activity