Files
codegraph/__tests__
danusha2345andClaude Opus 5.5 7cceba52b0 fix(resolution): library calls on untyped Python, Scala and Java values stay unlinked
Root cause: when nothing types a call's receiver, matchMethodCall's last
strategy links `recv.m()` to the one project method named `m` (0.7), or to
the best receiver-word match among several. A standard-library call on a
plain value - `options.setdefault(...)` on a dict, `m.getOrElse(...)` on an
Option, `data.put(...)` on a map in a `var` - then linked to an unrelated
project method of that name. Go, Rust, Kotlin, C#, VB.NET and Dart already
keep such a guess only when the receiver names the method's owner
(stdMethodNames); Python, Scala and Java had no list.

Fix (contributor): Python, Scala and Java standard-library method lists in
stdMethodNames. Ours: the PR also exempted a receiver named `cls` from the
rule; both extractors already strip `cls.` from Python calls, so it never
applied there, while in C#, Dart, Rust and VB.NET it let
`var cls = Make(); cls.ToString()` link to an unrelated Money.ToString.
Removed, with a C# test case. CHANGELOG bullet rewritten and moved next to
the Python built-in method bullets.

Validation: library-method-calls.test.ts: 3 of its 5 cases fail on main
(Python build, Scala go, Java untyped), all 5 pass; the C# case fails when
`cls` is put back. Kernel A/B against main 0174f804, 11 repos: 0 added,
0 retargeted, 540 removed. Python: flask 12, netbox 2, django 140, fastapi 0,
all wrong (list/dict/file/re-match calls landing on ListMixin, QueryDict,
HttpRequest, AnonymousUser, _AppCtxGlobals). Java: Minestom 20, spring-ai 86,
all wrong (Map put/computeIfAbsent, reactor Context put, stream(), enum
valueOf). Scala: playframework 98 (4 of them Java), scalachess 31,
http4s 151; 267 wrong, 13 right links lost where a project type has
collection-like methods and the receiver is not named after it (scalachess
Board.put/replace through for-comprehension binds, ByColor through
`type Pockets`; http4s Headers.put; Play Form.fold, Router.orElse). gin and
serilog byte-identical. CPU on playframework, median of 3 interleaved:
71.7 s main, 71.1 s branch. Also settles the Holder.LOOKUP.get and
Mode.ON.equals cases of PR 1949.

Original PR #1947 by @danusha2345.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 22:57:59 +00:00
..