Skip to content

[TS/JS] A spread call ...f() records qualifier <expr>, so a bare call resolves as an untyped receiver and finds nothing #3787

Closed

Description

@squid-protocol

What

In a spread argument or property, ...parseCaseValue(value) and { ...makeBig(i) }, the detector records the callee's qualifier as <expr>, as if the call were (expression).parseCaseValue(). The resolver treats <expr> as an untyped receiver, which only a method can answer. The same-file function parseCaseValue is a binding, reachable only by a bare call, so the pair resolves to none (external) and draws no edge.

The same happens to a qualified call behind a spread (...errorUtil.errToObj(message)): the qualifier should be errorUtil.

Evidence

  • Size: callgraph_triage.py typescript (callgraph_triage.py: bucket every missed and wrong call link into a ranked backlog #3774) on zod puts 51 reference edges in resolved_outside because of this: 40 ...f() and 11 ...ns.f().
  • explain_call.py on packages/bench/compile-vs-arktype.ts:parseArgs, callee parseCaseValue:
    parseCaseValue: none -- no definition this caller can reach (external)  qualifier '<expr>'
      packages/bench/compile-vs-arktype.ts:45 parseCaseValue owner=- shape=binding kind=function reach=bare same-file
    
  • Source: packages/bench/compile-vs-arktype.ts:72 is requestedCases.push(...parseCaseValue(value));, and packages/bench/memory/leaks.ts:71 is bigSchema.parse({ ...makeBig(i), n: "not-a-number" });.

Fix

In the TS/JS qualifier capture (calls_out_qualifiers), a ... spread operator before the callee isn't a member access. ...f() is a bare call (qualifier ""), and ...ns.f() has qualifier ns. Add extraction tests for both, then measure with callgraph_check.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginescope:infraCI, tooling, churn/factory, docs infrastructure

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions