Skip to content

Commit f286bc5

Browse files
committed
Rename Negate => Not
1 parent 3965d51 commit f286bc5

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

crates/red_knot_python_semantic/resources/mdtest/type_api.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ The Python language itself allows us to perform a variety of operations on types
99
can build a union of types like `int | None`, or we can use type constructors such as `list[int]` or
1010
`type[int]` to create new types. But some type level operations that we rely on in Red Knot, like
1111
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.
1313

1414
### Negation
1515

1616
```py
17-
from red_knot import Negate
17+
from red_knot import Not
1818

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]]]
2222

2323
def _() -> None:
2424
reveal_type(x) # revealed: ~int
@@ -29,11 +29,11 @@ def _() -> None:
2929
### Intersection
3030

3131
```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
3333
from typing_extensions import Never
3434

3535
x1: Intersection[int, str]
36-
x2: Intersection[int, Negate[str]]
36+
x2: Intersection[int, Not[str]]
3737

3838
def x() -> None:
3939
reveal_type(x1) # revealed: int & str
@@ -48,7 +48,7 @@ def y() -> None:
4848
reveal_type(y2) # revealed: bool
4949
reveal_type(y3) # revealed: Never
5050

51-
z1: Intersection[int, Negate[Literal[1]], Negate[Literal[2]]]
51+
z1: Intersection[int, Not[Literal[1]], Not[Literal[2]]]
5252

5353
def z() -> None:
5454
reveal_type(z1) # revealed: int & ~Literal[1] & ~Literal[2]

crates/red_knot_python_semantic/src/types/type_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(crate) fn resolve_type_operation<'db>(
4040
arguments: impl Iterator<Item = Type<'db>>,
4141
) -> Result<Type<'db>> {
4242
match class.name(db).as_str() {
43-
"Negate" => {
43+
"Not" => {
4444
let ty = expect_one_argument(arguments)?;
4545
Ok(ty.negate(db))
4646
}

crates/red_knot_vendored/vendor/typeshed/stdlib/red_knot.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from typing import TypeVarTuple
33
Ts = TypeVarTuple("Ts")
44

55
# Operations on types
6-
class Negate[T]: ...
6+
class Not[T]: ...
77
class Intersection[*Ts]: ...
88
class ClassLiteral[T]: ...
99

0 commit comments

Comments
 (0)