mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
renaming
This commit is contained in:
parent
fc4212310f
commit
1b66247303
1 changed files with 19 additions and 14 deletions
|
@ -222,12 +222,17 @@ enum Work<'a> {
|
||||||
constraint: &'a Constraint,
|
constraint: &'a Constraint,
|
||||||
},
|
},
|
||||||
CheckForInfiniteTypes(LocalDefVarsVec<(Symbol, Loc<Variable>)>),
|
CheckForInfiniteTypes(LocalDefVarsVec<(Symbol, Loc<Variable>)>),
|
||||||
LetConSimple {
|
/// The ret_con part of a let constraint that does NOT introduces rigid and/or flex variables
|
||||||
|
LetConNoVariables {
|
||||||
env: &'a Env,
|
env: &'a Env,
|
||||||
rank: Rank,
|
rank: Rank,
|
||||||
let_con: &'a LetConstraint,
|
let_con: &'a LetConstraint,
|
||||||
},
|
},
|
||||||
LetConComplex {
|
/// The ret_con part of a let constraint that introduces rigid and/or flex variables
|
||||||
|
///
|
||||||
|
/// These introduced variables must be generalized, hence this variant
|
||||||
|
/// is more complex than `LetConNoVariables`.
|
||||||
|
LetConIntroducesVariables {
|
||||||
env: &'a Env,
|
env: &'a Env,
|
||||||
rank: Rank,
|
rank: Rank,
|
||||||
let_con: &'a LetConstraint,
|
let_con: &'a LetConstraint,
|
||||||
|
@ -274,7 +279,7 @@ fn solve(
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Work::LetConSimple { env, rank, let_con } => {
|
Work::LetConNoVariables { env, rank, let_con } => {
|
||||||
// NOTE be extremely careful with shadowing here
|
// NOTE be extremely careful with shadowing here
|
||||||
let offset = let_con.defs_and_ret_constraint.index();
|
let offset = let_con.defs_and_ret_constraint.index();
|
||||||
let ret_constraint = &constraints.constraints[offset + 1];
|
let ret_constraint = &constraints.constraints[offset + 1];
|
||||||
|
@ -298,18 +303,16 @@ fn solve(
|
||||||
stack.push(Work::Constraint {
|
stack.push(Work::Constraint {
|
||||||
env: arena.alloc(new_env),
|
env: arena.alloc(new_env),
|
||||||
rank,
|
rank,
|
||||||
constraint: &ret_constraint,
|
constraint: ret_constraint,
|
||||||
});
|
});
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Work::LetConComplex { env, rank, let_con } => {
|
Work::LetConIntroducesVariables { env, rank, let_con } => {
|
||||||
// NOTE be extremely careful with shadowing here
|
// NOTE be extremely careful with shadowing here
|
||||||
let offset = let_con.defs_and_ret_constraint.index();
|
let offset = let_con.defs_and_ret_constraint.index();
|
||||||
let ret_constraint = &constraints.constraints[offset + 1];
|
let ret_constraint = &constraints.constraints[offset + 1];
|
||||||
|
|
||||||
let rigid_vars = &constraints.variables[let_con.rigid_vars.indices()];
|
|
||||||
|
|
||||||
let next_rank = rank.next();
|
let next_rank = rank.next();
|
||||||
|
|
||||||
let mark = state.mark;
|
let mark = state.mark;
|
||||||
|
@ -361,6 +364,8 @@ fn solve(
|
||||||
// inference, and does not come from elm. It's unclear whether this is
|
// inference, and does not come from elm. It's unclear whether this is
|
||||||
// a bug with uniqueness inference (something is redundant that
|
// a bug with uniqueness inference (something is redundant that
|
||||||
// shouldn't be) or that it just never came up in elm.
|
// shouldn't be) or that it just never came up in elm.
|
||||||
|
let rigid_vars = &constraints.variables[let_con.rigid_vars.indices()];
|
||||||
|
|
||||||
let failing: Vec<_> = rigid_vars
|
let failing: Vec<_> = rigid_vars
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|&var| !subs.redundant(*var) && subs.get_rank(*var) != Rank::NONE)
|
.filter(|&var| !subs.redundant(*var) && subs.get_rank(*var) != Rank::NONE)
|
||||||
|
@ -392,7 +397,7 @@ fn solve(
|
||||||
stack.push(Work::Constraint {
|
stack.push(Work::Constraint {
|
||||||
env: arena.alloc(new_env),
|
env: arena.alloc(new_env),
|
||||||
rank,
|
rank,
|
||||||
constraint: &ret_constraint,
|
constraint: ret_constraint,
|
||||||
});
|
});
|
||||||
|
|
||||||
state = state_for_ret_con;
|
state = state_for_ret_con;
|
||||||
|
@ -627,14 +632,14 @@ fn solve(
|
||||||
let rigid_vars = &constraints.variables[let_con.rigid_vars.indices()];
|
let rigid_vars = &constraints.variables[let_con.rigid_vars.indices()];
|
||||||
|
|
||||||
if matches!(&ret_constraint, True) && let_con.rigid_vars.is_empty() {
|
if matches!(&ret_constraint, True) && let_con.rigid_vars.is_empty() {
|
||||||
introduce(subs, rank, pools, &flex_vars);
|
introduce(subs, rank, pools, flex_vars);
|
||||||
|
|
||||||
// If the return expression is guaranteed to solve,
|
// If the return expression is guaranteed to solve,
|
||||||
// solve the assignments themselves and move on.
|
// solve the assignments themselves and move on.
|
||||||
stack.push(Work::Constraint {
|
stack.push(Work::Constraint {
|
||||||
env,
|
env,
|
||||||
rank,
|
rank,
|
||||||
constraint: &defs_constraint,
|
constraint: defs_constraint,
|
||||||
});
|
});
|
||||||
|
|
||||||
state
|
state
|
||||||
|
@ -644,11 +649,11 @@ fn solve(
|
||||||
//
|
//
|
||||||
// Note that the LetConSimple gets the current env and rank,
|
// Note that the LetConSimple gets the current env and rank,
|
||||||
// and not the env/rank from after solving the defs_constraint
|
// and not the env/rank from after solving the defs_constraint
|
||||||
stack.push(Work::LetConSimple { env, rank, let_con });
|
stack.push(Work::LetConNoVariables { env, rank, let_con });
|
||||||
stack.push(Work::Constraint {
|
stack.push(Work::Constraint {
|
||||||
env,
|
env,
|
||||||
rank,
|
rank,
|
||||||
constraint: &defs_constraint,
|
constraint: defs_constraint,
|
||||||
});
|
});
|
||||||
|
|
||||||
state
|
state
|
||||||
|
@ -686,11 +691,11 @@ fn solve(
|
||||||
//
|
//
|
||||||
// Note that the LetConSimple gets the current env and rank,
|
// Note that the LetConSimple gets the current env and rank,
|
||||||
// and not the env/rank from after solving the defs_constraint
|
// and not the env/rank from after solving the defs_constraint
|
||||||
stack.push(Work::LetConComplex { env, rank, let_con });
|
stack.push(Work::LetConIntroducesVariables { env, rank, let_con });
|
||||||
stack.push(Work::Constraint {
|
stack.push(Work::Constraint {
|
||||||
env,
|
env,
|
||||||
rank: next_rank,
|
rank: next_rank,
|
||||||
constraint: &defs_constraint,
|
constraint: defs_constraint,
|
||||||
});
|
});
|
||||||
|
|
||||||
state
|
state
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue