Tighten pattern parsing on 0-ary constructors.

This commit is contained in:
Graydon Hoare 2010-09-21 16:18:47 -07:00
parent 9f0a6c21b2
commit b549721a2e
2 changed files with 7 additions and 3 deletions

View file

@ -281,7 +281,11 @@ and parse_stmts (ps:pstate) : Ast.stmt array =
let parse_pat ps = either_get_left (parse_pat ps) in
let args =
match peek ps with
LPAREN -> paren_comma_list parse_pat ps
LPAREN ->
let args = paren_comma_list parse_pat ps in
if Array.length args = 0
then raise (err "empty pattern argument list" ps)
else args
| _ -> [| |]
in
Left (Ast.PAT_tag (lv, args))

View file

@ -113,10 +113,10 @@ fn mk_hashmap[K, V](&hashfn[K] hasher, &eqfn[K] eqer) -> hashmap[K, V] {
ret util.some[V](v);
}
}
case (nil[K, V]()) {
case (nil[K, V]) {
ret util.none[V];
}
case (deleted[K, V]()) { }
case (deleted[K, V]) { }
}
i += 1u;
}