diff --git a/ast/src/solve_type.rs b/ast/src/solve_type.rs index 2c391ce637..c437b78949 100644 --- a/ast/src/solve_type.rs +++ b/ast/src/solve_type.rs @@ -252,6 +252,7 @@ fn solve<'a>( state } + NotInRange(_vars, _typ, _range) => todo!(), } } // Store(source, target, _filename, _linenr) => { @@ -346,6 +347,7 @@ fn solve<'a>( state } + NotInRange(_vars, _typ, _range) => todo!(), } } None => { @@ -416,6 +418,7 @@ fn solve<'a>( state } + NotInRange(_vars, _typ, _range) => todo!(), } } Let(let_con) => { @@ -725,6 +728,7 @@ fn solve<'a>( state } + NotInRange(_vars, _typ, _range) => todo!(), } } } @@ -1400,6 +1404,8 @@ fn adjust_rank_content( 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); } + + RangedNumber(typ, _vars) => { + instantiate_rigids_help(subs, max_rank, pools, typ); + } } var @@ -1806,6 +1816,25 @@ fn deep_copy_var_help( 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 + } } } diff --git a/compiler/constrain/src/builtins.rs b/compiler/constrain/src/builtins.rs index 7867a06cd9..87ba062388 100644 --- a/compiler/constrain/src/builtins.rs +++ b/compiler/constrain/src/builtins.rs @@ -35,7 +35,7 @@ pub fn add_numeric_bound_constr( )); 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, region, ), - Eq(num_type, expected.clone(), Category::Int, region), + Eq(num_type, expected, Category::Int, region), ]); exists(vec![num_var], And(constrs)) diff --git a/compiler/constrain/src/pattern.rs b/compiler/constrain/src/pattern.rs index bdd11dfe27..bf77a86f36 100644 --- a/compiler/constrain/src/pattern.rs +++ b/compiler/constrain/src/pattern.rs @@ -185,7 +185,7 @@ pub fn constrain_pattern( let num_type = builtins::add_numeric_bound_constr( &mut state.constraints, - num_type.clone(), + num_type, bound, region, Category::Num, diff --git a/compiler/types/src/solved_types.rs b/compiler/types/src/solved_types.rs index 453e5207c1..fb5f20e7f0 100644 --- a/compiler/types/src/solved_types.rs +++ b/compiler/types/src/solved_types.rs @@ -231,7 +231,7 @@ impl SolvedType { } } 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), } } diff --git a/compiler/types/src/subs.rs b/compiler/types/src/subs.rs index e24503e899..dcd6767b2f 100644 --- a/compiler/types/src/subs.rs +++ b/compiler/types/src/subs.rs @@ -1058,6 +1058,7 @@ fn define_integer_types(subs: &mut Subs) { ); } +#[allow(clippy::too_many_arguments)] fn float_type( subs: &mut Subs,