Closed
Description
Bug Report
When a decorator factory function is used in a dict literal, type inference fails. Adding explicit type fixes the issue but it's rather inconvenient. This bug seems to be introduced in mypy==1.6.0
since versions prior have no such issue.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.12&gist=f4e28d815f2832367905e3f4628b024a
https://gist.github.com/mypy-play/f4e28d815f2832367905e3f4628b024a
Expected Behavior
Mypy should infer the type correctly and no errors should be reported.
Actual Behavior
main.py:13: error: Dict entry 0 has incompatible type "str": "Callable[[F], F]"; expected "str": "Callable[[object], object]" [dict-item]
main.py:13: error: Dict entry 1 has incompatible type "str": "Callable[[F], F]"; expected "str": "Callable[[object], object]" [dict-item]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 1.8
- Python version used: 3.12