Bug Report
When using Final type hint in combination with dataclass(frozen=True), mypy displays an error. This error disappears either if frozen=True is removed or the type of Final is provided.
To Reproduce
from dataclasses import dataclass
from typing import Final
@dataclass
class Foo:
var: Final = "a"
@dataclass(frozen=True)
class Foo2:
var: Final = "a"
@dataclass(frozen=True)
class Foo3:
var: Final[str] = "a"
foo = Foo()
foo.var # OK
foo2 = Foo2()
foo2.var # ERROR: "Foo" not callable [operator]
foo3 = Foo3()
foo3.var # OK
Your Environment
- Mypy version used: 1.14.1
- Mypy command-line flags: mypy
script.py
- Mypy configuration options from
mypy.ini (and other config files): None
- Python version used: 3.10.11
Bug Report
When using
Finaltype hint in combination withdataclass(frozen=True),mypydisplays an error. This error disappears either iffrozen=Trueis removed or the type ofFinalis provided.To Reproduce
Your Environment
script.pymypy.ini(and other config files): None