@@ -325,14 +325,6 @@ impl<'db> ConstrainedTypeVar<'db> {
325325 ConstraintAssignment :: Negative ( self )
326326 }
327327
328- fn contains ( self , db : & ' db dyn Db , other : Self ) -> bool {
329- if self . typevar ( db) != other. typevar ( db) {
330- return false ;
331- }
332- self . lower ( db) . is_subtype_of ( db, other. lower ( db) )
333- && other. upper ( db) . is_subtype_of ( db, self . upper ( db) )
334- }
335-
336328 /// Returns whether this constraint implies contains another — i.e., whether every type that
337329 /// satisfies this constraint also satisfies `other`.
338330 ///
@@ -1104,10 +1096,10 @@ impl<'db> InteriorNode<'db> {
11041096
11051097 // Containment: The range of one constraint might completely contain the range of the
11061098 // other. If so, there are several potential simplifications.
1107- let larger_smaller = if left_constraint. contains ( db, right_constraint) {
1108- Some ( ( left_constraint, right_constraint) )
1109- } else if right_constraint. contains ( db, left_constraint) {
1099+ let larger_smaller = if left_constraint. implies ( db, right_constraint, constraints) {
11101100 Some ( ( right_constraint, left_constraint) )
1101+ } else if right_constraint. implies ( db, left_constraint, constraints) {
1102+ Some ( ( left_constraint, right_constraint) )
11111103 } else {
11121104 None
11131105 } ;
0 commit comments