Skip to content

[TS] Return function from typeof callable values - #459

Merged
CaelmBleidd merged 2 commits into
mainfrom
caelmbleidd/ts-429-typeof-function
Oct 3, 2026
Merged

CaelmBleidd merged 2 commits into
mainfrom
caelmbleidd/ts-429-typeof-function

Conversation

@CaelmBleidd

@CaelmBleidd CaelmBleidd commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Closes #429

Change

typeof now identifies concrete callable references represented by associatedFunction or an exact EtsFunctionType before checking string/object types. This also avoids the type-constraint null dereference on untyped method references.

Evidence

  • Source-level regressions use the existing TypeOf : TsMethodTestRunner and discoverProperties pattern. They cover an arrow, a function expression, a callable stored in a local and in an object field, a named function, and a symbolic boolean selecting between a callable and an ordinary object. Invariants reject unexpected results, and the conditional test requires both branches.
  • Local: :usvm-ts:test --tests org.usvm.samples.operators.TypeOf — 21 passed, 1 disabled. :usvm-ts:detektTest and git diff --check passed.
  • Negative control: with the TsExprResolver change removed, test typeOfArrow fails because the old typeof path throws a NullPointerException and produces no analysis result. Restoring the change makes it pass.
  • All seven CI checks passed on the updated head 7ad0b2a0c03a234ab49d653a3775d1568574a533 (including ci-ts and detekt).

Boundary

Function-typed input parameters are tracked separately in #462: TsInterpreter.getInitialState passes EtsFunctionType to EtsHierarchy.classesForType, which throws before typeof executes. The existing input-function test remains disabled with this precise reason. Imported functions are also outside the represented concrete callable cases.

@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-429-typeof-function branch from 7ad0b2a to c013112 Compare October 3, 2026 20:55
@CaelmBleidd
CaelmBleidd merged commit 7b9a88b into main Oct 3, 2026
7 checks passed
@CaelmBleidd
CaelmBleidd deleted the caelmbleidd/ts-429-typeof-function branch October 3, 2026 21:01
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] Return function from typeof callable values

1 participant