fix(resolve): type Python locals built through a module and resolve calls through their fields
Two gaps found while tracing why Flask's tests had no call edge for bp.add_app_template_test(...) and app.config.from_mapping(...) (survey §6.3).
Gap 1. The Python local-type pattern required the constructor to start with a capital letter, so bp = pkg.Blueprint(), pkg.core.Blueprint(), c.Blueprint() (aliased module) and core.Blueprint() (module imported by name) left bp untyped. The pattern now accepts a lowercase module prefix. The type is still resolved against the file's imports, so factory.Blueprint() on a plain local names no project class (tested).
Gap 2. A chain through a typed local (app.config.from_mapping()) was never followed; self.config.from_mapping() was. python_self_field_call is split so the field logic takes an owner class, and a new python_local_field_call supplies the owner from the local's declared type. Unknown local types, unassigned fields and same-named methods of unrelated classes still resolve to nothing (tested).
Effect, installed build before vs this branch (Python call edges): Flask 856 to 954 (+98, 94 from tests), requests 607 to 710 (+103, 102 from tests), none removed on either. Unresolved unknown-receiver Python call refs: Flask 1,677 to 1,532, requests 991 to 865. A 30-edge sample (15 per repository, every Nth new edge) was all correct on reading each receiver's declaration; two rest on explicit annotations (connection: HTTPAdapter, app: App). The "before" build is 1.6.2+d0fe0bdf, which predates #454 and #455; neither touches Python receivers. No compiler oracle exists for Python here, so the precision check is a sample, not a measurement.
Checks. New __tests__/python-module-qualified-receiver.test.ts: 11 tests, 7 fail on the unfixed kernel and all pass with it (the 4 negative cases pass on both). Full suite: 689 files, 8,789 tests passed, 39 skipped. cargo clippy -D warnings clean through build:kernel.
Not done. Other causes of unresolved test receivers in Flask (pytest fixtures, client = app.test_client() return types, flask.<fn>()) are untouched.
Summary by cubic
Fixes two gaps in Python local type inference so calls through module-qualified constructors and their fields resolve like class-imported ones already did.
bp = pkg.Blueprint(),c.Blueprint(), andcore.Blueprint()now type the local, just likebp = Blueprint()from a name import; the type is still resolved against the file's imports, sofactory.Blueprint()on another local object still resolves to nothing.- A parameter that shadows the imported module (e.g.
def t(pkg):afterimport pkg) blocks both typing and field-chain resolution through that name. app.config.from_mapping()now resolves on the class the local's declared type holds, matching the existingself.config.from_mapping()handling; unknown local types, unassigned fields, and same-named methods of unrelated classes still resolve to nothing.- Adds 98 call edges to Flask and 103 to requests (almost all in tests); a 30-edge manual sample (15 per repository) was all correct, with two resting on explicit annotations.
Summary by CodeRabbit
- Bug Fixes
- Python calls through dotted, aliased, or re-exported module paths now resolve constructors to the imported class.
- Calls to methods through fields of typed local objects now resolve to the appropriate class methods, including inherited methods.
- Calls with unknown, unrelated, or unassigned receiver types remain unresolved. These changes add accurate call relationships in projects such as Flask and requests.