@@ -9,16 +9,16 @@ The Python language itself allows us to perform a variety of operations on types
9
9
can build a union of types like ` int | None ` , or we can use type constructors such as ` list[int] ` or
10
10
` type[int] ` to create new types. But some type level operations that we rely on in Red Knot, like
11
11
intersections, can not be expressed in Python. The ` red_knot ` module provides the ` Intersection ` and
12
- ` Negate ` type constructors which allows us to construct these types directly.
12
+ ` Not ` type constructors which allows us to construct these types directly.
13
13
14
14
### Negation
15
15
16
16
``` py
17
- from red_knot import Negate
17
+ from red_knot import Not
18
18
19
- x: Negate [int ]
20
- y: Negate[Negate [int ]]
21
- z: Negate[Negate[Negate [int ]]]
19
+ x: Not [int ]
20
+ y: Not[Not [int ]]
21
+ z: Not[Not[Not [int ]]]
22
22
23
23
def _ () -> None :
24
24
reveal_type(x) # revealed: ~int
@@ -29,11 +29,11 @@ def _() -> None:
29
29
### Intersection
30
30
31
31
``` py
32
- from red_knot import Intersection, Negate , is_subtype_of, assert_true
32
+ from red_knot import Intersection, Not , is_subtype_of, assert_true
33
33
from typing_extensions import Never
34
34
35
35
x1: Intersection[int , str ]
36
- x2: Intersection[int , Negate [str ]]
36
+ x2: Intersection[int , Not [str ]]
37
37
38
38
def x () -> None :
39
39
reveal_type(x1) # revealed: int & str
@@ -48,7 +48,7 @@ def y() -> None:
48
48
reveal_type(y2) # revealed: bool
49
49
reveal_type(y3) # revealed: Never
50
50
51
- z1: Intersection[int , Negate [Literal[1 ]], Negate [Literal[2 ]]]
51
+ z1: Intersection[int , Not [Literal[1 ]], Not [Literal[2 ]]]
52
52
53
53
def z () -> None :
54
54
reveal_type(z1) # revealed: int & ~Literal[1] & ~Literal[2]
0 commit comments