summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2019-02-16 15:47:14 -0800
committerOri Bernstein <ori@eigenstate.org>2019-02-16 15:47:14 -0800
commit178ce0afad1d2ec8af4814ce5970d2e8194b849f (patch)
tree18ee3d15ae355ec89ea672dceb952362c364cc8b /parse
parentcc5182284db2880dcfc3b0bd61dbc6ed319bacc3 (diff)
downloadmc-178ce0afad1d2ec8af4814ce5970d2e8194b849f.tar.gz
Clean up redundant code.
Diffstat (limited to 'parse')
-rw-r--r--parse/infer.c14
-rw-r--r--parse/type.c2
2 files changed, 7 insertions, 9 deletions
diff --git a/parse/infer.c b/parse/infer.c
index 79cb21d..ce7f337 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -567,8 +567,8 @@ tyresolve(Type *t)
t->sub[i] = tf(t->sub[i]);
if (t->sub[i] == t) {
lfatal(t->loc,
- "%s occurs within %s, leading to infinite type\n",
- tystr(t->sub[i]), tystr(t));
+ "%s occurs within %s, leading to infinite type\n",
+ tystr(t->sub[i]), tystr(t));
}
}
if (occurs(t))
@@ -657,8 +657,10 @@ tf(Type *orig)
ingeneric += isgeneric;
pushenv(orig->env);
tyresolve(t);
- if ((tt = boundtype(t)) != NULL)
+ if ((tt = boundtype(t)) != NULL) {
t = tt;
+ tyresolve(t);
+ }
popenv(orig->env);
/* If this is an instantiation of a generic type, we want the params to
* match the instantiation */
@@ -670,12 +672,6 @@ tf(Type *orig)
pushenv(orig->env);
t = tysubst(t, orig);
popenv(orig->env);
- } else if (orig->type == Typaram) {
- tt = boundtype(t);
- if (tt) {
- tyresolve(tt);
- t = tt;
- }
}
ingeneric -= isgeneric;
return t;
diff --git a/parse/type.c b/parse/type.c
index 7ad7c0e..62d4a5e 100644
--- a/parse/type.c
+++ b/parse/type.c
@@ -835,6 +835,8 @@ tyeq_rec(Type *a, Type *b, Bitset *avisited, Bitset *bvisited, int search)
case Typaram:
ret = (a == b);
ret = ret || streq(a->pname, b->pname);
+ //if (ret != streq(a->pname, b->pname))
+ // die("wat");
break;
case Tyvar:
if (a->tid != b->tid)