diff --git a/compiler/can/src/module.rs b/compiler/can/src/module.rs index 07b544e47b..2dc8e9acac 100644 --- a/compiler/can/src/module.rs +++ b/compiler/can/src/module.rs @@ -153,12 +153,8 @@ pub fn canonicalize_module_defs<'a>( references.insert(*symbol); } - // Add defs for any referenced builtins. - for (symbol, def) in builtin_defs(var_store) { - if references.contains(&symbol) { - defs.can_defs_by_symbol.insert(symbol, def); - } - } + // NOTE previously we inserted builtin defs into the list of defs here + // this is now done later, in file.rs. match sort_can_defs(&mut env, defs, Output::default()) { (Ok(declarations), output) => { diff --git a/compiler/constrain/src/uniq.rs b/compiler/constrain/src/uniq.rs index 942cf8c650..4653bbc077 100644 --- a/compiler/constrain/src/uniq.rs +++ b/compiler/constrain/src/uniq.rs @@ -67,6 +67,7 @@ pub fn constrain_decls( // perform usage analysis on the whole file let mut var_usage = VarUsage::default(); + for decl in decls.iter().rev() { // NOTE: rigids are empty because they are not shared between top-level definitions match decl { diff --git a/examples/quicksort/Quicksort.roc b/examples/quicksort/Quicksort.roc index ebf5a2ebde..3c6fed01b8 100644 --- a/examples/quicksort/Quicksort.roc +++ b/examples/quicksort/Quicksort.roc @@ -1,6 +1,7 @@ app Quicksort provides [ quicksort ] imports [] quicksort = \originalList -> + quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp = \list, low, high -> if low < high then