shithub: mc

Download patch

ref: 8e0a983ff78f6c1e20f86b10489276491b4cb9f9
parent: 128470e404d843b3d71c5837cac05d4d4203bd66
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jan 31 17:57:56 EST 2016

Check array sizes in type goodness evaluation.

--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -429,6 +429,7 @@
 	}
 	return r;
 }
+
 Node *genericname(Node *n, Type *t)
 {
 	char buf[1024];
@@ -504,6 +505,16 @@
 				return -1;
 			match += q;
 		}
+		break;
+	case Tyarray:
+		/* unsized arrays are ok */
+		if (pat->size && to->asize) {
+			if (!!litvaleq(a->asize->expr.args[0], b->asize->expr.args[0]))
+				return -1;
+		} else if (pat->size != to->asize) {
+			return -1;
+		}
+		else return matchquality(pat->sub[0], to->sub[0]);
 		break;
 	default:
 		if (pat->nsub != to->nsub)