feat: impl Hash for Array

This commit is contained in:
Shunsuke Shibayama 2023-09-18 19:44:37 +09:00
parent 53a43962e8
commit 57d3a23aed
7 changed files with 71 additions and 19 deletions

View file

@ -1359,6 +1359,14 @@ impl Context {
Immutable,
Visibility::BUILTIN_PUBLIC,
);
let mut array_hash = Self::builtin_methods(Some(mono(HASH)), 1);
array_hash.register_builtin_erg_impl(
OP_HASH,
fn0_met(mono(GENERIC_ARRAY), Int),
Const,
Visibility::BUILTIN_PUBLIC,
);
generic_array.register_trait(mono(GENERIC_ARRAY), array_hash);
/* Array */
let mut array_ =
Self::builtin_poly_class(ARRAY, vec![PS::t_nd(TY_T), PS::default(TY_N, Nat)], 10);