shithub: mc

Download patch

ref: ac6c06f906d356b0004ed450558dd890c7057fbf
parent: 9d5831fb236f42fe126160c339a70452ef0fa460
author: Ori Bernstein <[email protected]>
date: Sun Jan 14 14:21:58 EST 2018

Fix binding of type env in traits.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1930,7 +1930,7 @@
 		fatal(n, "%s incompatibly specialized with %zd types instead of %zd types",
 			namestr(n->impl.traitname), n->impl.naux, tr->naux);
 	n->impl.type = tf(n->impl.type);
-	pushenv(n->impl.type->env);
+	pushenv(n->impl.env);
 	for (i = 0; i < n->impl.naux; i++)
 		n->impl.aux[i] = tf(n->impl.aux[i]);
 	for (i = 0; i < n->impl.ndecls; i++) {
@@ -1997,7 +1997,7 @@
 		if (generic)
 			ingeneric--;
 	}
-	popenv(n->impl.type->env);
+	popenv(n->impl.env);
 }
 
 static void
--- a/parse/node.c
+++ b/parse/node.c
@@ -264,6 +264,9 @@
 		n->impl.env = mkenv();
 		bindtype(n->impl.env, t);
 	}
+	for (i = 0; i < naux; i++)
+		if (hasparams(aux[i]))
+			bindtype(n->impl.env, aux[i]);
 	return n;
 }