mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 00:09:33 +03:00
Remove Lowercase from Alias and Opaque
This commit is contained in:
parent
452b882f12
commit
83c6c3a17d
@ -27,7 +27,7 @@ use crate::{
|
||||
},
|
||||
env::Env,
|
||||
},
|
||||
mem_pool::{pool::Pool, pool_str::PoolStr, pool_vec::PoolVec, shallow_clone::ShallowClone},
|
||||
mem_pool::{pool::Pool, pool_vec::PoolVec, shallow_clone::ShallowClone},
|
||||
};
|
||||
|
||||
/// A presence constraint is an additive constraint that defines the lower bound
|
||||
@ -1846,7 +1846,7 @@ fn num_float(pool: &mut Pool, range: TypeId) -> Type2 {
|
||||
|
||||
Type2::Alias(
|
||||
Symbol::NUM_FLOAT,
|
||||
PoolVec::new(vec![(PoolStr::new("range", pool), range)].into_iter(), pool),
|
||||
PoolVec::new(vec![range].into_iter(), pool),
|
||||
num_num_id,
|
||||
)
|
||||
}
|
||||
@ -1859,7 +1859,7 @@ fn num_floatingpoint(pool: &mut Pool, range: TypeId) -> Type2 {
|
||||
|
||||
Type2::Opaque(
|
||||
Symbol::NUM_FLOATINGPOINT,
|
||||
PoolVec::new(vec![(PoolStr::new("range", pool), range)].into_iter(), pool),
|
||||
PoolVec::new(vec![range].into_iter(), pool),
|
||||
pool.add(alias_content),
|
||||
)
|
||||
}
|
||||
@ -1874,7 +1874,7 @@ fn num_int(pool: &mut Pool, range: TypeId) -> Type2 {
|
||||
|
||||
Type2::Alias(
|
||||
Symbol::NUM_INT,
|
||||
PoolVec::new(vec![(PoolStr::new("range", pool), range)].into_iter(), pool),
|
||||
PoolVec::new(vec![range].into_iter(), pool),
|
||||
num_num_id,
|
||||
)
|
||||
}
|
||||
@ -1907,7 +1907,7 @@ fn _num_integer(pool: &mut Pool, range: TypeId) -> Type2 {
|
||||
|
||||
Type2::Opaque(
|
||||
Symbol::NUM_INTEGER,
|
||||
PoolVec::new(vec![(PoolStr::new("range", pool), range)].into_iter(), pool),
|
||||
PoolVec::new(vec![range].into_iter(), pool),
|
||||
pool.add(alias_content),
|
||||
)
|
||||
}
|
||||
@ -1920,10 +1920,7 @@ fn num_num(pool: &mut Pool, type_id: TypeId) -> Type2 {
|
||||
|
||||
Type2::Opaque(
|
||||
Symbol::NUM_NUM,
|
||||
PoolVec::new(
|
||||
vec![(PoolStr::new("range", pool), type_id)].into_iter(),
|
||||
pool,
|
||||
),
|
||||
PoolVec::new(vec![type_id].into_iter(), pool),
|
||||
pool.add(alias_content),
|
||||
)
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ pub type TypeId = NodeId<Type2>;
|
||||
pub enum Type2 {
|
||||
Variable(Variable), // 4B
|
||||
|
||||
Alias(Symbol, PoolVec<(PoolStr, TypeId)>, TypeId), // 24B = 8B + 8B + 4B + pad
|
||||
Opaque(Symbol, PoolVec<(PoolStr, TypeId)>, TypeId), // 24B = 8B + 8B + 4B + pad
|
||||
Alias(Symbol, PoolVec<TypeId>, TypeId), // 24B = 8B + 8B + 4B + pad
|
||||
Opaque(Symbol, PoolVec<TypeId>, TypeId), // 24B = 8B + 8B + 4B + pad
|
||||
AsAlias(Symbol, PoolVec<(PoolStr, TypeId)>, TypeId), // 24B = 8B + 8B + 4B + pad
|
||||
|
||||
// 24B
|
||||
@ -736,7 +736,7 @@ fn can_tags<'a>(
|
||||
|
||||
enum TypeApply {
|
||||
Apply(Symbol, PoolVec<Type2>),
|
||||
Alias(Symbol, PoolVec<(PoolStr, TypeId)>, TypeId),
|
||||
Alias(Symbol, PoolVec<TypeId>, TypeId),
|
||||
Erroneous(roc_types::types::Problem),
|
||||
}
|
||||
|
||||
@ -838,7 +838,17 @@ fn to_type_apply<'a>(
|
||||
// instantiate variables
|
||||
Type2::substitute(env.pool, &substitutions, actual);
|
||||
|
||||
TypeApply::Alias(symbol, arguments, actual)
|
||||
let type_arguments = PoolVec::with_capacity(arguments.len() as u32, env.pool);
|
||||
|
||||
for (node_id, type_id) in arguments
|
||||
.iter_node_ids()
|
||||
.zip(type_arguments.iter_node_ids())
|
||||
{
|
||||
let typ = env.pool[node_id].1;
|
||||
env.pool[type_id] = typ;
|
||||
}
|
||||
|
||||
TypeApply::Alias(symbol, type_arguments, actual)
|
||||
}
|
||||
None => TypeApply::Apply(symbol, argument_type_ids),
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ fn to_type2(
|
||||
SolvedType::Alias(symbol, solved_type_variables, _todo, solved_actual, _kind) => {
|
||||
let type_variables = PoolVec::with_capacity(solved_type_variables.len() as u32, pool);
|
||||
|
||||
for (type_variable_node_id, (lowercase, solved_arg)) in type_variables
|
||||
for (type_variable_node_id, solved_arg) in type_variables
|
||||
.iter_node_ids()
|
||||
.zip(solved_type_variables.iter())
|
||||
{
|
||||
@ -56,7 +56,7 @@ fn to_type2(
|
||||
|
||||
let node = pool.add(typ2);
|
||||
|
||||
pool[type_variable_node_id] = (PoolStr::new(lowercase.as_str(), pool), node);
|
||||
pool[type_variable_node_id] = node;
|
||||
}
|
||||
|
||||
let actual_typ2 = to_type2(pool, solved_actual, free_vars, var_store);
|
||||
|
@ -899,7 +899,7 @@ fn type_to_variable<'a>(
|
||||
|
||||
let mut arg_vars = Vec::with_capacity(args.len());
|
||||
|
||||
for (_, arg_type_id) in args.iter(mempool) {
|
||||
for arg_type_id in args.iter(mempool) {
|
||||
let arg_type = mempool.get(*arg_type_id);
|
||||
|
||||
let arg_var = type_to_variable(arena, mempool, subs, rank, pools, cached, arg_type);
|
||||
|
@ -597,20 +597,20 @@ fn can_annotation_help(
|
||||
let var_name = Lowercase::from(var);
|
||||
|
||||
if let Some(var) = introduced_variables.var_by_name(&var_name) {
|
||||
vars.push((var_name.clone(), Type::Variable(var)));
|
||||
vars.push(Type::Variable(var));
|
||||
lowercase_vars.push(Loc::at(loc_var.region, (var_name, var)));
|
||||
} else {
|
||||
let var = var_store.fresh();
|
||||
|
||||
introduced_variables
|
||||
.insert_named(var_name.clone(), Loc::at(loc_var.region, var));
|
||||
vars.push((var_name.clone(), Type::Variable(var)));
|
||||
vars.push(Type::Variable(var));
|
||||
|
||||
lowercase_vars.push(Loc::at(loc_var.region, (var_name, var)));
|
||||
}
|
||||
}
|
||||
|
||||
let alias_args = vars.iter().map(|(_, v)| v.clone()).collect::<Vec<_>>();
|
||||
let alias_args = vars.clone();
|
||||
|
||||
let alias_actual = if let Type::TagUnion(tags, ext) = inner_type {
|
||||
let rec_var = var_store.fresh();
|
||||
|
@ -1788,7 +1788,10 @@ fn make_tag_union_of_alias_recursive<'a>(
|
||||
|
||||
let made_recursive = make_tag_union_recursive_help(
|
||||
env,
|
||||
Loc::at(alias.header_region(), (alias_name, &alias_args)),
|
||||
Loc::at(
|
||||
alias.header_region(),
|
||||
(alias_name, alias_args.iter().map(|ta| &ta.1)),
|
||||
),
|
||||
alias.region,
|
||||
others,
|
||||
&mut alias.typ,
|
||||
@ -1835,12 +1838,12 @@ enum MakeTagUnionRecursive {
|
||||
/// ```
|
||||
///
|
||||
/// When `Err` is returned, a problem will be added to `env`.
|
||||
fn make_tag_union_recursive_help<'a>(
|
||||
fn make_tag_union_recursive_help<'a, 'b>(
|
||||
env: &mut Env<'a>,
|
||||
recursive_alias: Loc<(Symbol, &[(Lowercase, Type)])>,
|
||||
recursive_alias: Loc<(Symbol, impl Iterator<Item = &'b Type>)>,
|
||||
region: Region,
|
||||
others: Vec<Symbol>,
|
||||
typ: &mut Type,
|
||||
typ: &'b mut Type,
|
||||
var_store: &mut VarStore,
|
||||
can_report_cyclic_error: &mut bool,
|
||||
) -> MakeTagUnionRecursive {
|
||||
@ -1852,7 +1855,7 @@ fn make_tag_union_recursive_help<'a>(
|
||||
match typ {
|
||||
Type::TagUnion(tags, ext) => {
|
||||
let recursion_variable = var_store.fresh();
|
||||
let type_arguments = args.iter().map(|(_, t)| t.clone()).collect::<Vec<_>>();
|
||||
let type_arguments: Vec<_> = args.into_iter().cloned().collect();
|
||||
|
||||
let mut pending_typ =
|
||||
Type::RecursiveTagUnion(recursion_variable, tags.to_vec(), ext.clone());
|
||||
@ -1890,7 +1893,7 @@ fn make_tag_union_recursive_help<'a>(
|
||||
// try to make `actual` recursive
|
||||
make_tag_union_recursive_help(
|
||||
env,
|
||||
Loc::at_zero((symbol, type_arguments)),
|
||||
Loc::at_zero((symbol, type_arguments.iter())),
|
||||
region,
|
||||
others,
|
||||
actual,
|
||||
|
@ -184,7 +184,6 @@ fn build_effect_always(
|
||||
|
||||
let effect_a = build_effect_opaque(
|
||||
effect_symbol,
|
||||
"a",
|
||||
var_a,
|
||||
Type::Variable(var_a),
|
||||
var_store,
|
||||
@ -362,7 +361,6 @@ fn build_effect_map(
|
||||
|
||||
let effect_a = build_effect_opaque(
|
||||
effect_symbol,
|
||||
"a",
|
||||
var_a,
|
||||
Type::Variable(var_a),
|
||||
var_store,
|
||||
@ -371,7 +369,6 @@ fn build_effect_map(
|
||||
|
||||
let effect_b = build_effect_opaque(
|
||||
effect_symbol,
|
||||
"b",
|
||||
var_b,
|
||||
Type::Variable(var_b),
|
||||
var_store,
|
||||
@ -515,7 +512,6 @@ fn build_effect_after(
|
||||
|
||||
let effect_a = build_effect_opaque(
|
||||
effect_symbol,
|
||||
"a",
|
||||
var_a,
|
||||
Type::Variable(var_a),
|
||||
var_store,
|
||||
@ -524,7 +520,6 @@ fn build_effect_after(
|
||||
|
||||
let effect_b = build_effect_opaque(
|
||||
effect_symbol,
|
||||
"b",
|
||||
var_b,
|
||||
Type::Variable(var_b),
|
||||
var_store,
|
||||
@ -758,7 +753,6 @@ fn build_effect_forever(
|
||||
|
||||
let effect_a = build_effect_opaque(
|
||||
effect_symbol,
|
||||
"a",
|
||||
var_a,
|
||||
Type::Variable(var_a),
|
||||
var_store,
|
||||
@ -767,7 +761,6 @@ fn build_effect_forever(
|
||||
|
||||
let effect_b = build_effect_opaque(
|
||||
effect_symbol,
|
||||
"b",
|
||||
var_b,
|
||||
Type::Variable(var_b),
|
||||
var_store,
|
||||
@ -985,7 +978,6 @@ fn build_effect_loop(
|
||||
|
||||
let effect_b = build_effect_opaque(
|
||||
effect_symbol,
|
||||
"b",
|
||||
var_b,
|
||||
Type::Variable(var_b),
|
||||
var_store,
|
||||
@ -1017,7 +1009,7 @@ fn build_effect_loop(
|
||||
|
||||
Type::Alias {
|
||||
symbol: effect_symbol,
|
||||
type_arguments: vec![("a".into(), state_type)],
|
||||
type_arguments: vec![state_type],
|
||||
lambda_set_variables: vec![roc_types::types::LambdaSet(Type::Variable(
|
||||
closure_var,
|
||||
))],
|
||||
@ -1440,7 +1432,6 @@ pub fn build_effect_actual(a_type: Type, var_store: &mut VarStore) -> Type {
|
||||
/// Effect a := {} -> a
|
||||
fn build_effect_opaque(
|
||||
effect_symbol: Symbol,
|
||||
a_name: &str,
|
||||
a_var: Variable,
|
||||
a_type: Type,
|
||||
var_store: &mut VarStore,
|
||||
@ -1457,7 +1448,7 @@ fn build_effect_opaque(
|
||||
|
||||
Type::Alias {
|
||||
symbol: effect_symbol,
|
||||
type_arguments: vec![(a_name.into(), Type::Variable(a_var))],
|
||||
type_arguments: vec![Type::Variable(a_var)],
|
||||
lambda_set_variables: vec![roc_types::types::LambdaSet(Type::Variable(closure_var))],
|
||||
actual: Box::new(actual),
|
||||
kind: AliasKind::Opaque,
|
||||
|
@ -2,7 +2,6 @@ use arrayvec::ArrayVec;
|
||||
use roc_can::constraint::{Constraint, Constraints};
|
||||
use roc_can::expected::Expected::{self, *};
|
||||
use roc_can::num::{FloatBound, FloatWidth, IntBound, IntWidth, NumericBound, SignDemand};
|
||||
use roc_module::ident::Lowercase;
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_region::all::Region;
|
||||
use roc_types::subs::Variable;
|
||||
@ -161,7 +160,7 @@ pub fn str_type() -> Type {
|
||||
#[inline(always)]
|
||||
fn builtin_alias(
|
||||
symbol: Symbol,
|
||||
type_arguments: Vec<(Lowercase, Type)>,
|
||||
type_arguments: Vec<Type>,
|
||||
actual: Box<Type>,
|
||||
kind: AliasKind,
|
||||
) -> Type {
|
||||
@ -178,7 +177,7 @@ fn builtin_alias(
|
||||
pub fn num_float(range: Type) -> Type {
|
||||
builtin_alias(
|
||||
Symbol::NUM_FLOAT,
|
||||
vec![("range".into(), range.clone())],
|
||||
vec![range.clone()],
|
||||
Box::new(num_num(num_floatingpoint(range))),
|
||||
AliasKind::Structural,
|
||||
)
|
||||
@ -188,7 +187,7 @@ pub fn num_float(range: Type) -> Type {
|
||||
pub fn num_floatingpoint(range: Type) -> Type {
|
||||
builtin_alias(
|
||||
Symbol::NUM_FLOATINGPOINT,
|
||||
vec![("range".into(), range.clone())],
|
||||
vec![range.clone()],
|
||||
Box::new(range),
|
||||
AliasKind::Opaque,
|
||||
)
|
||||
@ -228,7 +227,7 @@ pub fn num_binary64() -> Type {
|
||||
pub fn num_int(range: Type) -> Type {
|
||||
builtin_alias(
|
||||
Symbol::NUM_INT,
|
||||
vec![("range".into(), range.clone())],
|
||||
vec![range.clone()],
|
||||
Box::new(num_num(num_integer(range))),
|
||||
AliasKind::Structural,
|
||||
)
|
||||
@ -248,7 +247,7 @@ pub fn num_signed64() -> Type {
|
||||
pub fn num_integer(range: Type) -> Type {
|
||||
builtin_alias(
|
||||
Symbol::NUM_INTEGER,
|
||||
vec![("range".into(), range.clone())],
|
||||
vec![range.clone()],
|
||||
Box::new(range),
|
||||
AliasKind::Opaque,
|
||||
)
|
||||
@ -258,7 +257,7 @@ pub fn num_integer(range: Type) -> Type {
|
||||
pub fn num_num(typ: Type) -> Type {
|
||||
builtin_alias(
|
||||
Symbol::NUM_NUM,
|
||||
vec![("range".into(), typ.clone())],
|
||||
vec![typ.clone()],
|
||||
Box::new(typ),
|
||||
AliasKind::Opaque,
|
||||
)
|
||||
|
@ -1022,10 +1022,7 @@ pub fn constrain_expr(
|
||||
|
||||
let opaque_type = Type::Alias {
|
||||
symbol: *name,
|
||||
type_arguments: type_arguments
|
||||
.iter()
|
||||
.map(|v| ("".into(), Type::Variable(*v)))
|
||||
.collect(),
|
||||
type_arguments: type_arguments.iter().copied().map(Type::Variable).collect(),
|
||||
lambda_set_variables: lambda_set_variables.clone(),
|
||||
actual: Box::new(arg_type.clone()),
|
||||
kind: AliasKind::Opaque,
|
||||
|
@ -514,10 +514,7 @@ pub fn constrain_pattern(
|
||||
|
||||
let opaque_type = Type::Alias {
|
||||
symbol: *opaque,
|
||||
type_arguments: type_arguments
|
||||
.iter()
|
||||
.map(|v| ("".into(), Type::Variable(*v)))
|
||||
.collect(),
|
||||
type_arguments: type_arguments.iter().copied().map(Type::Variable).collect(),
|
||||
lambda_set_variables: lambda_set_variables.clone(),
|
||||
actual: Box::new(arg_pattern_type.clone()),
|
||||
kind: AliasKind::Opaque,
|
||||
|
@ -16,7 +16,7 @@ use roc_constrain::module::{
|
||||
ExposedModuleTypes,
|
||||
};
|
||||
use roc_error_macros::internal_error;
|
||||
use roc_module::ident::{Ident, ModuleName, QualifiedModuleName, TagName};
|
||||
use roc_module::ident::{Ident, ModuleName, QualifiedModuleName};
|
||||
use roc_module::symbol::{
|
||||
IdentIds, IdentIdsByModule, Interns, ModuleId, ModuleIds, PQModuleName, PackageModuleIds,
|
||||
PackageQualified, Symbol,
|
||||
|
@ -372,19 +372,24 @@ impl Aliases {
|
||||
AliasKind::Opaque => {
|
||||
// For opaques, the instantiation must be to an opaque type rather than just what's
|
||||
// on the RHS.
|
||||
let lambda_set_variables = new_lambda_set_variables
|
||||
.iter()
|
||||
.copied()
|
||||
.map(Type::Variable)
|
||||
.map(LambdaSet)
|
||||
.collect();
|
||||
let type_arguments = new_type_variables
|
||||
.clone()
|
||||
.iter()
|
||||
.copied()
|
||||
.map(Type::Variable)
|
||||
.collect();
|
||||
|
||||
let opaq = Type::Alias {
|
||||
symbol,
|
||||
kind: *kind,
|
||||
lambda_set_variables: new_lambda_set_variables
|
||||
.iter()
|
||||
.copied()
|
||||
.map(Type::Variable)
|
||||
.map(LambdaSet)
|
||||
.collect(),
|
||||
type_arguments: new_type_variables
|
||||
.iter()
|
||||
.map(|v| ("".into(), Type::Variable(*v)))
|
||||
.collect(),
|
||||
lambda_set_variables,
|
||||
type_arguments,
|
||||
actual: Box::new(typ.clone()),
|
||||
};
|
||||
|
||||
@ -1971,9 +1976,7 @@ fn type_to_variable<'a>(
|
||||
let length = type_arguments.len() + lambda_set_variables.len();
|
||||
let new_variables = VariableSubsSlice::reserve_into_subs(subs, length);
|
||||
|
||||
for (target_index, (_, arg_type)) in
|
||||
(new_variables.indices()).zip(type_arguments)
|
||||
{
|
||||
for (target_index, arg_type) in (new_variables.indices()).zip(type_arguments) {
|
||||
let copy_var = helper!(arg_type);
|
||||
subs.variables[target_index] = copy_var;
|
||||
}
|
||||
@ -2013,9 +2016,7 @@ fn type_to_variable<'a>(
|
||||
let length = type_arguments.len() + lambda_set_variables.len();
|
||||
let new_variables = VariableSubsSlice::reserve_into_subs(subs, length);
|
||||
|
||||
for (target_index, (_, arg_type)) in
|
||||
(new_variables.indices()).zip(type_arguments)
|
||||
{
|
||||
for (target_index, arg_type) in (new_variables.indices()).zip(type_arguments) {
|
||||
let copy_var = helper!(arg_type);
|
||||
subs.variables[target_index] = copy_var;
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ pub fn flex(tvar: VarId) -> SolvedType {
|
||||
pub fn num_type(range: SolvedType) -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::NUM_NUM,
|
||||
vec![("range".into(), range.clone())],
|
||||
vec![(range.clone())],
|
||||
vec![],
|
||||
Box::new(num_alias_content(range)),
|
||||
AliasKind::Opaque,
|
||||
@ -399,7 +399,7 @@ fn num_alias_content(range: SolvedType) -> SolvedType {
|
||||
pub fn floatingpoint_type(range: SolvedType) -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::NUM_FLOATINGPOINT,
|
||||
vec![("range".into(), range.clone())],
|
||||
vec![(range.clone())],
|
||||
vec![],
|
||||
Box::new(floatingpoint_alias_content(range)),
|
||||
AliasKind::Opaque,
|
||||
@ -417,7 +417,7 @@ fn floatingpoint_alias_content(range: SolvedType) -> SolvedType {
|
||||
pub fn float_type(range: SolvedType) -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::NUM_FLOAT,
|
||||
vec![("range".into(), range.clone())],
|
||||
vec![(range.clone())],
|
||||
vec![],
|
||||
Box::new(float_alias_content(range)),
|
||||
AliasKind::Structural,
|
||||
@ -669,7 +669,7 @@ fn i8_alias_content() -> SolvedType {
|
||||
pub fn int_type(range: SolvedType) -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::NUM_INT,
|
||||
vec![("range".into(), range.clone())],
|
||||
vec![(range.clone())],
|
||||
vec![],
|
||||
Box::new(int_alias_content(range)),
|
||||
AliasKind::Structural,
|
||||
@ -687,7 +687,7 @@ fn int_alias_content(range: SolvedType) -> SolvedType {
|
||||
pub fn integer_type(range: SolvedType) -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::NUM_INTEGER,
|
||||
vec![("range".into(), range.clone())],
|
||||
vec![(range.clone())],
|
||||
vec![],
|
||||
Box::new(integer_alias_content(range)),
|
||||
AliasKind::Opaque,
|
||||
@ -979,7 +979,7 @@ pub fn ordering_type() -> SolvedType {
|
||||
pub fn result_type(a: SolvedType, e: SolvedType) -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::RESULT_RESULT,
|
||||
vec![("ok".into(), a.clone()), ("err".into(), e.clone())],
|
||||
vec![a.clone(), e.clone()],
|
||||
vec![],
|
||||
Box::new(result_alias_content(a, e)),
|
||||
AliasKind::Structural,
|
||||
|
@ -55,7 +55,7 @@ pub enum SolvedType {
|
||||
|
||||
Alias(
|
||||
Symbol,
|
||||
Vec<(Lowercase, SolvedType)>,
|
||||
Vec<SolvedType>,
|
||||
Vec<SolvedLambdaSet>,
|
||||
Box<SolvedType>,
|
||||
AliasKind,
|
||||
@ -63,7 +63,7 @@ pub enum SolvedType {
|
||||
|
||||
HostExposedAlias {
|
||||
name: Symbol,
|
||||
arguments: Vec<(Lowercase, SolvedType)>,
|
||||
arguments: Vec<SolvedType>,
|
||||
lambda_set_variables: Vec<SolvedLambdaSet>,
|
||||
actual_var: VarId,
|
||||
actual: Box<SolvedType>,
|
||||
@ -212,8 +212,8 @@ pub fn to_type(
|
||||
Alias(symbol, solved_type_variables, solved_lambda_sets, solved_actual, kind) => {
|
||||
let mut type_variables = Vec::with_capacity(solved_type_variables.len());
|
||||
|
||||
for (lowercase, solved_arg) in solved_type_variables {
|
||||
type_variables.push((lowercase.clone(), to_type(solved_arg, free_vars, var_store)));
|
||||
for solved_arg in solved_type_variables {
|
||||
type_variables.push(to_type(solved_arg, free_vars, var_store));
|
||||
}
|
||||
|
||||
let mut lambda_set_variables = Vec::with_capacity(solved_lambda_sets.len());
|
||||
@ -244,8 +244,8 @@ pub fn to_type(
|
||||
} => {
|
||||
let mut type_variables = Vec::with_capacity(solved_type_variables.len());
|
||||
|
||||
for (lowercase, solved_arg) in solved_type_variables {
|
||||
type_variables.push((lowercase.clone(), to_type(solved_arg, free_vars, var_store)));
|
||||
for solved_arg in solved_type_variables {
|
||||
type_variables.push(to_type(solved_arg, free_vars, var_store));
|
||||
}
|
||||
|
||||
let mut lambda_set_variables = Vec::with_capacity(solved_lambda_sets.len());
|
||||
|
@ -208,14 +208,14 @@ pub enum Type {
|
||||
DelayedAlias(AliasCommon),
|
||||
Alias {
|
||||
symbol: Symbol,
|
||||
type_arguments: Vec<(Lowercase, Type)>,
|
||||
type_arguments: Vec<Type>,
|
||||
lambda_set_variables: Vec<LambdaSet>,
|
||||
actual: Box<Type>,
|
||||
kind: AliasKind,
|
||||
},
|
||||
HostExposedAlias {
|
||||
name: Symbol,
|
||||
type_arguments: Vec<(Lowercase, Type)>,
|
||||
type_arguments: Vec<Type>,
|
||||
lambda_set_variables: Vec<LambdaSet>,
|
||||
actual_var: Variable,
|
||||
actual: Box<Type>,
|
||||
@ -409,7 +409,7 @@ impl fmt::Debug for Type {
|
||||
} => {
|
||||
write!(f, "(Alias {:?}", symbol)?;
|
||||
|
||||
for (_, arg) in type_arguments {
|
||||
for arg in type_arguments {
|
||||
write!(f, " {:?}", arg)?;
|
||||
}
|
||||
|
||||
@ -433,7 +433,7 @@ impl fmt::Debug for Type {
|
||||
} => {
|
||||
write!(f, "HostExposedAlias {:?}", name)?;
|
||||
|
||||
for (_, arg) in arguments {
|
||||
for arg in arguments {
|
||||
write!(f, " {:?}", arg)?;
|
||||
}
|
||||
|
||||
@ -708,7 +708,7 @@ impl Type {
|
||||
actual,
|
||||
..
|
||||
} => {
|
||||
for (_, value) in type_arguments.iter_mut() {
|
||||
for value in type_arguments.iter_mut() {
|
||||
stack.push(value);
|
||||
}
|
||||
|
||||
@ -724,7 +724,7 @@ impl Type {
|
||||
actual: actual_type,
|
||||
..
|
||||
} => {
|
||||
for (_, value) in type_arguments.iter_mut() {
|
||||
for value in type_arguments.iter_mut() {
|
||||
stack.push(value);
|
||||
}
|
||||
|
||||
@ -817,7 +817,7 @@ impl Type {
|
||||
actual,
|
||||
..
|
||||
} => {
|
||||
for (_, value) in type_arguments.iter_mut() {
|
||||
for value in type_arguments.iter_mut() {
|
||||
stack.push(value);
|
||||
}
|
||||
for lambda_set in lambda_set_variables.iter_mut() {
|
||||
@ -832,7 +832,7 @@ impl Type {
|
||||
actual: actual_type,
|
||||
..
|
||||
} => {
|
||||
for (_, value) in type_arguments.iter_mut() {
|
||||
for value in type_arguments.iter_mut() {
|
||||
stack.push(value);
|
||||
}
|
||||
|
||||
@ -914,7 +914,7 @@ impl Type {
|
||||
actual: alias_actual,
|
||||
..
|
||||
} => {
|
||||
for (_, ta) in type_arguments {
|
||||
for ta in type_arguments {
|
||||
ta.substitute_alias(rep_symbol, rep_args, actual)?;
|
||||
}
|
||||
alias_actual.substitute_alias(rep_symbol, rep_args, actual)
|
||||
@ -1139,8 +1139,7 @@ impl Type {
|
||||
..
|
||||
} => {
|
||||
for arg in type_args {
|
||||
arg.1
|
||||
.instantiate_aliases(region, aliases, var_store, new_lambda_set_variables);
|
||||
arg.instantiate_aliases(region, aliases, var_store, new_lambda_set_variables);
|
||||
}
|
||||
|
||||
for arg in lambda_set_variables {
|
||||
@ -1202,7 +1201,7 @@ impl Type {
|
||||
// TODO substitute further in args
|
||||
for (
|
||||
Loc {
|
||||
value: (lowercase, placeholder),
|
||||
value: (_, placeholder),
|
||||
..
|
||||
},
|
||||
filler,
|
||||
@ -1215,7 +1214,7 @@ impl Type {
|
||||
var_store,
|
||||
new_lambda_set_variables,
|
||||
);
|
||||
named_args.push((lowercase.clone(), filler.clone()));
|
||||
named_args.push(filler.clone());
|
||||
substitution.insert(*placeholder, filler);
|
||||
}
|
||||
|
||||
@ -1500,7 +1499,7 @@ fn variables_help(tipe: &Type, accum: &mut ImSet<Variable>) {
|
||||
actual,
|
||||
..
|
||||
} => {
|
||||
for (_, arg) in type_arguments {
|
||||
for arg in type_arguments {
|
||||
variables_help(arg, accum);
|
||||
}
|
||||
variables_help(actual, accum);
|
||||
@ -1510,7 +1509,7 @@ fn variables_help(tipe: &Type, accum: &mut ImSet<Variable>) {
|
||||
actual,
|
||||
..
|
||||
} => {
|
||||
for (_, arg) in arguments {
|
||||
for arg in arguments {
|
||||
variables_help(arg, accum);
|
||||
}
|
||||
variables_help(actual, accum);
|
||||
@ -1636,7 +1635,7 @@ fn variables_help_detailed(tipe: &Type, accum: &mut VariableDetail) {
|
||||
actual,
|
||||
..
|
||||
} => {
|
||||
for (_, arg) in type_arguments {
|
||||
for arg in type_arguments {
|
||||
variables_help_detailed(arg, accum);
|
||||
}
|
||||
variables_help_detailed(actual, accum);
|
||||
@ -1646,7 +1645,7 @@ fn variables_help_detailed(tipe: &Type, accum: &mut VariableDetail) {
|
||||
actual,
|
||||
..
|
||||
} => {
|
||||
for (_, arg) in arguments {
|
||||
for arg in arguments {
|
||||
variables_help_detailed(arg, accum);
|
||||
}
|
||||
variables_help_detailed(actual, accum);
|
||||
|
Loading…
Reference in New Issue
Block a user