Skip to content

Commit b549721

Browse files
committed
Tighten pattern parsing on 0-ary constructors.
1 parent 9f0a6c2 commit b549721

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/boot/fe/item.ml

+5-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ and parse_stmts (ps:pstate) : Ast.stmt array =
281281
let parse_pat ps = either_get_left (parse_pat ps) in
282282
let args =
283283
match peek ps with
284-
LPAREN -> paren_comma_list parse_pat ps
284+
LPAREN ->
285+
let args = paren_comma_list parse_pat ps in
286+
if Array.length args = 0
287+
then raise (err "empty pattern argument list" ps)
288+
else args
285289
| _ -> [| |]
286290
in
287291
Left (Ast.PAT_tag (lv, args))

src/lib/map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ fn mk_hashmap[K, V](&hashfn[K] hasher, &eqfn[K] eqer) -> hashmap[K, V] {
113113
ret util.some[V](v);
114114
}
115115
}
116-
case (nil[K, V]()) {
116+
case (nil[K, V]) {
117117
ret util.none[V];
118118
}
119-
case (deleted[K, V]()) { }
119+
case (deleted[K, V]) { }
120120
}
121121
i += 1u;
122122
}

0 commit comments

Comments
 (0)