shithub: mc

Download patch

ref: 9d00fe8f782d9c86ae4b787acef760ab8dc82af0
parent: a0629529a006efd629e0cd89009b4b95b587ac22
author: Ori Bernstein <[email protected]>
date: Mon Jun 11 14:45:13 EDT 2012

Actually flip around pa, pb.

    We got lucky that things came in the right order. We actually
    need to flip around the more general type variables.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -173,8 +173,8 @@
     /* we want to unify Tyidxhack => concrete indexable. Flip 
      * to make this happen, if needed */
     if (b->type == Tyvar && b->nsub > 0) {
-        a = *pb;
-        b = *pa;
+        *pb = a;
+        *pa = b;
     }
     return (a->type == Tyvar && a->nsub > 0) || a->type == Tyarray || a->type == Tyslice;
 }
@@ -312,12 +312,12 @@
             break;
         case Oidx:      /* @a[@b::tcint] -> @a */
             t = mktyidxhack(n->line, type(args[1]));
-            t = unify(n, type(args[0]), t);
+            unify(n, type(args[0]), t);
             settype(n, type(args[1]));
             break;
         case Oslice:    /* @a[@b::tcint,@b::tcint] -> @a[,] */
             t = mktyidxhack(n->line, type(args[1]));
-            t = unify(n, type(args[0]), t);
+            unify(n, type(args[0]), t);
             settype(n, mktyslice(n->line, type(args[1])));
             break;