shithub: mc

Download patch

ref: 178ce0afad1d2ec8af4814ce5970d2e8194b849f
parent: cc5182284db2880dcfc3b0bd61dbc6ed319bacc3
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Feb 16 10:47:14 EST 2019

Clean up redundant code.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -567,8 +567,8 @@
 		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 @@
 	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 @@
 		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;
--- a/parse/type.c
+++ b/parse/type.c
@@ -835,6 +835,8 @@
 	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)