Skip to content

Commit f2be460

Browse files
committed
allow empty where clauses
1 parent 42dce44 commit f2be460

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

grammar.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,10 @@ module.exports = grammar({
466466

467467
where_clause: $ => prec.right(seq(
468468
'where',
469-
sepBy1(',', $.where_predicate),
470-
optional(','),
469+
optional(seq(
470+
sepBy1(',', $.where_predicate),
471+
optional(','),
472+
)),
471473
)),
472474

473475
where_predicate: $ => seq(

test/corpus/declarations.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,7 @@ Empty statements
11461146
================================================================================
11471147

11481148
type Foo<T> where T: Copy = Box<T>;
1149+
type Assoc3 where = () where;
11491150

11501151
--------------------------------------------------------------------------------
11511152

@@ -1163,7 +1164,12 @@ type Foo<T> where T: Copy = Box<T>;
11631164
(generic_type
11641165
(type_identifier)
11651166
(type_arguments
1166-
(type_identifier)))))
1167+
(type_identifier))))
1168+
(type_item
1169+
(type_identifier)
1170+
(where_clause)
1171+
(unit_type)
1172+
(where_clause)))
11671173

11681174
================================================================================
11691175
Empty statements

0 commit comments

Comments
 (0)