Created
April 1, 2017 19:04
-
-
Save polybuildr/55e9c05ffd11e8d3701c64ffa3c34a8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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