Skip to content
Discussion options

You must be logged in to vote

The behavior is reproducible, and the descriptor setter is being checked. The widening comes from a second static inference path: an unannotated assignment through self.value1 is also recorded as an instance-member declaration for value1.

Pyright then combines the class-body declaration value1 = Descriptor() with the inferred float declaration from self.value1 = 1.1. Its evaluator documents that explicit declarations take precedence, while inferred declarations are combined into a union (declared types take precedence; inferred declarations are combined). The member-assignment path still invokes the descriptor protocol and caches the setter assignment (assignment path), but the inferred i…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@oddbury
Comment options

Answer selected by oddbury
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants