My function should analyze types.
Both when --warn-unreachable is enabled, and when checking typing.Union, and when checking types.UnionType, an error occurs.
code:
from types import UnionType
from typing import Any, Union
from typing_extensions import TypeForm
def f(t: TypeForm[Any]) -> Any:
if isinstance(t, Union):
pass
def g(t: TypeForm[Any]) -> Any:
if isinstance(t, UnionType):
pass
errors:
main.py:8: error: Argument 2 to "isinstance" has incompatible type "<typing special form>"; expected "_ClassInfo" [arg-type]
main.py:14: error: Statement is unreachable [unreachable]
Found 2 errors in 1 file (checked 1 source file)
in runtime, the behavior of both isinstance is equivalent.
My function should analyze types.
Both when --warn-unreachable is enabled, and when checking typing.Union, and when checking types.UnionType, an error occurs.
code:
errors:
in runtime, the behavior of both
isinstanceis equivalent.