Update classes.rs

This commit is contained in:
Shunsuke Shibayama 2025-01-17 03:46:53 +09:00
parent c8ec8a6f09
commit 9735ad4103
2 changed files with 22 additions and 0 deletions

View file

@ -1831,6 +1831,22 @@ impl Context {
ValueObj::builtin_class(out_t),
);
list_.register_trait_methods(lis_t.clone(), list_mul);
let mut fallback_list_mul = Self::builtin_methods(Some(poly(MUL, vec![ty_tp(Nat)])), 2);
let mul_t = fn1_met(lis_t.clone(), Nat, out_unknown_len_list_t(T.clone())).quantify();
fallback_list_mul.register_builtin_erg_impl(
OP_MUL,
mul_t,
Immutable,
Visibility::BUILTIN_PUBLIC,
);
let out_t = out_unknown_len_list_t(T.clone());
fallback_list_mul.register_builtin_const(
OUTPUT,
Visibility::BUILTIN_PUBLIC,
None,
ValueObj::builtin_class(out_t),
);
list_.register_trait_methods(lis_t.clone(), fallback_list_mul);
// [T; N].MutType! = [T; !N] (neither [T!; N] nor [T; N]!)
let mut_type =
ValueObj::builtin_class(poly(MUT_LIST, vec![TyParam::t(T.clone()), N.clone()]));