Struct move_model::ty::TypeInstantiationDerivation
source · pub struct TypeInstantiationDerivation {}
Expand description
A helper to derive the set of instantiations for type parameters
Implementations§
source§impl TypeInstantiationDerivation
impl TypeInstantiationDerivation
sourcepub fn progressive_instantiation<'a, I>(
lhs_types: I,
rhs_types: I,
treat_lhs_type_param_as_var: bool,
treat_rhs_type_param_as_var: bool,
refine_lhs: bool,
refine_rhs: bool,
params_arity: usize,
target_lhs: bool,
mark_irrelevant_param_as_error: bool
) -> BTreeSet<Vec<Type>>where
I: Iterator<Item = &'a Type> + Clone,
pub fn progressive_instantiation<'a, I>( lhs_types: I, rhs_types: I, treat_lhs_type_param_as_var: bool, treat_rhs_type_param_as_var: bool, refine_lhs: bool, refine_rhs: bool, params_arity: usize, target_lhs: bool, mark_irrelevant_param_as_error: bool ) -> BTreeSet<Vec<Type>>where I: Iterator<Item = &'a Type> + Clone,
Find the set of valid instantiation combinations for all the type parameters.
The algorithm is progressive. For a list of parameters with arity params_arity = N
, it
- first finds all possible instantiation for parameter at index 0 (
inst_param_0
) and,’ - for each instantiation in
inst_param_0
,- refines LHS or RHS types and
- finds all possible instantiations for parameter at index 1 (
inst_param_1
) - for each instantiation in
inst_param_1
,- refines LHS or RHS types and
- finds all possible instantiations for parameter at index 2 (
inst_param_2
) - for each instantiation in
inst_param_2
,- ……
The process continues until all type parameters are analyzed (i.e., reaching the type
parameter at index
N
).
- ……
The process continues until all type parameters are analyzed (i.e., reaching the type
parameter at index
If refine_lhs
is True, refine the lhs_types
after each round; same for refine_rhs
.
If target_lhs
is True, find instantiations for the type parameters in the lhs_types
,
otherwise, target the rhs_types
.
If mark_irrelevant_param_as_error
is True, type parameters that do not have any valid
instantiation will be marked as Type::Error
. Otherwise, leave the type parameter as it is.