[TS] Return function from typeof callable values - #459
Merged
Merged
Conversation
CaelmBleidd
marked this pull request as ready for review
October 2, 2026 22:12
CaelmBleidd
force-pushed
the
caelmbleidd/ts-429-typeof-function
branch
from
October 3, 2026 20:55
7ad0b2a to
c013112
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #429
Change
typeofnow identifies concrete callable references represented byassociatedFunctionor an exactEtsFunctionTypebefore checking string/object types. This also avoids the type-constraint null dereference on untyped method references.Evidence
TypeOf : TsMethodTestRunneranddiscoverPropertiespattern. 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.:usvm-ts:test --tests org.usvm.samples.operators.TypeOf— 21 passed, 1 disabled.:usvm-ts:detektTestandgit diff --checkpassed.TsExprResolverchange removed,test typeOfArrowfails because the oldtypeofpath throws aNullPointerExceptionand produces no analysis result. Restoring the change makes it pass.7ad0b2a0c03a234ab49d653a3775d1568574a533(includingci-tsanddetekt).Boundary
Function-typed input parameters are tracked separately in #462:
TsInterpreter.getInitialStatepassesEtsFunctionTypetoEtsHierarchy.classesForType, which throws beforetypeofexecutes. The existing input-function test remains disabled with this precise reason. Imported functions are also outside the represented concrete callable cases.