-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder
Description
Bug Report
This may be a duplicate but I couldn't find any.
See the title for a short description or the short reproduction attached.
To Reproduce
a: object
b: tuple[type[int], ...]
if isinstance(a, b):
reveal_type(a)
Expected Behavior
main.py:5: note: Revealed type is "builtins.int"
Success: no issues found in 1 source file
Actual Behavior
main.py:5: note: Revealed type is "builtins.object"
Success: no issues found in 1 source file
This works, however:
a: object
b: tuple[type[int]]
if isinstance(a, b):
reveal_type(a)
Your Environment
https://mypy-play.net/?mypy=latest&python=3.11&gist=050eb94523510217a3bf91e9977539d0
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder