Files
codegraph/__tests__
Eric MinishandClaude Opus 5.5 e043efbc84 fix(resolution): a call through a class name reaches that class, not one whose name contains it (#1935)
A call through a class name, `Logger.log()`, or through a receiver named
after one, `logger.log()`, now binds to that class itself: its own
method, else the nearest one a declared supertype has. Before, the
method was any one in the class's file whose qualified name contained
the class's name, so a `FileLogger` declared first took every
`Logger.log()`, and Kotlin's `Foo.create()` went to `FooBar`'s.

Reworked from the exact-owner rule alone, which lost inherited methods
(Django's `form.is_valid()` on `Form(BaseForm)`, Alamofire's protocol
methods). Also in this change:

- A class declared inside a function is named only there: a call from
  anywhere else no longer reaches a class a test declares in its body,
  through the class name, the receiver's name, or the method-name
  fallback. Those methods were never in the running, and the one method
  such a filter leaves is still only a guess by the receiver's name.
- Production code never names a test suite's class, as the method-name
  fallback already held: `manager.check()` in Django's
  `Model._check_managers` is no test app's `Manager` model.
- A Python base built by a class's factory, Django's
  `class Manager(BaseManager.from_queryset(QuerySet))`, names that class
  as the supertype, besides the factory's arguments.

A/B against main with fresh indexes, every changed edge triaged. Django:
67 links added (model instances reaching `Model.save`, inherited lookups
and expressions), 40 removed (links into test-local classes from outside
their function, and one polymorphic manager call), 263 retargeted:
about 170 to the right class (`user.has_perm` to `PermissionsMixin`
rather than `AnonymousUser`, `parser.parse` to the template `Parser`
rather than `MultiPartParser`, `field.get_lookup` to
`RegisterLookupMixin`), about 90 from one guess to another, and about
20 worse, where a receiver named after a model holds something else
(`session.save()` on a session store now guesses the `Session` model).
flask: one fix (`app.get` to `Scaffold.get`), 3 wrong links removed.
Alamofire: one fix and 3 protocol-typed locals that now guess the
`Adapter` class. zod, excalidraw and spring-petclinic: higher
confidence on the same targets. gin, cobra, express, eShopOnWeb and
jekyll are byte-identical. Full suite on the merged tree: 7,908 passed,
0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 19:55:52 +00:00
..