Repository navigation
Fix descriptor semantics for initialized annotations - #4476
patrickswedish wants to merge 1 commit into
Conversation
|
This pull request has been imported. If you are a Meta employee, you can view this in D115325693. (Because this pull request was imported automatically, there will not be any future comments.) |
Merging this PR will not alter performance
Comparing Footnotes
|
This comment has been minimized.
This comment has been minimized.
a970a72 to
8bf7cab
Compare
This comment has been minimized.
This comment has been minimized.
7114dd4 to
448afb3
Compare
448afb3 to
1ee5a9f
Compare
This comment has been minimized.
This comment has been minimized.
Rebase the focused fix onto current main while preserving the descriptor-method forcing changes added upstream.
1ee5a9f to
57c9c39
Compare
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
yangdanny97
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
This pull request has been merged in 8387bfd. |
|
Thanks for reviewing and merging, @yangdanny97! Glad to contribute. |
Summary
__init__assignment while retaining annotation-only and method-only controlsRoot cause
DeclaredByAnnotationalready recordsinitialized_in_recognized_method, but descriptor detection did not consult that signal. An annotation whose type implements__get__was therefore treated as a class-installed descriptor even whenself.fieldwas initialized in__init__.The fix uses that signal only to skip descriptor construction for the annotated-and-method-initialized case. It intentionally leaves the field's existing initialization classification unchanged, avoiding unrelated class-visibility and constructor behavior changes.
Fixes #4471
Validation
cargo fmt --all -- --check— passedpython test.py --no-test --no-tensor-shapes --no-conformance --no-jsonschema— formatting passed; Rust lint was blocked locally because the Windows host has no MSVClink.exegit diff --check— passedAI agent disclosure: OpenAI Codex prepared this PR; the contributor reviewed and understands the changes.
Diff minimization and pre-flight validation performed with ZeroSlop™ CI — Ribbsaeter Systems.