Skip to content

Commit 78c206f

Browse files
committed
Rename TypeArgs to RefinedTypeArgs
1 parent 91af963 commit 78c206f

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

src/rty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mod subtyping;
5555
pub use subtyping::{relate_sub_closed_type, ClauseScope, Subtyping};
5656

5757
mod params;
58-
pub use params::{TypeArgs, TypeParamIdx, TypeParamSubst};
58+
pub use params::{RefinedTypeArgs, TypeArgs, TypeParamIdx, TypeParamSubst};
5959

6060
rustc_index::newtype_index! {
6161
/// An index representing function parameter.
@@ -487,7 +487,7 @@ where
487487
}
488488

489489
impl<T> EnumType<T> {
490-
pub fn new(symbol: chc::DatatypeSymbol, args: TypeArgs<T>) -> Self {
490+
pub fn new(symbol: chc::DatatypeSymbol, args: RefinedTypeArgs<T>) -> Self {
491491
EnumType { symbol, args }
492492
}
493493

@@ -1372,7 +1372,7 @@ impl<FV> RefinedType<FV> {
13721372
}
13731373
}
13741374

1375-
pub fn instantiate_ty_params(&mut self, params: TypeArgs<FV>)
1375+
pub fn instantiate_ty_params(&mut self, params: RefinedTypeArgs<FV>)
13761376
where
13771377
FV: chc::Var,
13781378
{

src/rty/params.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_index::IndexVec;
77

88
use crate::chc;
99

10-
use super::{Closed, RefinedType};
10+
use super::{Closed, RefinedType, Type};
1111

1212
rustc_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

7273
impl<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

Comments
 (0)