-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
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 # OKYour 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