Skip to content

Commit 49c468a

Browse files
committed
feat: relax module constraining, allow generic module exprs
1 parent 8165a04 commit 49c468a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

grammar.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,20 +1273,20 @@ module.exports = grammar({
12731273
choice($.module_expression, $.block)
12741274
)),
12751275

1276-
_module_type_constraint: $ => seq(
1276+
_module_type_constraint_with: $ => prec.right(seq(
12771277
'with',
12781278
sep1(choice('and', 'with'),
12791279
choice($.constrain_module, $.constrain_type)
12801280
),
1281-
),
1281+
)),
12821282

12831283
module_type_constraint: $ => prec.left(choice(
1284-
seq($.module_identifier, $._module_type_constraint),
1284+
seq($.module_expression, $._module_type_constraint_with),
12851285
seq(
12861286
'(',
1287-
$.module_identifier, $._module_type_constraint,
1287+
$.module_expression, $._module_type_constraint_with,
12881288
')',
1289-
$._module_type_constraint
1289+
$._module_type_constraint_with
12901290
)
12911291
)),
12921292

test/corpus/modules.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ include module type of {
6060
(include_statement
6161
(functor_parameter (module_identifier)
6262
(module_type_annotation
63-
(module_type_of
6463
(module_type_constraint
65-
(module_identifier)
64+
(module_type_of (module_identifier))
6665
(constrain_module
6766
(module_identifier)
6867
(module_identifier_path (module_identifier) (module_identifier)))
6968
(constrain_module
7069
(module_identifier)
71-
(module_identifier_path (module_identifier) (module_identifier))))))))
70+
(module_identifier_path (module_identifier)
71+
(module_identifier)))))))
7272

7373
(include_statement
7474
(module_type_of

0 commit comments

Comments
 (0)