Skip to content

Commit 14b636a

Browse files
committed
document special case
1 parent 8779dae commit 14b636a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/ty_python_semantic/src/types/type_ordering.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ pub(super) fn union_or_intersection_elements_ordering<'db>(
139139
(Type::ProtocolInstance(_), _) => Ordering::Less,
140140
(_, Type::ProtocolInstance(_)) => Ordering::Greater,
141141

142+
// This is one place where we want to compare the typevar identities directly, instead of
143+
// falling back on `is_same_typevar_as` or `can_be_bound_for`.
142144
(Type::TypeVar(left), Type::TypeVar(right)) => left.as_id().cmp(&right.as_id()),
143145
(Type::TypeVar(_), _) => Ordering::Less,
144146
(_, Type::TypeVar(_)) => Ordering::Greater,

0 commit comments

Comments
 (0)