Conversation
|
Hi @dantrapp! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
@kinto0 has imported this pull request. If you are a Meta employee, you can view this in D119740446. (Because this pull request was imported automatically, there will not be any future comments.) |
Summary
Workspace symbol search misses attributes initialized in method bodies, including
self._private_member = 1from #4688. The existing search already finds_private_method. This change adds receiver-attribute assignments to the cached flat symbol table, returning the attribute's name location with its enclosing class as the container.The collector handles ordinary and annotated assignments, chained assignments, and unpacking. It excludes function locals, unrelated object targets, and syntactically marked static methods, and resets receiver tracking at nested function/class boundaries. Auto-imports still use the unchanged export table.
The collector remains syntax-based: it recognizes
@staticmethodand qualified.staticmethoddecorators, but does not resolve decorator aliases or track receiver rebinding.Fixes #4688.
Test Plan
9153364) reproduces the failure: the method control passes, while the instance-attribute test returns zero matches and fails.cargo test -p pyrefly --lib workspace_symbol: 16 passed, including workspace-symbol protocol tests and lightweight tests for bothRequire::EverythingandRequire::Indexing.cargo test -p pyrefly --lib export::: 44 passed, including assignment forms, receiver scope, and static-method exclusions.cargo test -p pyrefly --lib test::lsp::completion::: 142 passed.python3 test.py --no-test --no-tensor-shapes --no-conformance --no-jsonschema: passed.cargo build -p pyrefly: passed; the executable reportspyrefly 1.3.0-dev.4.Local validation used Rust 1.96.0. Unrelated formatter changes to existing imports in
test/pydantic/util.rsandtest/suppression.rswere excluded from this PR. The full cross-platform suite is left to CI.AI assistance: OpenAI Codex performed the investigation, implementation, and test execution.