summaryrefslogtreecommitdiff
path: root/parse/specialize.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-01-31 22:57:56 -0800
committerOri Bernstein <ori@eigenstate.org>2016-01-31 22:58:08 -0800
commit8e0a983ff78f6c1e20f86b10489276491b4cb9f9 (patch)
treeb1a19f86f4320523d7e181307869c9810af0a6df /parse/specialize.c
parent128470e404d843b3d71c5837cac05d4d4203bd66 (diff)
downloadmc-8e0a983ff78f6c1e20f86b10489276491b4cb9f9.tar.gz
Check array sizes in type goodness evaluation.
Diffstat (limited to 'parse/specialize.c')
-rw-r--r--parse/specialize.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/parse/specialize.c b/parse/specialize.c
index bdaa65f..3530284 100644
--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -429,6 +429,7 @@ static Node *specializenode(Node *n, Tysubst *tsmap)
}
return r;
}
+
Node *genericname(Node *n, Type *t)
{
char buf[1024];
@@ -505,6 +506,16 @@ int matchquality(Type *pat, Type *to)
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)
break;