@@ -13,10 +13,12 @@ use crate::analyze;
1313use crate :: chc;
1414use crate :: pretty:: PrettyDisplayExt as _;
1515use crate :: refine:: {
16- self , BasicBlockType , Env , PlaceType , PlaceTypeVar , TempVarIdx , TemplateTypeGenerator ,
17- UnboundAssumption , UnrefinedTypeGenerator , Var ,
16+ self , Assumption , BasicBlockType , Env , PlaceType , PlaceTypeVar , TempVarIdx ,
17+ TemplateTypeGenerator , UnrefinedTypeGenerator , Var ,
18+ } ;
19+ use crate :: rty:: {
20+ self , ClauseBuilderExt as _, ClauseScope as _, ShiftExistential as _, Subtyping as _,
1821} ;
19- use crate :: rty:: { self , ClauseBuilderExt as _, ClauseScope as _, Subtyping as _} ;
2022
2123mod drop_point;
2224mod visitor;
@@ -339,11 +341,7 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
339341 self . ctx . extend_clauses ( clauses) ;
340342 }
341343
342- fn with_assumptions < F , T > (
343- & mut self ,
344- assumptions : Vec < impl Into < UnboundAssumption > > ,
345- callback : F ,
346- ) -> T
344+ fn with_assumptions < F , T > ( & mut self , assumptions : Vec < impl Into < Assumption > > , callback : F ) -> T
347345 where
348346 F : FnOnce ( & mut Self ) -> T ,
349347 {
@@ -354,7 +352,7 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
354352 result
355353 }
356354
357- fn with_assumption < F , T > ( & mut self , assumption : impl Into < UnboundAssumption > , callback : F ) -> T
355+ fn with_assumption < F , T > ( & mut self , assumption : impl Into < Assumption > , callback : F ) -> T
358356 where
359357 F : FnOnce ( & mut Self ) -> T ,
360358 {
@@ -767,23 +765,23 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
767765#[ derive( Debug , Clone ) ]
768766pub struct UnbindAtoms < T > {
769767 existentials : IndexVec < rty:: ExistentialVarIdx , chc:: Sort > ,
770- formula : rty :: FormulaWithAtoms < rty:: RefinedTypeVar < Var > > ,
768+ body : chc :: Body < rty:: RefinedTypeVar < Var > > ,
771769 target_equations : Vec < ( rty:: RefinedTypeVar < T > , chc:: Term < rty:: RefinedTypeVar < Var > > ) > ,
772770}
773771
774772impl < T > Default for UnbindAtoms < T > {
775773 fn default ( ) -> Self {
776774 UnbindAtoms {
777775 existentials : Default :: default ( ) ,
778- formula : Default :: default ( ) ,
776+ body : Default :: default ( ) ,
779777 target_equations : Default :: default ( ) ,
780778 }
781779 }
782780}
783781
784782impl < T > UnbindAtoms < T > {
785783 pub fn push ( & mut self , target : rty:: RefinedTypeVar < T > , var_ty : PlaceType ) {
786- self . formula . push_conj (
784+ self . body . push_conj (
787785 var_ty
788786 . formula
789787 . map_var ( |v| v. shift_existential ( self . existentials . len ( ) ) . into ( ) ) ,
@@ -802,13 +800,10 @@ impl<T> UnbindAtoms<T> {
802800 ty : src_ty,
803801 refinement,
804802 } = ty;
805- let rty:: Refinement {
806- existentials,
807- formula,
808- } = refinement;
803+ let rty:: Refinement { existentials, body } = refinement;
809804
810- self . formula
811- . push_conj ( formula . map_var ( |v| v. shift_existential ( self . existentials . len ( ) ) ) ) ;
805+ self . body
806+ . push_conj ( body . map_var ( |v| v. shift_existential ( self . existentials . len ( ) ) ) ) ;
812807 self . existentials . extend ( existentials) ;
813808
814809 let mut substs = HashMap :: new ( ) ;
@@ -817,12 +812,12 @@ impl<T> UnbindAtoms<T> {
817812 substs. insert ( v, ev) ;
818813 }
819814
820- let mut formula = self . formula . map_var ( |v| match v {
815+ let mut body = self . body . map_var ( |v| match v {
821816 rty:: RefinedTypeVar :: Value => rty:: RefinedTypeVar :: Value ,
822817 rty:: RefinedTypeVar :: Free ( v) => rty:: RefinedTypeVar :: Existential ( substs[ & v] ) ,
823818 rty:: RefinedTypeVar :: Existential ( ev) => rty:: RefinedTypeVar :: Existential ( ev) ,
824819 } ) ;
825- formula . push_conj (
820+ body . push_conj (
826821 self . target_equations
827822 . into_iter ( )
828823 . map ( |( t, term) | {
@@ -839,7 +834,7 @@ impl<T> UnbindAtoms<T> {
839834 . collect :: < Vec < _ > > ( ) ,
840835 ) ;
841836
842- let refinement = rty:: Refinement :: with_formula ( self . existentials , formula ) ;
837+ let refinement = rty:: Refinement :: new ( self . existentials , body ) ;
843838 // TODO: polymorphic datatypes: template needed?
844839 rty:: RefinedType :: new ( src_ty. assert_closed ( ) . vacuous ( ) , refinement)
845840 }
@@ -852,7 +847,7 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
852847 expected_params : & IndexVec < rty:: FunctionParamIdx , rty:: RefinedType < rty:: FunctionParamIdx > > ,
853848 ) {
854849 let mut param_terms = HashMap :: < rty:: FunctionParamIdx , chc:: Term < PlaceTypeVar > > :: new ( ) ;
855- let mut assumption = UnboundAssumption :: default ( ) ;
850+ let mut assumption = Assumption :: default ( ) ;
856851
857852 let bb_ty = self . basic_block_ty ( self . basic_block ) . clone ( ) ;
858853 let params = & bb_ty. as_ref ( ) . params ;
@@ -878,7 +873,7 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
878873 }
879874
880875 let local_ty = self . env . local_type ( local) ;
881- assumption. formula . push_conj (
876+ assumption. body . push_conj (
882877 local_ty
883878 . formula
884879 . map_var ( |v| v. shift_existential ( assumption. existentials . len ( ) ) ) ,
@@ -892,11 +887,8 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
892887 }
893888
894889 for ( idx, param) in expected_params. iter_enumerated ( ) {
895- let rty:: Refinement {
896- existentials,
897- formula,
898- } = param. refinement . clone ( ) ;
899- assumption. formula . push_conj ( formula. subst_var ( |v| match v {
890+ let rty:: Refinement { existentials, body } = param. refinement . clone ( ) ;
891+ assumption. body . push_conj ( body. subst_var ( |v| match v {
900892 rty:: RefinedTypeVar :: Value => param_terms[ & idx] . clone ( ) ,
901893 rty:: RefinedTypeVar :: Free ( v) => param_terms[ & v] . clone ( ) ,
902894 rty:: RefinedTypeVar :: Existential ( ev) => chc:: Term :: var ( PlaceTypeVar :: Existential (
0 commit comments