shithub: mc

Download patch

ref: ddb327c92ebe3f96c5c816ec61996440551de401
parent: f358e29be6bb61572de6891a5f098fcbefe5d0b1
author: Michael Forney <mforney@mforney.org>
date: Mon Jul 3 07:52:32 EDT 2017

Resolve trait decl types before fixing them

Otherwise, if the decl has a named type with parameters, it remains
unresolved until tyfix. tyfix looks up the tid in tytab, finding the
original definition of the named type, which may have different type
parameter names than than used in the trait decl.

Upon importing this trait from a use file and writing a new impl, we end
up trying to resolve type parameters of the *definition* of the named
type, rather than what is specified in the trait decl type. If both type
parameters are the same, we don't notice a problem, but if they differ,
we end up trying to serialize a Tyvar in genericname.

	tyvar has no idstr

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -2005,7 +2005,7 @@
 	if (!tyflt)
 		tyflt = mktype(Zloc, Tyflt64);
 
-	t = tysearch(orig);
+	t = tysearch(tf(st, orig));
 	base = htget(st->seqbase, orig);
 	if (orig->type == Tyvar && hthas(st->delayed, orig)) {
 		delayed = htget(st->delayed, orig);