ref: 8f1e28d8625c561b91e39757e452ca6fa221fd59
parent: 0e0424af35ab5ee7ae4d7c49937a648757fe3672
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Feb 6 20:52:10 EST 2016
Don't double init generic impls. It's possible for a generic to be serialized twice. If we've already added an impl for a type, don't double it.
--- a/parse/use.c
+++ b/parse/use.c
@@ -821,9 +821,10 @@
protoname = declname(proto);
len = strlen(protoname);
p = strstr(dclname, protoname);
- if (!p || p[len] != '$') {
+ if (!p || p[len] != '$')
continue;
- }
+ if (hthas(proto->decl.impls, ty))
+ continue;
htput(proto->decl.impls, ty, dcl);
if (ty->type == Tygeneric || hasparams(ty)) {
lappend(&proto->decl.gimpl, &proto->decl.ngimpl, dcl);