fix uniqueness bug

builtin defs were included twice, which threw off uniqueness inference
This commit is contained in:
Folkert 2020-10-12 22:00:40 +02:00
parent 78d1a01742
commit 2df86b6438
3 changed files with 4 additions and 6 deletions

View file

@ -153,12 +153,8 @@ pub fn canonicalize_module_defs<'a>(
references.insert(*symbol); references.insert(*symbol);
} }
// Add defs for any referenced builtins. // NOTE previously we inserted builtin defs into the list of defs here
for (symbol, def) in builtin_defs(var_store) { // this is now done later, in file.rs.
if references.contains(&symbol) {
defs.can_defs_by_symbol.insert(symbol, def);
}
}
match sort_can_defs(&mut env, defs, Output::default()) { match sort_can_defs(&mut env, defs, Output::default()) {
(Ok(declarations), output) => { (Ok(declarations), output) => {

View file

@ -67,6 +67,7 @@ pub fn constrain_decls(
// perform usage analysis on the whole file // perform usage analysis on the whole file
let mut var_usage = VarUsage::default(); let mut var_usage = VarUsage::default();
for decl in decls.iter().rev() { for decl in decls.iter().rev() {
// NOTE: rigids are empty because they are not shared between top-level definitions // NOTE: rigids are empty because they are not shared between top-level definitions
match decl { match decl {

View file

@ -1,6 +1,7 @@
app Quicksort provides [ quicksort ] imports [] app Quicksort provides [ quicksort ] imports []
quicksort = \originalList -> quicksort = \originalList ->
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), Int, Int -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then