Bug Report
from dataclasses import dataclass
from typing import ClassVar, Final, reveal_type
class Bar: pass
@dataclass
class Foo:
cv: ClassVar[Final[dict[type[Bar], Foo]]] = {}
reveal_type(Foo.cv)
$ mypy test.py
test.py:10: note: Revealed type is "Any"
Success: no issues found in 1 source file
The correct type of Foo.cv is builtins.dict[type[Bar], Foo].
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.14&gist=2fad4ef5fded90ecaeb0f1d1e59d882a
Expected Behavior
reveal_type should report the correct type for the class variable.
Actual Behavior
reveal_type showed incorrect type (Any).
Your Environment
- Fedora 44
python3-mypy-1.18.2-4.fc44.noarch (reproducible with Mypy 2.3.1)
python3-3.14.6-1.fc44.x86_64
- No config files used
Bug Report
The correct type of
Foo.cvisbuiltins.dict[type[Bar], Foo].To Reproduce
https://mypy-play.net/?mypy=latest&python=3.14&gist=2fad4ef5fded90ecaeb0f1d1e59d882a
Expected Behavior
reveal_typeshould report the correct type for the class variable.Actual Behavior
reveal_typeshowed incorrect type (Any).Your Environment
python3-mypy-1.18.2-4.fc44.noarch(reproducible with Mypy 2.3.1)python3-3.14.6-1.fc44.x86_64