From 358185b5e2b62fa1f6715564621fe48b74aa7069 Mon Sep 17 00:00:00 2001 From: Douglas Creager Date: Mon, 15 Dec 2025 09:09:41 -0500 Subject: [PATCH] document display source_order --- crates/ty_python_semantic/src/types/constraints.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/ty_python_semantic/src/types/constraints.rs b/crates/ty_python_semantic/src/types/constraints.rs index edc40c3a22..f083f142a1 100644 --- a/crates/ty_python_semantic/src/types/constraints.rs +++ b/crates/ty_python_semantic/src/types/constraints.rs @@ -2153,7 +2153,10 @@ impl<'db> InteriorNode<'db> { .collect(); // Repeatedly pop constraint pairs off of the visit queue, checking whether each pair can - // be simplified. + // be simplified. If we add any derived constraints, we will place them at the end in + // source order. (We do not have any test cases that depend on constraint sets being + // displayed in a consistent ordering, so we don't need to be clever in assigning these + // `source_order`s.) let mut simplified = Node::Interior(self); let mut next_source_order = self.max_source_order(db) + 1; while let Some((left_constraint, right_constraint)) = to_visit.pop() { @@ -2358,7 +2361,6 @@ impl<'db> InteriorNode<'db> { intersection_constraint.when_true(), next_source_order, ); - next_source_order += 1; let negative_intersection_node = Node::new_satisfied_constraint( db, intersection_constraint.when_false(),