-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
astral-sh/ruff
#23001Labels
typing semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc
Milestone
Description
This should be an error: the constant is declared Final, but there is no binding:
CONSTANT: Final[int] # this should be an errorNote that we do allow separating the declaration and the binding of a Final symbol:
CONSTANT: Final[int] # this is allowed
CONSTANT = 1Also, even if we would disallow this particular pattern (it's not explicitly required by the spec), Final-annotations without a right-hand side can appear in (data)class definitions, for example:
class C:
CONSTANT: Final[int] # this is allowed
def __init__(self):
self.CONSTANT = 1We have existing tests for this here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
typing semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc