shithub: mc

Download patch

ref: 3e9a366b35c16c7f372b56c47ba020cbf61f9937
parent: 07c78ed9c77feed62b7f306049ed3c90d4753024
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Dec 16 15:49:42 EST 2015

Move to iter traits for iterables.

	It's still broken with custom iterators, but it's a step
	closer to making it work.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1765,7 +1765,7 @@
 		infernode(st, &n->iterstmt.body, ret, sawret);
 
 		t = mktyidxhack(n->loc, mktyvar(n->loc));
-		constrain(st, n, type(st, n->iterstmt.seq), traittab[Tcidx]);
+		constrain(st, n, type(st, n->iterstmt.seq), traittab[Tciter]);
 		unify(st, n, type(st, n->iterstmt.seq), t);
 		unify(st, n, type(st, n->iterstmt.elt), t->sub[0]);
 		break;
--- a/parse/type.c
+++ b/parse/type.c
@@ -943,12 +943,14 @@
 	traits[Typtr][0] = traittab[Tcslice];
 
 	/* @a[:]::(indexable,sliceable) */
-	traits[Tyslice][0] = traittab[Tcslice];
-	traits[Tyslice][1] = traittab[Tcidx];
+	traits[Tyslice][0] = traittab[Tcidx];
+	traits[Tyslice][1] = traittab[Tcslice];
+	traits[Tyslice][2] = traittab[Tciter];
 
 	/* @a[SZ]::(indexable,sliceable) */
 	traits[Tyarray][0] = traittab[Tcidx];
 	traits[Tyarray][1] = traittab[Tcslice];
+	traits[Tyarray][2] = traittab[Tciter];
 
 	/* @a::function */
 	traits[Tyfunc][0] = traittab[Tcfunc];