summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/c.mk2
-rw-r--r--parse/gram.y2
-rw-r--r--parse/infer.c12
3 files changed, 12 insertions, 4 deletions
diff --git a/mk/c.mk b/mk/c.mk
index 98a5afd..ecc8a7d 100644
--- a/mk/c.mk
+++ b/mk/c.mk
@@ -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) {