diff options
author | Ori Bernstein <ori@eigenstate.org> | 2014-07-15 19:44:31 -0400 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2014-07-15 19:44:31 -0400 |
commit | c7a2126d610c06da11c9fcda4ebc8ce12c14107a (patch) | |
tree | a0bff44a1322b40083119adc57ad7dd4e45410e4 | |
parent | 4d8b6e9b82dedd90e92d0cb1be10e93b7e76da2c (diff) | |
download | mc-c7a2126d610c06da11c9fcda4ebc8ce12c14107a.tar.gz |
More debug logging.
-rw-r--r-- | mk/c.mk | 2 | ||||
-rw-r--r-- | parse/gram.y | 2 | ||||
-rw-r--r-- | parse/infer.c | 12 |
3 files changed, 12 insertions, 4 deletions
@@ -19,7 +19,7 @@ $(LIB): $(OBJ) $(DEPS) $(AR) -rcs $@ $(OBJ) $(BIN): $(OBJ) $(EXTRADEP) $(DEPS) - $(CC) -o $@ $(OBJ) $(_LIBSRCHPATHS) $(_LIBPATHS) + $(CC) -o $@ $(OBJ) $(_LIBSRCHPATHS) $(_LIBPATHS) $(LDFLAGS) $(DEPS): @cd $(dir $@) && $(MAKE) diff --git a/parse/gram.y b/parse/gram.y index 5a711f3..625229f 100644 --- a/parse/gram.y +++ b/parse/gram.y @@ -909,7 +909,7 @@ static void installucons(Stab *st, Type *t) break; case Tyunion: for (i = 0; i < b->nmemb; i++) { - b->udecls[i]->utype = t; + b->udecls[i]->utype = b; b->udecls[i]->id = i; putucon(st, b->udecls[i]); } diff --git a/parse/infer.c b/parse/infer.c index fbea7a9..737c61f 100644 --- a/parse/infer.c +++ b/parse/infer.c @@ -386,11 +386,19 @@ static Type *littype(Node *n) static Type *delayeducon(Inferstate *st, Type *fallback) { Type *t; + char *from, *to; if (fallback->type != Tyunion) return fallback; t = mktylike(fallback->line, fallback->type); htput(st->delayed, t, fallback); + if (debugopt['u']) { + from = tystr(t); + to = tystr(fallback); + indentf(st->indentdepth, "Delay %s -> %s\n", from, to); + free(from); + free(to); + } return t; } @@ -1628,9 +1636,9 @@ static Type *tyfix(Inferstate *st, Node *ctx, Type *orig) } if (t->type == Tyvar) { if (hastrait(t, traittab[Tcint]) && checktraits(t, tyint)) - return tyint; + t = tyint; if (hastrait(t, traittab[Tcfloat]) && checktraits(t, tyflt)) - return tyflt; + t = tyflt; } else if (!t->fixed) { t->fixed = 1; if (t->type == Tyarray) { |