remove transitive builtins

This commit is contained in:
Folkert 2022-07-10 01:22:30 +02:00
parent 7b308d9efe
commit 4956fc5ef4
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 0 additions and 25 deletions

View file

@ -244,21 +244,6 @@ map_symbol_to_lowlevel_and_arity! {
/// lookup (if the bounds check passed). That internal function is hardcoded in code gen,
/// which works fine because it doesn't involve any open tag unions.
/// Does a builtin depend on any other builtins?
///
/// NOTE: you are supposed to give all symbols that are relied on,
/// even those that are relied on transitively!
pub fn builtin_dependencies(symbol: Symbol) -> &'static [Symbol] {
match symbol {
Symbol::LIST_SORT_ASC => &[Symbol::LIST_SORT_WITH, Symbol::NUM_COMPARE],
Symbol::LIST_SORT_DESC => &[Symbol::LIST_SORT_WITH],
Symbol::LIST_PRODUCT => &[Symbol::LIST_WALK, Symbol::NUM_MUL],
Symbol::LIST_SUM => &[Symbol::LIST_WALK, Symbol::NUM_ADD],
Symbol::LIST_SET => &[Symbol::LIST_REPLACE],
_ => &[],
}
}
/// Implementation for a builtin
pub fn builtin_defs_map(symbol: Symbol, var_store: &mut VarStore) -> Option<Def> {
debug_assert!(symbol.is_builtin());

View file

@ -415,16 +415,6 @@ pub fn canonicalize_module_defs<'a>(
referenced_values.extend(env.qualified_value_lookups.iter().copied());
referenced_types.extend(env.qualified_type_lookups.iter().copied());
// add any builtins used by other builtins
let transitive_builtins: Vec<Symbol> = referenced_values
.iter()
.filter(|s| s.is_builtin())
.flat_map(|s| crate::builtins::builtin_dependencies(*s))
.copied()
.collect();
referenced_values.extend(transitive_builtins);
// NOTE previously we inserted builtin defs into the list of defs here
// this is now done later, in file.rs.