@@ -150,6 +150,12 @@ pub(crate) trait Constraints<'db>: Clone + Sized {
150150 self . clone ( ) . negate ( db) . or ( db, || self . and ( db, other) )
151151 }
152152
153+ fn equivalent_to ( self , db : & ' db dyn Db , other : Self ) -> Self {
154+ self . clone ( )
155+ . and ( db, || other. clone ( ) )
156+ . or ( db, || self . negate ( db) . and ( db, || other. negate ( db) ) )
157+ }
158+
153159 /// Returns the intersection of this constraint set and another. The other constraint set is
154160 /// provided as a thunk, to implement short-circuiting: the thunk is not forced if the
155161 /// constraint set is already saturated.
@@ -398,12 +404,6 @@ impl<'db> Constraints<'db> for ConstraintSet<'db> {
398404 ) -> Self {
399405 let lower = lower. bottom_materialization ( db) ;
400406 let upper = upper. top_materialization ( db) ;
401- eprintln ! (
402- "==> constraint {} <: {} <: {}" ,
403- lower. display( db) ,
404- typevar. display( db) ,
405- upper. display( db)
406- ) ;
407407 match Constraint :: range ( db, lower, upper) {
408408 Satisfiable :: Never => Self :: never ( ) ,
409409 Satisfiable :: Always => Self :: always ( ) ,
@@ -1039,6 +1039,23 @@ impl<'db> Constraint<'db> {
10391039 ///
10401040 /// Panics if `lower` and `upper` are not both fully static.
10411041 fn range ( db : & ' db dyn Db , lower : Type < ' db > , upper : Type < ' db > ) -> Satisfiable < Constraint < ' db > > {
1042+ eprintln ! (
1043+ "==> range {}/{} .. {}/{}" ,
1044+ lower. display( db) ,
1045+ lower. bottom_materialization( db) . display( db) ,
1046+ upper. display( db) ,
1047+ upper. top_materialization( db) . display( db) ,
1048+ ) ;
1049+ debug_assert ! (
1050+ !matches!( lower, Type :: Dynamic ( _) ) ,
1051+ "{} is not fully static" ,
1052+ lower. display( db)
1053+ ) ;
1054+ debug_assert ! (
1055+ !matches!( upper, Type :: Dynamic ( _) ) ,
1056+ "{} is not fully static" ,
1057+ upper. display( db)
1058+ ) ;
10421059 debug_assert_eq ! (
10431060 lower,
10441061 lower. bottom_materialization( db) ,
@@ -1177,6 +1194,15 @@ impl<'db> RangeConstraint<'db> {
11771194 typevar : BoundTypeVarInstance < ' db > ,
11781195 set : & mut ConstraintSet < ' db > ,
11791196 ) {
1197+ /*
1198+ eprintln!(
1199+ "==> ¬({} ≤ {} ≤ {})",
1200+ self.lower.display(db),
1201+ typevar.display(db),
1202+ self.upper.display(db)
1203+ );
1204+ */
1205+
11801206 // Lower bound:
11811207 // ¬(s ≤ α) = ((α ≤ s) ∧ α ≠ s) ∨ (a ≁ s)
11821208 set. union_clause (
@@ -1196,6 +1222,8 @@ impl<'db> RangeConstraint<'db> {
11961222
11971223 // Upper bound:
11981224 // ¬(α ≤ t) = ((t ≤ α) ∧ α ≠ t) ∨ (a ≁ t)
1225+ eprintln ! ( "==> what {}" , self . upper. display( db) ) ;
1226+ eprintln ! ( "==> what {}" , Type :: object( db) . display( db) ) ;
11991227 set. union_clause (
12001228 db,
12011229 ConstraintClause :: from_constraints (
0 commit comments