ref: c7a2126d610c06da11c9fcda4ebc8ce12c14107a
parent: 4d8b6e9b82dedd90e92d0cb1be10e93b7e76da2c
author: Ori Bernstein <[email protected]>
date: Tue Jul 15 15:44:31 EDT 2014
More debug logging.
--- a/mk/c.mk
+++ b/mk/c.mk
@@ -19,7 +19,7 @@
$(AR) -rcs $@ $(OBJ)
$(BIN): $(OBJ) $(EXTRADEP) $(DEPS)
- $(CC) -o $@ $(OBJ) $(_LIBSRCHPATHS) $(_LIBPATHS)
+ $(CC) -o $@ $(OBJ) $(_LIBSRCHPATHS) $(_LIBPATHS) $(LDFLAGS)
$(DEPS):
@cd $(dir $@) && $(MAKE)
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -909,7 +909,7 @@
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]);
}
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -386,11 +386,19 @@
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 @@
}
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) {