-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
Description
Bug Report
A typing.ClassVar cannot be overridden with typing.Final.
main.py:7: error: Cannot override class variable (previously declared on base class "Base") with instance variable [misc]
Found 1 error in 1 file (checked 1 source file)To Reproduce
import typing
class Base:
value : typing.ClassVar[str]
class Derived(Base):
value : typing.Final[str] = 'derived'https://mypy-play.net/?mypy=latest&python=3.12&flags=verbose&gist=03819c6e8c7b6fb53baebe094faed123
Expected Behavior
I though using a typing.Final annotation would imply typing.ClassVar.
Actual Behavior
It seems not allowed to override a ClassVar with a Final.
Your Environment
See reproducer.