From 81cfa8ea0a31d679b582c36f66a962bfd63e2f3d Mon Sep 17 00:00:00 2001 From: Douglas Creager Date: Tue, 5 Aug 2025 15:49:14 -0400 Subject: [PATCH] tmp arrows --- .../src/types/unification.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/ty_python_semantic/src/types/unification.rs b/crates/ty_python_semantic/src/types/unification.rs index 3e10cf8016..715b46d67d 100644 --- a/crates/ty_python_semantic/src/types/unification.rs +++ b/crates/ty_python_semantic/src/types/unification.rs @@ -317,6 +317,24 @@ fn normalized_constraints_from_type_inner<'db>( }; } + // Figure 3, step 4 + // If all (positive and negative) elements of the intersection are callable, decompose + // the corresponding arrow type. + let positive_callable: Option> = (intersection.iter_positive(db)) + .map(|ty| ty.into_callable(db)) + .collect(); + let negative_callable: Option> = (intersection.iter_negative(db)) + .map(|ty| ty.into_callable(db)) + .collect(); + if let (Some(positive), Some(negative)) = (positive_callable, negative_callable) { + ConstraintSetSet::distributed_union( + db, + negative.into_iter().map(|negative| { + let norm_negative = normalized_constraints_from_type(db); + }), + ) + } + // TODO: Do we need to handle non-uniform intersections? For now, assume // the intersection is not empty. ConstraintSetSet::never()