File tree 2 files changed +13
-0
lines changed 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): ...
69
69
TODO: Don't consider callables always overlapping.
70
70
TODO: Don't consider type variables with values always overlapping.
71
71
"""
72
+ # Any overlaps with everything
73
+ if isinstance (t , AnyType ) or isinstance (s , AnyType ):
74
+ return True
75
+
72
76
# Since we are effectively working with the erased types, we only
73
77
# need to handle occurrences of TypeVarType at the top level.
74
78
if isinstance (t , TypeVarType ):
Original file line number Diff line number Diff line change 77
77
reveal_type(x) # E: Revealed type is 'builtins.int'
78
78
[builtins fixtures/bool.pyi]
79
79
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
+
80
89
[case testOrCases]
81
90
from typing import Optional
82
91
x = None # type: Optional[str]
You can’t perform that action at this time.
0 commit comments