File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ class C(A, B): ...
6969 TODO: Don't consider callables always overlapping.
7070 TODO: Don't consider type variables with values always overlapping.
7171 """
72+ # Any overlaps with everything
73+ if isinstance (t , AnyType ) or isinstance (s , AnyType ):
74+ return True
75+
7276 # Since we are effectively working with the erased types, we only
7377 # need to handle occurrences of TypeVarType at the top level.
7478 if isinstance (t , TypeVarType ):
Original file line number Diff line number Diff line change 7777 reveal_type(x) # E: Revealed type is 'builtins.int'
7878[builtins fixtures/bool.pyi]
7979
80+ [case testAnyCanBeNone]
81+ from typing import Optional, Any
82+ x = None # type: Any
83+ if x is None:
84+ reveal_type(x) # E: Revealed type is 'builtins.None'
85+ else:
86+ reveal_type(x) # E: Revealed type is 'Any'
87+ [builtins fixtures/bool.pyi]
88+
8089[case testOrCases]
8190from typing import Optional
8291x = None # type: Optional[str]
You can’t perform that action at this time.
0 commit comments