Closed
Description
Bug description
The following code results in a false positive. (The type hints may be removed; however, the cast and dummy assignment may not).
"""Docstring."""
from typing import TypeVar
from typing import cast
T = TypeVar('T')
def ident(thing: T) -> T:
"""Return thing."""
return cast(T, thing)
_ = ident([])
dict(**ident({}))
Configuration
No response
Command used
pylint bug.py
Pylint output
************* Module bug
bug.py:15:7: E1134: Non-mapping value ident({}) is used in a mapping context (not-a-mapping)
Expected behavior
No error should be produced.
Pylint version
pylint 2.15.10
astroid 2.13.2
Python 3.10.9 (main, Dec 15 2022, 18:25:35) [Clang 14.0.0 (clang-1400.0.29.202)]
OS / Environment
macOS 13
Additional dependencies
No response