@@ -21,22 +21,22 @@ else:
21
21
if x and not x:
22
22
reveal_type(x) # revealed: Never
23
23
else :
24
- reveal_type(x) # revealed: Literal[0, "", b" ", -1, "foo ", b"bar"] | bool | None | tuple[()]
24
+ reveal_type(x) # revealed: Literal[0, -1, "", "foo ", b" ", b"bar"] | bool | None | tuple[()]
25
25
26
26
if not (x and not x):
27
- reveal_type(x) # revealed: Literal[0, "", b" ", -1, "foo ", b"bar"] | bool | None | tuple[()]
27
+ reveal_type(x) # revealed: Literal[0, -1, "", "foo ", b" ", b"bar"] | bool | None | tuple[()]
28
28
else :
29
29
reveal_type(x) # revealed: Never
30
30
31
31
if x or not x:
32
- reveal_type(x) # revealed: Literal[-1, "foo ", b"bar ", 0, "", b""] | bool | None | tuple[()]
32
+ reveal_type(x) # revealed: Literal[0, -1, "", "foo ", b "", b"bar "] | bool | None | tuple[()]
33
33
else :
34
34
reveal_type(x) # revealed: Never
35
35
36
36
if not (x or not x):
37
37
reveal_type(x) # revealed: Never
38
38
else :
39
- reveal_type(x) # revealed: Literal[-1, "foo ", b"bar ", 0, "", b""] | bool | None | tuple[()]
39
+ reveal_type(x) # revealed: Literal[0, -1, "", "foo ", b "", b"bar "] | bool | None | tuple[()]
40
40
41
41
if (isinstance (x, int ) or isinstance (x, str )) and x:
42
42
reveal_type(x) # revealed: Literal[-1, True, "foo"]
@@ -87,10 +87,10 @@ def f(x: A | B):
87
87
if x and not x:
88
88
reveal_type(x) # revealed: A & ~AlwaysFalsy & ~AlwaysTruthy | B & ~AlwaysFalsy & ~AlwaysTruthy
89
89
else :
90
- reveal_type(x) # revealed: A & ~AlwaysTruthy | B & ~AlwaysTruthy | A & ~AlwaysFalsy | B & ~AlwaysFalsy
90
+ reveal_type(x) # revealed: A | B
91
91
92
92
if x or not x:
93
- reveal_type(x) # revealed: A & ~AlwaysFalsy | B & ~AlwaysFalsy | A & ~AlwaysTruthy | B & ~AlwaysTruthy
93
+ reveal_type(x) # revealed: A | B
94
94
else :
95
95
reveal_type(x) # revealed: A & ~AlwaysTruthy & ~AlwaysFalsy | B & ~AlwaysTruthy & ~AlwaysFalsy
96
96
```
@@ -214,10 +214,9 @@ if x and not x:
214
214
reveal_type(y) # revealed: A & ~AlwaysFalsy & ~AlwaysTruthy
215
215
else :
216
216
y = x
217
- reveal_type(y) # revealed: A & ~AlwaysTruthy | A & ~AlwaysFalsy
217
+ reveal_type(y) # revealed: A
218
218
219
- # TODO : It should be A. We should improve UnionBuilder or IntersectionBuilder. (issue #15023)
220
- reveal_type(y) # revealed: A & ~AlwaysTruthy | A & ~AlwaysFalsy
219
+ reveal_type(y) # revealed: A
221
220
```
222
221
223
222
## Truthiness of classes
0 commit comments