-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed as not planned
Labels
as designedNot a bug, working as intendedNot a bug, working as intendedbugSomething isn't workingSomething isn't working
Description
Pyright doesn't allow the construction Final[ClassVar[T]]
, typing.ClassVar
states:
Changed in version 3.13: ClassVar can now be nested in Final and vice versa.
from typing import ClassVar, Final
class A:
var: ClassVar[str] = 'a'
class B(A):
var: Final[ClassVar[str]] = 'b'
# "ClassVar" is not allowed in this context Pylance(reportInvalidTypeForm)
There was a previous report #7959 specific to dataclasses from before the release of 3.13. I'm not sure where this restriction to dataclasses comes from as the typing spec doesn't mention this in 3.12.
Running Pylance in VS Code. Version: 2025.5.1
Metadata
Metadata
Assignees
Labels
as designedNot a bug, working as intendedNot a bug, working as intendedbugSomething isn't workingSomething isn't working