ref: 228b30bfe204fc490e16eec6ba5484991a765074
parent: 86aa50f243677df226f5ee02d6b15f85c634a6f1
author: Mura Li <mura_li@castech.com.tw>
date: Wed Apr 22 03:00:16 EDT 2020
Fix wrong order of recursive calls Also, improve slightly the error messages.
--- a/mi/match.c
+++ b/mi/match.c
@@ -458,9 +458,9 @@
pat = fold(pat, 1);
switch (exprop(pat)) {
case Olor:
- addrec(fs, pat->expr.args[1], val, path);
next = frontierdup(fs);
fs->next = next;
+ addrec(fs, pat->expr.args[1], val, path);
addrec(next, pat->expr.args[0], val, path);
break;
case Ogap:
@@ -938,10 +938,10 @@
cur = frontier[i];
if (last && last->i == cur->i) {
if (last->ncap != cur->ncap)
- fatal(pat[cur->i], "captured variables are not equally bound in all or-pattern of the same group");
+ fatal(pat[cur->i], "number of wildcard variables in the or-patterns are not equal (%d != %d)", last->ncap, cur->ncap);
for (j = 0; j < cur->ncap; j++) {
if (!capeq(last->cap[j], cur->cap[j]))
- fatal(pat[cur->i], "captured variables are not equally bound in all or-pattern of the same group");
+ fatal(pat[cur->i], "wildcard variables have different types in the or-patterns");
}
} else {
addcapture(pat[cur->i]->match.block, cur->cap, cur->ncap);