shithub: mc

Download patch

ref: aab1653d3e737964ae91755448b23c8f9b2bbfc5
parent: fc4829f785ca5ead3b57eec2063113804f6bf2a5
parent: 64968bcc3b6f03415aac19c8cdfff83c9e3f424e
author: Ori Bernstein <[email protected]>
date: Thu Dec 19 16:50:55 EST 2013

Merge branch 'master' of git+ssh://git.eigenstate.org/git/ori/mc

--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -21,11 +21,14 @@
 {
     size_t i;
 
-    if (t->type == Typaram)
+    if (t->type == Typaram || t->isgeneric)
         return 1;
     for (i = 0; i < t->nsub; i++)
         if (hasparams(t->sub[i]))
             return 1;
+    for (i = 0; i < t->narg; i++)
+        if (hasparams(t->arg[i]))
+            return 1;
     return 0;
 }
 
@@ -51,7 +54,7 @@
             htput(tsmap, t, ret);
             break;
         case Tyname:
-            if (!t->isgeneric) {
+            if (!hasparams(t)) {
                 ret = t;
             } else {
                 for (i = 0; i < t->nparam; i++) {
@@ -123,6 +126,8 @@
     size_t i;
 
     if (from->type == Typaram) {
+        if (debugopt['S'])
+            printf("mapping %s => %s\n", tystr(from), tystr(to));
         htput(tsmap, from, to);
         return;
     }
@@ -383,6 +388,8 @@
 
     *name = genericname(n, to);
     d = getdcl(file->file.globls, *name);
+    if (debugopt['S'])
+        printf("specializing %s => %s\n", namestr(n->decl.name), namestr(*name));
     if (d)
         return d;
     /* namespaced names need to be looked up in their correct