ref: 13a8561e53b259ab1bd6592df857b7a59b7a2a2b
parent: 5729c9940095be2916feb43b478559082744ba5c
author: Ori Bernstein <[email protected]>
date: Tue Sep 5 18:37:58 EDT 2017
Fix traits on named types. Erm.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -921,6 +921,7 @@
traitsfor(Type *base, Bitset *dst)
{
Traitmap *tm;
+ Bitset *bs;
Type *ty;
size_t i;
@@ -930,7 +931,12 @@
while (1) {
if (ty->type == Tyvar)
break;
- bsunion(dst, tm->traits);
+ if (ty->type == Tyname && ty->ngparam == 0)
+ bs = htget(tm->name, ty->name);
+ else
+ bs = tm->traits;
+ if (bs)
+ bsunion(dst, bs);
for (i = 0; i < tm->nfilter; i++) {
if (tymatchrank(tm->filter[i], ty) >= 0)
bsput(dst, tm->filtertr[i]->uid);