summaryrefslogtreecommitdiff
path: root/parse/stab.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2018-04-17 14:18:51 -0700
committerOri Bernstein <ori@markovcorp.com>2018-04-17 14:19:40 -0700
commitb433062cdda93b2eb1c4331a953d1ee5fbbd2bb4 (patch)
tree7e4a6e3778f67b5b978ad7e03ce05a3f1ae08eb4 /parse/stab.c
parentabe1191cd438e30dfb4708d42b4bc8260b258f14 (diff)
downloadmc-b433062cdda93b2eb1c4331a953d1ee5fbbd2bb4.tar.gz
Merge trait specs if provided.
This is a bit ugly, since if there are duplicate specs for a trait, we'll end up duplicating the constraints. On the other hand, since we put them into a set, it's mostly an esthetic issue.
Diffstat (limited to 'parse/stab.c')
-rw-r--r--parse/stab.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/parse/stab.c b/parse/stab.c
index 2d190d9..7d94218 100644
--- a/parse/stab.c
+++ b/parse/stab.c
@@ -667,13 +667,17 @@ bindtype_rec(Tyenv *e, Type *t, Bitset *visited)
switch (t->type) {
case Typaram:
tt = htget(e->tab, t);
- if (tt && tt != t)
+ if (tt && tt != t) {
tytab[t->tid] = tt;
- else if (!boundtype(t))
+ for (i = 0; i < t->nspec; i++)
+ lappend(&tt->spec, &tt->nspec, t->spec[i]);
+ } else if (!boundtype(t)) {
htput(e->tab, t, t);
- for (i = 0; i < t->nspec; i++)
+ }
+ for (i = 0; i < t->nspec; i++) {
if (t->spec[i]->aux)
bindtype_rec(e, t->spec[i]->aux, visited);
+ }
break;
case Tygeneric:
for (i = 0; i < t->ngparam; i++)