-
Notifications
You must be signed in to change notification settings - Fork 281
Closed
Labels
good first issueGood for newcomersGood for newcomersgoogleissues from googleissues from googletypechecking
Description
Describe the Bug
Reproducer:
from typing import reveal_type
def f(x: int | bool): # does not narrow
if type(x) is bool:
x = 42
reveal_type(x)
def g(x: int | None): # works OK
if x is None:
x = 42
reveal_type(x)
Output:
INFO revealed type: bool | int [reveal-type]
--> /tmp/foo.py:6:14
|
6 | reveal_type(x)
| ---
|
INFO revealed type: int [reveal-type]
--> /tmp/foo.py:12:14
|
12 | reveal_type(x)
| ---
|
INFO 0 errors
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersgoogleissues from googleissues from googletypechecking