add failing test

This commit is contained in:
Douglas Creager 2025-12-10 09:49:07 -05:00
parent 7bf50e70a7
commit 0cecb9f4ef
1 changed files with 10 additions and 1 deletions

View File

@ -126,7 +126,7 @@ strict subtype of the lower bound, a strict supertype of the upper bound, or inc
```py
from typing import Any, final, Never, Sequence
from ty_extensions import ConstraintSet, static_assert
from ty_extensions import ConstraintSet, Not, static_assert
class Super: ...
class Base(Super): ...
@ -207,6 +207,15 @@ def _[T]() -> None:
static_assert(constraints == expected)
```
A negated _type_ is not the same thing as a negated _range_.
```py
def _[T]() -> None:
negated_type = ConstraintSet.range(Never, T, Not[int])
negated_constraint = ~ConstraintSet.range(Never, T, int)
static_assert(negated_type != negated_constraint)
```
## Intersection
The intersection of two constraint sets requires that the constraints in both sets hold. In many