ref: 7ce4415a83be2d05432727ee8f672542e1d5e54e
parent: 0b419bf55a006dcee16bd9f50a4f8ec807437ce4
author: Ori Bernstein <[email protected]>
date: Fri Oct 26 11:14:24 EDT 2012
Don't specialize types spuriously.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -124,9 +124,11 @@
t = tf(st, t);
st->ingeneric--;
+ tybind(st, t);
ht = mkht(strhash, streq);
t = tyspecialize(t, ht);
htfree(ht);
+ tyunbind(st, t);
return t;
}
@@ -182,10 +184,6 @@
if (t->resolved)
return;
t->resolved = 1;
- /* if this is a generic type, bind the params. */
- tybind(st, t);
- if (t->type == Tygeneric)
- t = tyfreshen(st, t);
/* Walk through aggregate type members */
if (t->type == Tystruct) {
for (i = 0; i < t->nmemb; i++)
@@ -213,7 +211,6 @@
t->cstrs = bsdup(base->cstrs);
if (tyinfinite(st, t, NULL))
fatal(t->line, "Type %s includes itself", tystr(t));
- tyunbind(st, t);
}
/* fixd the most accurate type mapping we have (ie,