Skip to content

Commit 641e9df

Browse files
committed
fix: allow unit () in type_arguments
Close #140
1 parent 738f96d commit 641e9df

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

grammar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ module.exports = grammar({
9292
[$.parameter, $._pattern],
9393
[$.parameter, $._parenthesized_pattern],
9494
[$._switch_value_pattern, $._parenthesized_pattern],
95-
[$.variant_declaration]
95+
[$.variant_declaration],
96+
[$.unit, $._function_type_parameter_list]
9697
],
9798

9899
rules: {
@@ -290,6 +291,7 @@ module.exports = grammar({
290291
$.object_type,
291292
$.generic_type,
292293
$.unit_type,
294+
$.unit,
293295
$.module_pack_type,
294296
),
295297

test/corpus/type_declarations.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ Generic
307307
===========================================
308308

309309
type t<'a, 'b> = (array<'a>, array<'b>)
310+
type t = result<(), string>
310311

311312
---
312313

@@ -316,7 +317,14 @@ type t<'a, 'b> = (array<'a>, array<'b>)
316317
(type_parameters (type_identifier) (type_identifier))
317318
(tuple_type
318319
(generic_type (type_identifier) (type_arguments (type_identifier)))
319-
(generic_type (type_identifier) (type_arguments (type_identifier))))))
320+
(generic_type (type_identifier) (type_arguments (type_identifier)))))
321+
(type_declaration
322+
(type_identifier)
323+
(generic_type
324+
(type_identifier)
325+
(type_arguments
326+
(unit)
327+
(type_identifier)))))
320328

321329
===========================================
322330
Recursive

0 commit comments

Comments
 (0)