ref: b655561599c0be143c634e0c47a1a3ff1d5f76d6
parent: c39f89dd821b17ef095a36b06f8c77d4a109ce64
author: Ori Bernstein <[email protected]>
date: Fri Jan 6 18:55:35 EST 2012
Fix readback of compound types. We forgot to allocate the sub vector
--- a/parse/pickle.c
+++ b/parse/pickle.c
@@ -259,6 +259,8 @@
wrtype(fd, ty->sub[0]);
pickle(ty->asize, fd);
break;
+ case Tyvar:
+ fprintf(stderr, "WARNING: Attempting to pickle Tyvar. This will not read back reliably.");
default:
for (i = 0; i < ty->nsub; i++)
wrtype(fd, ty->sub[i]);
@@ -279,6 +281,8 @@
/* tid is generated; don't write */
/* cstrs are left out for now: FIXME */
ty->nsub = rdint(fd);
+ if (ty->nsub > 0)
+ ty->sub = xalloc(ty->nsub * sizeof(Type*));
switch (ty->type) {
case Tyname:
ty->name = unpickle(fd);