[red-knot] Minor fixes in intersection-types tests (#15410)

## Summary

Minor fixes in intersection-types tests
This commit is contained in:
David Peter 2025-01-10 22:53:03 +01:00 committed by GitHub
parent 232fbc1300
commit 398f2e8b0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 7 deletions

View File

@ -105,10 +105,10 @@ static_assert(not is_subtype_of(B2, B1))
This section covers structural properties of intersection types and documents some decisions on how This section covers structural properties of intersection types and documents some decisions on how
to represent mixtures of intersections and unions. to represent mixtures of intersections and unions.
### Single-element unions ### Single-element intersections
If we have a union of a single element, we can simplify to that element. Similarly, we show an If we have an intersection with a single element, we can simplify to that element. Similarly, we
intersection with a single negative contribution as just the negation of that element. show an intersection with a single negative contribution as just the negation of that element.
```py ```py
from knot_extensions import Intersection, Not from knot_extensions import Intersection, Not
@ -422,8 +422,8 @@ def example_type_bool_type_str(
#### Positive and negative contributions #### Positive and negative contributions
If we intersect a type `X` with the negation of a disjoint type `Y`, we can remove the negative If we intersect a type `X` with the negation `~Y` of a disjoint type `Y`, we can remove the negative
contribution `~Y`, as it necessarily overlaps with the positive contribution `X`: contribution `~Y`, as `~Y` must fully contain the positive contribution `X` as a subtype:
```py ```py
from knot_extensions import Intersection, Not from knot_extensions import Intersection, Not
@ -515,8 +515,7 @@ def _(
#### Negative type and negative subtype #### Negative type and negative subtype
For negative contributions, this property is reversed. Here we can get remove superfluous For negative contributions, this property is reversed. Here we can remove superfluous _subtypes_:
_subtypes_:
```py ```py
from knot_extensions import Intersection, Not from knot_extensions import Intersection, Not