Skip to content

fix(python): gate same-class-method resolution on localBound shadow guard - #86

Merged
dejo1307 merged 1 commit into
mainfrom
fix/python-shadow-guard-order
Jul 10, 2026
Merged

fix(python): gate same-class-method resolution on localBound shadow guard#86
dejo1307 merged 1 commit into
mainfrom
fix/python-shadow-guard-order

Conversation

@GertL

@GertL GertL commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • resolveCall and valueRefTarget in the Python extractor checked currentMethods() (same-class method/property match) before the localBound shadow guard, so the guard only protected the same-module fallback branch.
  • This produced false RelCalls/value-ref edges for the extremely common self.x = x constructor idiom whenever the class also defines a property/method literally named x (e.g. a SQLAlchemy synonym property) — the RHS x is the parameter, not a self-reference.
  • Moved the localBound check to run first in both functions, so it gates every branch, not just the same-module fallback.

Verification

  • Added TestAST_ConstructorParamShadowsSynonymProperty, modeled on a real false positive found in Apache Airflow's DagRun.__init__ / state synonym property.
  • Confirmed against the actual Airflow checkout, both via direct extractor invocation and via enola --generate: pre-fix produces a false calls -> DagRun.state edge from DagRun.__init__; post-fix it's gone, with the correct real edges (is_arg_set, utcnow, new_dagrun_trace_carrier) unaffected.
  • go test ./..., go vet, gofmt all clean.

@dejo1307
dejo1307 merged commit 4e5b061 into main Jul 10, 2026
4 checks passed
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.

2 participants