Skip to content

Instantly share code, notes, and snippets.

@polybuildr
Created April 1, 2017 19:04
Show Gist options
  • Save polybuildr/55e9c05ffd11e8d3701c64ffa3c34a8b to your computer and use it in GitHub Desktop.
Save polybuildr/55e9c05ffd11e8d3701c64ffa3c34a8b to your computer and use it in GitHub Desktop.
for name in then_env.borrow().get_all_keys() {
let then_type = then_env.borrow().get_type(&name).unwrap();
if else_env.borrow().get_type(&name).unwrap() != then_type {
issues.push((TypeCheckerIssue::MultipleTypesFromBranchWarning(name.clone()),
s.pos));
env.borrow_mut().set(&name, Type::Any);
} else {
env.borrow_mut().set(&name, then_type);
}
}
for name in names {
let then_type = then_env.borrow().get_type(&name).unwrap();
let else_type = else_env.borrow().get_type(&name).unwrap();
if else_type != then_type {
issues.push((TypeCheckerIssue::MultipleTypesFromBranchWarning(name.clone()),
s.pos));
env.borrow_mut().set(&name, Type::Any);
} else {
env.borrow_mut().set(&name, then_type);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment