Closed
Description
We are using a type definition that looks like this for returning dicts that should be JSON serializable:
Serializable = Dict[ # type: ignore
str, Union[
'Serializable', List['Serializable'], Tuple['Serializable'], float, str,
datetime.datetime, datetime.time]]
Without the new semantic analyzer this passes and gives errors for dicts with incorrectly typed values one level down.
However with the new semantic analyzer this breaks on both the definition of the type:
error: Cannot resolve name "Serializable" (possible cyclic definition)
And on imports of the type in other modules:
error: Module '...serialize' has no attribute 'Serializable'
This is when using stable mypy from PyPI (mypy 0.711
) with mypy --new-semantic-analyzer .
and the following settings:
[mypy]
ignore_missing_imports = True
strict_optional = True
no_implicit_optional = True
check_untyped_defs = True
disallow_incomplete_defs = True
plugins = sqlmypy
I am aware that recursive types are not yet supported, but I still thought it was worth reporting this as it's a feature regression.
Metadata
Metadata
Assignees
Labels
No labels