shithub: mc

Download patch

ref: d5ade40b51092a405c0ee44b63a461409de20371
parent: cefbc6118e75188bc34c13eb1411b9c673d7defb
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jun 25 19:32:57 EDT 2017

Check for type name equality.

	Somehow, a check was lost. Shit.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1070,6 +1070,9 @@
 	/* if the tyrank of a is 0 (ie, a raw tyvar), just unify.
 	 * Otherwise, match up subtypes. */
 	if (a->type == b->type && a->type != Tyvar) {
+		if (a->type == Tyname)
+			if (a->tid != b->tid)
+				typeerror(st, a, b, ctx, "incompatible types");
 		if (hasargs(a) && hasargs(b)) {
 			/* Only Tygeneric and Tyname should be able to unify. And they
 			 * should have the same names for this to be true. */
@@ -1076,7 +1079,7 @@
 			if (!nameeq(a->name, b->name))
 				typeerror(st, a, b, ctx, NULL);
 			if (a->narg != b->narg)
-				typeerror(st, a, b, ctx, "Incompatible parameter lists");
+				typeerror(st, a, b, ctx, "incompatible parameter lists");
 			for (i = 0; i < a->narg; i++)
 				unify(st, ctx, a->arg[i], b->arg[i]);
 			r = b;