Split ListLen into ListLenU64 and ListLenUsize

The usize one gets used internally for things like
pattern matches. This is both more efficient (means
they don't have to do unnecessary casts) and also
less error-prone due to e.g. comparing length to
capacity, which is usize.
This commit is contained in:
Richard Feldman 2024-02-14 20:41:52 -05:00
parent a15cc0589c
commit ada83561e5
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
17 changed files with 88 additions and 48 deletions

View file

@ -4703,7 +4703,7 @@ fn synth_list_len_type(subs: &mut Subs) -> Variable {
Content::Structure(FlatType::Apply(Symbol::LIST_LIST, a_slice)),
);
let fn_var = synth_import(subs, Content::Error);
let solved_list_len = UnionLabels::insert_into_subs(subs, [(Symbol::LIST_LEN, [])]);
let solved_list_len = UnionLabels::insert_into_subs(subs, [(Symbol::LIST_LEN_U64, [])]);
let clos_list_len = synth_import(
subs,
Content::LambdaSet(LambdaSet {
@ -4757,7 +4757,7 @@ pub fn add_imports(
// Num needs List.len, but List imports Num.
let list_len_type_var = synth_list_len_type(subs);
let list_len_type_index = constraints.push_variable(list_len_type_var);
def_types.push((Symbol::LIST_LEN, Loc::at_zero(list_len_type_index)));
def_types.push((Symbol::LIST_LEN_U64, Loc::at_zero(list_len_type_index)));
import_variables.push(list_len_type_var);
}