Skip to content

fix(resolution): literal-receiver builtins and nested locals stop fabricating call edges - #1317

Merged
colbymchenry merged 1 commit into
mainfrom
fix/1230-py-literal-nested
Jul 16, 2026
Merged

fix(resolution): literal-receiver builtins and nested locals stop fabricating call edges#1317
colbymchenry merged 1 commit into
mainfrom
fix/1230-py-literal-nested

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Fixes #1230.

Both stacked failures from the report, fixed independently (your "OR" turned into an "AND" — each defect can fire alone):

  1. Literal receivers (extraction): a member call on a literal — ", ".join(...), "x".toUpperCase(), 5.times, [].concat(...), across grammars — now emits no call ref. A literal's methods are builtins, never project symbols; previously the receiver was dropped and the bare name could exact-match any same-named project function. This is your literalReceiverTypes suggestion, implemented once in the shared extractor rather than per-language, so it can't drift.

  2. Nested-local reachability (resolution): your scope argument, applied at the exact-match strategy — a candidate nested inside a same-file function container (detected via its qualified name, e.g. format_fields::join) only resolves from refs inside that container's line range. Class members, top-level symbols, and C++ namespace-prefixed names are structurally exempt.

Verification

  • The issue's repro is pinned as a regression test: join has exactly one caller (format_fields); report_missing has zero project callees.
  • Real-repo before/after: psf/requests byte-identical (813 calls edges — no collateral); excalidraw −27 edges, which by construction can only be literal-receiver refs (the get/update/close commonality you predicted).
  • Full suite: 145 files, 2440 passed.

🤖 Generated with Claude Code

…ricating call edges

", ".join(sorted(x)) resolved by bare name to a project function named
join — one nested inside a DIFFERENT function, so scope alone rules the
edge out. Both defects from #1230, fixed independently:

1. Extraction: a member call on a LITERAL receiver (string, number,
   collection, regex — across grammars) emits no call ref at all. A
   literal's methods are the language's builtins, never project
   symbols; the bare-name fallback let them exact-match any same-named
   project function. Silent miss, never a wrong edge.

2. Resolution: matchByExactName filters out candidates nested inside a
   same-file FUNCTION container unless the ref originates within that
   container's line range. Class members (parent is a class-like node),
   top-level symbols, and C++ namespace prefixes (no parent node) are
   untouched.

requests re-index: byte-identical (813 calls edges). excalidraw: -27
edges, all literal-receiver refs by construction. The issue's repro is
pinned: join has exactly one caller (format_fields), report_missing
has zero project callees.

Fixes #1230

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

[python] matching built-ins

1 participant