shithub: mc

Download patch

ref: 4e656a4f039b9230c820f12d3b1e4a5c8e55cf47
parent: 3942d40cb5532fe51ac97e5a15610d20a0691fa3
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jul 18 19:53:25 EDT 2015

Don't create duplicate types if we have no parameters.

--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -40,6 +40,8 @@
     t = tysearch(t);
     if (hthas(tsmap, t))
         return htget(tsmap, t);
+    arg = NULL;
+    narg = 0;
     switch (t->type) {
         case Typaram:
             ret = mktyvar(t->loc);
@@ -54,8 +56,8 @@
                 lappend(&ret->arg, &ret->narg, tyspecialize(t->gparam[i], tsmap, delayed));
             break;
         case Tyname:
-            arg = NULL;
-            narg = 0;
+            if (!hasparams(t))
+                return t;
             for (i = 0; i < t->narg; i++)
                 lappend(&arg, &narg, tyspecialize(t->arg[i], tsmap, delayed));
             ret = mktyname(t->loc, t->name, tyspecialize(t->sub[0], tsmap, delayed));