@@ -7,7 +7,7 @@ use rustc_index::IndexVec;
77
88use crate :: chc;
99
10- use super :: { Closed , RefinedType } ;
10+ use super :: { Closed , RefinedType , Type } ;
1111
1212rustc_index:: newtype_index! {
1313 /// An index representing a type parameter.
@@ -53,7 +53,8 @@ impl TypeParamIdx {
5353 }
5454}
5555
56- pub type TypeArgs < T > = IndexVec < TypeParamIdx , RefinedType < T > > ;
56+ pub type RefinedTypeArgs < T = Closed > = IndexVec < TypeParamIdx , RefinedType < T > > ;
57+ pub type TypeArgs < T = Closed > = IndexVec < TypeParamIdx , Type < T > > ;
5758
5859/// A substitution for type parameters that maps type parameters to refinement types.
5960#[ derive( Debug , Clone ) ]
@@ -71,6 +72,16 @@ impl<T> Default for TypeParamSubst<T> {
7172
7273impl < T > From < TypeArgs < T > > for TypeParamSubst < T > {
7374 fn from ( params : TypeArgs < T > ) -> Self {
75+ let subst = params
76+ . into_iter_enumerated ( )
77+ . map ( |( idx, ty) | ( idx, RefinedType :: unrefined ( ty) ) )
78+ . collect ( ) ;
79+ Self { subst }
80+ }
81+ }
82+
83+ impl < T > From < RefinedTypeArgs < T > > for TypeParamSubst < T > {
84+ fn from ( params : RefinedTypeArgs < T > ) -> Self {
7485 let subst = params. into_iter_enumerated ( ) . collect ( ) ;
7586 Self { subst }
7687 }
@@ -112,12 +123,12 @@ impl<T> TypeParamSubst<T> {
112123 }
113124 }
114125
115- pub fn into_args < F > ( mut self , expected_len : usize , mut default : F ) -> TypeArgs < T >
126+ pub fn into_args < F > ( mut self , expected_len : usize , mut default : F ) -> RefinedTypeArgs < T >
116127 where
117128 T : chc:: Var ,
118129 F : FnMut ( TypeParamIdx ) -> RefinedType < T > ,
119130 {
120- let mut args = TypeArgs :: new ( ) ;
131+ let mut args = RefinedTypeArgs :: new ( ) ;
121132 for idx in 0 ..expected_len {
122133 let ty = self
123134 . subst
0 commit comments