fix: iterator bugs

This commit is contained in:
Shunsuke Shibayama 2023-08-17 20:01:05 +09:00
parent ed245f6c08
commit efcf23b04d
4 changed files with 18 additions and 2 deletions

View file

@ -1761,7 +1761,10 @@ impl Context {
let mut enumerate = Self::builtin_poly_class(ENUMERATE, vec![PS::t_nd(TY_T)], 2);
enumerate.register_superclass(Obj, &obj);
enumerate
.register_marker_trait(self, poly(ITERABLE, vec![ty_tp(T.clone())]))
.register_marker_trait(
self,
poly(ITERABLE, vec![ty_tp(tuple_t(vec![Nat, T.clone()]))]),
)
.unwrap();
enumerate
.register_marker_trait(self, poly(OUTPUT, vec![ty_tp(T.clone())]))

View file

@ -77,7 +77,7 @@ impl Context {
.quantify();
let t_filter = nd_func(
vec![
kw(KW_FUNC, nd_func(vec![anon(T.clone())], None, T.clone())),
kw(KW_FUNC, nd_func(vec![anon(T.clone())], None, Bool)),
kw(KW_ITERABLE, poly(ITERABLE, vec![ty_tp(T.clone())])),
],
None,