shithub: mc

Download patch

ref: 57d3cab36e26b6f18dfc4832caa301ef953fb1d9
parent: fc1425f6388e112984cce1bf64910be2a656367a
author: Ori Bernstein <[email protected]>
date: Mon Dec 16 09:13:37 EST 2013

Collect all of the substitutions for specializing.

    This fixes a bug when we specialize deep within the return
    type of a function call, allowing us to create a hash table.

--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -124,11 +124,16 @@
 
     if (from->type == Typaram) {
         htput(tsmap, from, to);
-    }
-    if (to->nsub != from->nsub)
         return;
+    }
+    assert(to->nsub == from->nsub);
     for (i = 0; i < to->nsub; i++)
         fillsubst(tsmap, to->sub[i], from->sub[i]);
+    if (to->type == Tyname && to->nparam > 0) {
+        assert(to->nparam == to->narg);
+        for (i = 0; i < to->nparam; i++)
+            fillsubst(tsmap, to->arg[i], to->param[i]);
+    }
 }
 
 /*