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
investigate: object-rest-param bindings never get a type-annotation-based typeMap seed #2080
Deferred from PR #1997 review (follow-up to a Greptile finding fixed in that PR).
Context: Greptile flagged that applyChaDispatchPostPass (src/domain/graph/builder/incremental.ts) used coerceTypeMap instead of buildIncrementalTypeMap (which also runs seedRestParamTypeMap), an inconsistency now fixed in PR #1997.
While verifying that fix, traced through seedRestParamTypeMap's actual mechanism and collectParamBindings's extraction (src/extractors/javascript.ts:2915) and found the seeded value is always the call-site argument's variable name (paramBindings[].argName, populated only from a plain identifier argument node), not a resolved class/interface type name. emitChaDispatchForCall (incremental.ts) does a single typeMap.get(call.receiver) lookup and passes .type directly to resolveChaTargets, with no second hop to chase a variable name to its actual type.
Net effect: for a rest-destructured receiver typed against an interface (e.g. function f({ ...rest }: IWorker) { rest.doWork() }), CHA-style interface dispatch through rest likely still won't resolve even after the #1997 fix, because the rest-param path was never designed to feed a type name into that lookup — it exists for the Phase 8.3f value-chase (#1336: eerest.e4() resolving through a var obj = { e4 }-style chain), a different mechanism than typed-receiver CHA dispatch.
Worth investigating whether the extractor should seed a genuine type-annotation-based typeMap entry for object-rest-param bindings (mirroring how a plain typed parameter like function dispatch(worker: IWorker) gets typeMap['worker'] = { type: 'IWorker' } directly), so CHA/interface dispatch through a typed rest receiver actually works — or whether this is intentionally out of scope for the object-rest-param feature.
Activity
fix(incremental): port CHA/RTA dispatch, points-to, and dynamic-sink …
fix(extractors): don't seed full type onto rest when a sibling is des…
fix(extractors): seed object-rest-param type annotations for CHA disp…