shithub: mc

Download patch

ref: 9954ed6a35cded05c786bc7319a79e20719ea74a
parent: 69ac58bd0e3bc37b8189f5fdd787c04216c80111
author: Ori Bernstein <[email protected]>
date: Sun Jun 24 09:57:28 EDT 2012

Propagate cstrs from base types up

    'type foo = int' should have the same constraints set on
    'foo' as the int type does. Make it so.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -88,6 +88,7 @@
 static void tyresolve(Type *t)
 {
     size_t i, nn;
+    Type *base;
     Node **n;
 
     if (t->resolved)
@@ -98,6 +99,11 @@
         infernode(n[i], NULL, NULL);
     for (i = 0; i < t->nsub; i++)
         t->sub[i] = tf(t->sub[i]);
+    base = tybase(t);
+    if (t->cstrs)
+        bsunion(t->cstrs, base->cstrs);
+    else
+        t->cstrs = bsdup(base->cstrs);
 }
 
 /* fixd the most accurate type mapping we have */