mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
drop final suffixes
This commit is contained in:
parent
828483393a
commit
38d3d3169a
6 changed files with 40 additions and 42 deletions
|
@ -12,7 +12,7 @@ use roc_types::types::{AliasKind, Category};
|
|||
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
pub fn add_numeric_bound_constr_soa(
|
||||
pub fn add_numeric_bound_constr(
|
||||
constraints: &mut Constraints,
|
||||
num_constraints: &mut impl Extend<Constraint>,
|
||||
num_type: Type,
|
||||
|
@ -41,7 +41,7 @@ pub fn add_numeric_bound_constr_soa(
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn int_literal_soa(
|
||||
pub fn int_literal(
|
||||
constraints: &mut Constraints,
|
||||
num_var: Variable,
|
||||
precision_var: Variable,
|
||||
|
@ -53,7 +53,7 @@ pub fn int_literal_soa(
|
|||
|
||||
// Always add the bound first; this improves the resolved type quality in case it's an alias like "U8".
|
||||
let mut constrs = ArrayVec::<_, 3>::new();
|
||||
let num_type = add_numeric_bound_constr_soa(
|
||||
let num_type = add_numeric_bound_constr(
|
||||
constraints,
|
||||
&mut constrs,
|
||||
Variable(num_var),
|
||||
|
@ -78,7 +78,7 @@ pub fn int_literal_soa(
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn float_literal_soa(
|
||||
pub fn float_literal(
|
||||
constraints: &mut Constraints,
|
||||
num_var: Variable,
|
||||
precision_var: Variable,
|
||||
|
@ -89,7 +89,7 @@ pub fn float_literal_soa(
|
|||
let reason = Reason::FloatLiteral;
|
||||
|
||||
let mut constrs = ArrayVec::<_, 3>::new();
|
||||
let num_type = add_numeric_bound_constr_soa(
|
||||
let num_type = add_numeric_bound_constr(
|
||||
constraints,
|
||||
&mut constrs,
|
||||
Variable(num_var),
|
||||
|
@ -113,7 +113,7 @@ pub fn float_literal_soa(
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn num_literal_soa(
|
||||
pub fn num_literal(
|
||||
constraints: &mut Constraints,
|
||||
num_var: Variable,
|
||||
expected: Expected<Type>,
|
||||
|
@ -123,7 +123,7 @@ pub fn num_literal_soa(
|
|||
let open_number_type = crate::builtins::num_num(Type::Variable(num_var));
|
||||
|
||||
let mut constrs = ArrayVec::<_, 2>::new();
|
||||
let num_type = add_numeric_bound_constr_soa(
|
||||
let num_type = add_numeric_bound_constr(
|
||||
constraints,
|
||||
&mut constrs,
|
||||
open_number_type,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::builtins::{
|
||||
empty_list_type, float_literal_soa, int_literal_soa, list_type, num_literal_soa, num_u32,
|
||||
str_type,
|
||||
empty_list_type, float_literal, int_literal, list_type, num_literal, num_u32, str_type,
|
||||
};
|
||||
use crate::pattern::{constrain_pattern, PatternState};
|
||||
use roc_can::annotation::IntroducedVariables;
|
||||
|
@ -19,23 +18,23 @@ use roc_types::subs::Variable;
|
|||
use roc_types::types::Type::{self, *};
|
||||
use roc_types::types::{AliasKind, AnnotationSource, Category, PReason, Reason, RecordField};
|
||||
|
||||
/// This is for constraining Defs
|
||||
#[derive(Default, Debug)]
|
||||
pub struct Info {
|
||||
pub vars: Vec<Variable>,
|
||||
pub constraints: Vec<Constraint>,
|
||||
pub def_types: SendMap<Symbol, Loc<Type>>,
|
||||
}
|
||||
/// This is for constraining Defs
|
||||
#[derive(Default, Debug)]
|
||||
pub struct Info {
|
||||
pub vars: Vec<Variable>,
|
||||
pub constraints: Vec<Constraint>,
|
||||
pub def_types: SendMap<Symbol, Loc<Type>>,
|
||||
}
|
||||
|
||||
impl Info {
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
Info {
|
||||
vars: Vec::with_capacity(capacity),
|
||||
constraints: Vec::with_capacity(capacity),
|
||||
def_types: SendMap::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Info {
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
Info {
|
||||
vars: Vec::with_capacity(capacity),
|
||||
constraints: Vec::with_capacity(capacity),
|
||||
def_types: SendMap::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Env {
|
||||
/// Whenever we encounter a user-defined type variable (a "rigid" var for short),
|
||||
|
@ -90,11 +89,11 @@ pub fn constrain_expr(
|
|||
) -> Constraint {
|
||||
match expr {
|
||||
&Int(var, precision, _, _, bound) => {
|
||||
int_literal_soa(constraints, var, precision, expected, region, bound)
|
||||
int_literal(constraints, var, precision, expected, region, bound)
|
||||
}
|
||||
&Num(var, _, _, bound) => num_literal_soa(constraints, var, expected, region, bound),
|
||||
&Num(var, _, _, bound) => num_literal(constraints, var, expected, region, bound),
|
||||
&Float(var, precision, _, _, bound) => {
|
||||
float_literal_soa(constraints, var, precision, expected, region, bound)
|
||||
float_literal(constraints, var, precision, expected, region, bound)
|
||||
}
|
||||
EmptyRecord => constrain_empty_record(constraints, region, expected),
|
||||
Expr::Record { record_var, fields } => {
|
||||
|
|
|
@ -16,8 +16,7 @@ pub enum ExposedModuleTypes {
|
|||
Valid(MutMap<Symbol, SolvedType>, MutMap<Symbol, Alias>),
|
||||
}
|
||||
|
||||
|
||||
pub fn constrain_module_soa(
|
||||
pub fn constrain_module(
|
||||
constraints: &mut Constraints,
|
||||
declarations: &[Declaration],
|
||||
home: ModuleId,
|
||||
|
@ -31,7 +30,7 @@ pub struct Import {
|
|||
pub solved_type: SolvedType,
|
||||
}
|
||||
|
||||
pub fn constrain_imported_values_soa(
|
||||
pub fn constrain_imported_values(
|
||||
constraints: &mut Constraints,
|
||||
imports: Vec<Import>,
|
||||
body_con: Constraint,
|
||||
|
@ -88,14 +87,14 @@ pub fn constrain_imported_values_soa(
|
|||
}
|
||||
|
||||
/// Run pre_constrain_imports to get imported_symbols and imported_aliases.
|
||||
pub fn constrain_imports_soa(
|
||||
pub fn constrain_imports(
|
||||
constraints: &mut Constraints,
|
||||
imported_symbols: Vec<Import>,
|
||||
constraint: Constraint,
|
||||
var_store: &mut VarStore,
|
||||
) -> Constraint {
|
||||
let (_introduced_rigids, constraint) =
|
||||
constrain_imported_values_soa(constraints, imported_symbols, constraint, var_store);
|
||||
constrain_imported_values(constraints, imported_symbols, constraint, var_store);
|
||||
|
||||
// TODO determine what to do with those rigids
|
||||
// for var in introduced_rigids {
|
||||
|
|
|
@ -194,7 +194,7 @@ pub fn constrain_pattern(
|
|||
|
||||
let num_type = builtins::num_num(Type::Variable(var));
|
||||
|
||||
let num_type = builtins::add_numeric_bound_constr_soa(
|
||||
let num_type = builtins::add_numeric_bound_constr(
|
||||
constraints,
|
||||
&mut state.constraints,
|
||||
num_type,
|
||||
|
@ -214,7 +214,7 @@ pub fn constrain_pattern(
|
|||
&IntLiteral(num_var, precision_var, _, _, bound) => {
|
||||
// First constraint on the free num var; this improves the resolved type quality in
|
||||
// case the bound is an alias.
|
||||
let num_type = builtins::add_numeric_bound_constr_soa(
|
||||
let num_type = builtins::add_numeric_bound_constr(
|
||||
constraints,
|
||||
&mut state.constraints,
|
||||
Type::Variable(num_var),
|
||||
|
@ -245,7 +245,7 @@ pub fn constrain_pattern(
|
|||
&FloatLiteral(num_var, precision_var, _, _, bound) => {
|
||||
// First constraint on the free num var; this improves the resolved type quality in
|
||||
// case the bound is an alias.
|
||||
let num_type = builtins::add_numeric_bound_constr_soa(
|
||||
let num_type = builtins::add_numeric_bound_constr(
|
||||
constraints,
|
||||
&mut state.constraints,
|
||||
Type::Variable(num_var),
|
||||
|
|
|
@ -10,7 +10,7 @@ use roc_can::def::Declaration;
|
|||
use roc_can::module::{canonicalize_module_defs, Module};
|
||||
use roc_collections::all::{default_hasher, BumpMap, MutMap, MutSet};
|
||||
use roc_constrain::module::{
|
||||
constrain_imports_soa, constrain_module_soa, pre_constrain_imports, ConstrainableImports,
|
||||
constrain_imports, constrain_module, pre_constrain_imports, ConstrainableImports,
|
||||
ExposedModuleTypes, Import, SubsByModule,
|
||||
};
|
||||
use roc_module::ident::{Ident, ModuleName, QualifiedModuleName};
|
||||
|
@ -3091,7 +3091,7 @@ fn run_solve<'a>(
|
|||
|
||||
// Finish constraining the module by wrapping the existing Constraint
|
||||
// in the ones we just computed. We can do this off the main thread.
|
||||
let constraint = constrain_imports_soa(
|
||||
let constraint = constrain_imports(
|
||||
&mut constraints,
|
||||
imported_symbols,
|
||||
constraint,
|
||||
|
@ -3113,7 +3113,7 @@ fn run_solve<'a>(
|
|||
// if false { debug_assert!(constraint.validate(), "{:?}", &constraint); }
|
||||
|
||||
let (solved_subs, solved_env, problems) =
|
||||
roc_solve::module::run_solve_soa(&constraints, constraint, rigid_variables, var_store);
|
||||
roc_solve::module::run_solve(&constraints, constraint, rigid_variables, var_store);
|
||||
|
||||
let exposed_vars_by_symbol: Vec<_> = solved_env
|
||||
.vars_by_symbol()
|
||||
|
@ -3260,7 +3260,7 @@ fn canonicalize_and_constrain<'a>(
|
|||
|
||||
let mut constraints = Constraints::new();
|
||||
let constraint =
|
||||
constrain_module_soa(&mut constraints, &module_output.declarations, module_id);
|
||||
constrain_module(&mut constraints, &module_output.declarations, module_id);
|
||||
|
||||
let module = Module {
|
||||
module_id,
|
||||
|
|
|
@ -16,7 +16,7 @@ pub struct SolvedModule {
|
|||
pub problems: Vec<solve::TypeError>,
|
||||
}
|
||||
|
||||
pub fn run_solve_soa(
|
||||
pub fn run_solve(
|
||||
constraints: &Constraints,
|
||||
constraint: ConstraintSoa,
|
||||
rigid_variables: MutMap<Variable, Lowercase>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue