mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
fix todos regarding InvalidCycle
This commit is contained in:
parent
39b70232de
commit
744b8ce32b
3 changed files with 38 additions and 30 deletions
|
@ -872,38 +872,35 @@ pub fn constrain_decls(
|
|||
) -> Constraint {
|
||||
let mut constraint = Constraint::SaveTheEnvironment;
|
||||
|
||||
let mut env = Env {
|
||||
home,
|
||||
rigids: ImMap::default(),
|
||||
};
|
||||
|
||||
for decl in decls.iter().rev() {
|
||||
// NOTE: rigids are empty because they are not shared between top-level definitions
|
||||
// Clear the rigids from the previous iteration.
|
||||
// rigids are not shared between top-level definitions
|
||||
env.rigids.clear();
|
||||
|
||||
match decl {
|
||||
Declaration::Declare(def) => {
|
||||
constraint = exists_with_aliases(
|
||||
aliases.clone(),
|
||||
Vec::new(),
|
||||
constrain_def(
|
||||
&Env {
|
||||
home,
|
||||
rigids: ImMap::default(),
|
||||
},
|
||||
def,
|
||||
constraint,
|
||||
),
|
||||
constrain_def(&env, def, constraint),
|
||||
);
|
||||
}
|
||||
Declaration::DeclareRec(defs) => {
|
||||
constraint = exists_with_aliases(
|
||||
aliases.clone(),
|
||||
Vec::new(),
|
||||
constrain_recursive_defs(
|
||||
&Env {
|
||||
home,
|
||||
rigids: ImMap::default(),
|
||||
},
|
||||
defs,
|
||||
constraint,
|
||||
),
|
||||
constrain_recursive_defs(&env, defs, constraint),
|
||||
);
|
||||
}
|
||||
Declaration::InvalidCycle(_, _) => panic!("TODO handle invalid cycle"),
|
||||
Declaration::InvalidCycle(_, _) => {
|
||||
// invalid cycles give a canonicalization error. we skip them here.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue