ref: 82b14a44660222bab4c91275faa409bd224718fd
parent: 53613143d569099c990aee0aa312875781335405
author: Ori Bernstein <[email protected]>
date: Sat Dec 28 11:51:40 EST 2013
Fix type inference. Guarantee that we have an indexable type for the seq in iter loops.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1261,6 +1261,7 @@
size_t i;
Node *d;
Node *s;
+ Type *t;
size_t nbound;
Node **bound;
@@ -1327,8 +1328,9 @@
infernode(st, n->iterstmt.seq, NULL, sawret);
infernode(st, n->iterstmt.body, ret, sawret);
- constrain(st, n, type(st, n->iterstmt.seq), cstrtab[Tcidx]);
- unify(st, n, type(st, n->iterstmt.elt), type(st, n->iterstmt.seq)->sub[0]);
+ t = mktyidxhack(n->line, mktyvar(n->line));
+ unify(st, n, type(st, n->iterstmt.seq), t);
+ unify(st, n, type(st, n->iterstmt.elt), t->sub[0]);
break;
case Nmatchstmt:
infernode(st, n->matchstmt.val, NULL, sawret);