Closed
Description
Example from #5485 works with mypy 0.902
from dataclasses import dataclass
from typing import Callable
@dataclass
class Repro:
fn: Callable[[int], str]
r = Repro(fn=repr)
assert "1" == r.fn(1)
but let's change the dataclass to a frozen one
from dataclasses import dataclass
from typing import Callable
@dataclass(frozen=True)
class Repro:
fn: Callable[[int], str]
r = Repro(fn=repr)
assert "1" == r.fn(1)
then
$ mypy t.py
t.py:9: error: Invalid self argument "Repro" to attribute function "fn" with type "Callable[[int], str]"
t.py:9: error: "str" not callable
Found 2 errors in 1 file (checked 1 source file)