summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mi/match.c5
-rw-r--r--parse/infer.c3
2 files changed, 4 insertions, 4 deletions
diff --git a/mi/match.c b/mi/match.c
index bfca0a6..deac3e6 100644
--- a/mi/match.c
+++ b/mi/match.c
@@ -165,7 +165,7 @@ static size_t nconstructors(Type *t)
t = tybase(t);
switch (t->type) {
- case Tyvoid: return 0; break;
+ case Tyvoid: return 1; break;
case Tybool: return 2; break;
case Tychar: return 0x10ffff; break;
@@ -338,6 +338,9 @@ static int addwildrec(Srcloc loc, Type *ty, Dtree *start, Dtree *accept, Dtree *
ret = acceptall(start, accept);
lappend(&last, &nlast, accept);
break;
+ case Tyvoid:
+ ret = 1;
+ break;
default:
lappend(&last, &nlast, accept);
break;
diff --git a/parse/infer.c b/parse/infer.c
index 6894a1c..b305d77 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1740,9 +1740,6 @@ static void infernode(Inferstate *st, Node **np, Type *ret, int *sawret)
break;
case Nmatchstmt:
infernode(st, &n->matchstmt.val, NULL, sawret);
- if (tybase(type(st, n->matchstmt.val))->type == Tyvoid)
- fatal(n, "can't match against a void type near %s",
- ctxstr(st, n->matchstmt.val));
for (i = 0; i < n->matchstmt.nmatches; i++) {
infernode(st, &n->matchstmt.matches[i], ret, sawret);
pat = n->matchstmt.matches[i]->match.pat;