-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-type-aliasTypeAlias and other type alias issuesTypeAlias and other type alias issues
Description
Bug Report
mypy errors on defining a variable to a python 3.9 dict whose type signature has been previously stored in a variable
To Reproduce
Using mypy bug.py --strict
Error stems from disallow untyped generics, I think
Block = dict[str, str]
def main() -> Block:
out = Block() # error: Need type annotation for "out" (hint: "out: Dict[<type>, <type>] = ...")
return out
if __name__ == "__main__":
main()
Expected Behavior
Mypy should be able to read the type information stored in Block
and read it as that type being init, as it can read the type information for a return signature
Actual Behavior
mypy raises a untyped generic error that out needs a type annotation:
error: Need type annotation for "out" (hint: "out: Dict[<type>, <type>] = ...")
Your Environment
- Mypy version used: 0.910
- Mypy command-line flags: --strict
- Mypy configuration options from
mypy.ini
(and other config files): none present. - Python version used: 3.9.6
- Operating system and version: Linux 5.10
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-type-aliasTypeAlias and other type alias issuesTypeAlias and other type alias issues