shithub: mc

Download patch

ref: dd0cb53f937c9a47c76ac6f4c2913287b2e65d02
parent: 10aacae6e0d47aa51731453998dbfcec1bbb6641
author: Ori Bernstein <[email protected]>
date: Fri Oct 18 20:11:05 EDT 2013

Raise an error when trying to match void.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1271,6 +1271,8 @@
             break;
         case Nmatchstmt:
             infernode(st, n->matchstmt.val, NULL, sawret);
+	    if (tybase(type(st, n->matchstmt.val))->type == Tyvoid)
+		fatal(n->line, "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);
                 unify(st, n, type(st, n->matchstmt.val), type(st, n->matchstmt.matches[i]->match.pat));