summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2017-07-03 11:52:32 -0700
committerOri Bernstein <ori@markovcorp.com>2017-07-03 12:43:37 -0700
commitddb327c92ebe3f96c5c816ec61996440551de401 (patch)
tree83bc341e072f22f5fcde9920eaaa30b808046be0
parentf358e29be6bb61572de6891a5f098fcbefe5d0b1 (diff)
downloadmc-ddb327c92ebe3f96c5c816ec61996440551de401.tar.gz
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
-rw-r--r--parse/infer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse/infer.c b/parse/infer.c
index dcaf1c4..fcf0161 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -2005,7 +2005,7 @@ static Type *tyfix(Inferstate *st, Node *ctx, Type *orig, int noerr)
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);