Repository navigation
fix(resolve): refuse unstable Python captured receivers - #403
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe Python resolver now leaves calls and method references through captured receivers unresolved when a later same-scope replacement makes the invocation-time receiver uncertain. The change adds receiver-scope regression tests and updates the related documentation. ChangesPython captured receiver resolution
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Captured Python calls with semicolon-separated receiver replacements can produce an incorrect graph edge. The change is mergeable with this limitation tracked for follow-up. 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai The semicolon-separated replacement limitation is tracked for follow-up. This change uses indexed lexical binding lines and preserves the separate-line boundary from #395, whose description records the multiple-statements-on-one-line limitation. The languages reference also states that boundary. Extending binding position tracking is outside this focused change. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 3 'same.line|one.line|multiple.statement|semicolon|receiver|lexical' site/src/content/docs/reference/languages.md
gh pr view 395 --repo bompus/codegraph --json body --jq '.body'Length of output: 8233
I withdraw this concern for ✏️ Learnings added — pending approval
You are interacting with an AI system. |
A Python closure can read a different receiver value when invoked than the value present at its definition. After
store = A(), defining a closure that callsstore.get(), then assigningstore = B(), the graph previously linked the closure toA.get.The resolver now leaves captured calls and method values unlinked when a later indexed replacement makes the invocation-time receiver uncertain. It preserves direct local reassignment, a single future initialization, bare annotations, and imports that add another submodule to the same package. This conservative rule can omit valid calls made before a later replacement. It does not track arbitrary writes through other closures or dynamic mutation.
This follows the lexical receiver work in #395. The README's About this fork Python receiver bullet and the languages reference describe the new boundary; the language inventory, upstream merge point and measured-result rows are unchanged.
Validation on Node 24:
self/cls, lambda defaults, generator iterable evaluation and captured method values.Collapsed receiver names and deferred lambda/generator scopes were fixed after the initial review. Focused regressions and the required checks verify those fixes; no further review round ran.