From 398f2e8b0c18c414e8e6bcffc7933a049d73dd5a Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 10 Jan 2025 22:53:03 +0100 Subject: [PATCH] [red-knot] Minor fixes in intersection-types tests (#15410) ## Summary Minor fixes in intersection-types tests --- .../resources/mdtest/intersection_types.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/red_knot_python_semantic/resources/mdtest/intersection_types.md b/crates/red_knot_python_semantic/resources/mdtest/intersection_types.md index 64c97adb5b..8a85ebc000 100644 --- a/crates/red_knot_python_semantic/resources/mdtest/intersection_types.md +++ b/crates/red_knot_python_semantic/resources/mdtest/intersection_types.md @@ -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 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 -intersection with a single negative contribution as just the negation of that element. +If we have an intersection with a single element, we can simplify to that element. Similarly, we +show an intersection with a single negative contribution as just the negation of that element. ```py from knot_extensions import Intersection, Not @@ -422,8 +422,8 @@ def example_type_bool_type_str( #### Positive and negative contributions -If we intersect a type `X` with the negation of a disjoint type `Y`, we can remove the negative -contribution `~Y`, as it necessarily overlaps with the positive contribution `X`: +If we intersect a type `X` with the negation `~Y` of a disjoint type `Y`, we can remove the negative +contribution `~Y`, as `~Y` must fully contain the positive contribution `X` as a subtype: ```py from knot_extensions import Intersection, Not @@ -515,8 +515,7 @@ def _( #### Negative type and negative subtype -For negative contributions, this property is reversed. Here we can get remove superfluous -_subtypes_: +For negative contributions, this property is reversed. Here we can remove superfluous _subtypes_: ```py from knot_extensions import Intersection, Not