shithub: mc

Download patch

ref: b7cd6588a862680434445e53f27125e43d76a4af
parent: fc4fca0fa6c64a0fbe6fbb5c8faf1e5640b784ea
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Oct 19 15:59:36 EDT 2017

Push the env before specializing the proto type.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1965,6 +1965,7 @@
 					namestr(t->name), ctxstr(n));
 
 		/* infer and unify types */
+		pushenv(proto->decl.env);
 		verifytraits(n, t->param, n->impl.type);
 		subst = mksubst();
 		substput(subst, t->param, n->impl.type);
@@ -1972,6 +1973,7 @@
 			substput(subst, t->aux[j], n->impl.aux[j]);
 		ty = tyspecialize(type(proto), subst, delayed, NULL);
 		substfree(subst);
+		popenv(proto->decl.env);
 
 		generic = hasparams(ty);
 		if (generic)