ref: b433062cdda93b2eb1c4331a953d1ee5fbbd2bb4
parent: abe1191cd438e30dfb4708d42b4bc8260b258f14
author: Ori Bernstein <[email protected]>
date: Tue Apr 17 10:18:51 EDT 2018
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.
--- a/parse/stab.c
+++ b/parse/stab.c
@@ -667,13 +667,17 @@
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++)