This commit is contained in:
ayazhafiz 2022-02-06 00:24:39 -05:00
parent 8dc92ccd97
commit c80c842a93
5 changed files with 34 additions and 4 deletions

View file

@ -252,6 +252,7 @@ fn solve<'a>(
state state
} }
NotInRange(_vars, _typ, _range) => todo!(),
} }
} }
// Store(source, target, _filename, _linenr) => { // Store(source, target, _filename, _linenr) => {
@ -346,6 +347,7 @@ fn solve<'a>(
state state
} }
NotInRange(_vars, _typ, _range) => todo!(),
} }
} }
None => { None => {
@ -416,6 +418,7 @@ fn solve<'a>(
state state
} }
NotInRange(_vars, _typ, _range) => todo!(),
} }
} }
Let(let_con) => { Let(let_con) => {
@ -725,6 +728,7 @@ fn solve<'a>(
state state
} }
NotInRange(_vars, _typ, _range) => todo!(),
} }
} }
} }
@ -1400,6 +1404,8 @@ fn adjust_rank_content(
rank rank
} }
RangedNumber(typ, _vars) => adjust_rank(subs, young_mark, visit_mark, group_rank, *typ),
} }
} }
@ -1550,6 +1556,10 @@ fn instantiate_rigids_help(
instantiate_rigids_help(subs, max_rank, pools, real_type_var); instantiate_rigids_help(subs, max_rank, pools, real_type_var);
} }
RangedNumber(typ, _vars) => {
instantiate_rigids_help(subs, max_rank, pools, typ);
}
} }
var var
@ -1806,6 +1816,25 @@ fn deep_copy_var_help(
copy copy
} }
RangedNumber(typ, vars) => {
let mut new_vars = Vec::with_capacity(vars.len());
for var_index in vars {
let var = subs[var_index];
let new_var = deep_copy_var_help(subs, max_rank, pools, var);
new_vars.push(new_var);
}
let new_slice = VariableSubsSlice::insert_into_subs(subs, new_vars.drain(..));
let new_real_type = deep_copy_var_help(subs, max_rank, pools, typ);
let new_content = RangedNumber(new_real_type, new_slice);
subs.set(copy, make_descriptor(new_content));
copy
}
} }
} }

View file

@ -35,7 +35,7 @@ pub fn add_numeric_bound_constr(
)); ));
total_num_type total_num_type
} }
_ => RangedNumber(Box::new(total_num_type.clone()), range), _ => RangedNumber(Box::new(total_num_type), range),
} }
} }
@ -66,7 +66,7 @@ pub fn int_literal(
Category::Int, Category::Int,
region, region,
), ),
Eq(num_type, expected.clone(), Category::Int, region), Eq(num_type, expected, Category::Int, region),
]); ]);
exists(vec![num_var], And(constrs)) exists(vec![num_var], And(constrs))

View file

@ -185,7 +185,7 @@ pub fn constrain_pattern(
let num_type = builtins::add_numeric_bound_constr( let num_type = builtins::add_numeric_bound_constr(
&mut state.constraints, &mut state.constraints,
num_type.clone(), num_type,
bound, bound,
region, region,
Category::Num, Category::Num,

View file

@ -231,7 +231,7 @@ impl SolvedType {
} }
} }
Variable(var) => Self::from_var(solved_subs.inner(), *var), Variable(var) => Self::from_var(solved_subs.inner(), *var),
RangedNumber(typ, _) => Self::from_type(solved_subs, &typ), RangedNumber(typ, _) => Self::from_type(solved_subs, typ),
} }
} }

View file

@ -1058,6 +1058,7 @@ fn define_integer_types(subs: &mut Subs) {
); );
} }
#[allow(clippy::too_many_arguments)]
fn float_type( fn float_type(
subs: &mut Subs, subs: &mut Subs,