Skip to content

Commit 7690f08

Browse files
authored
Merge pull request rescript-lang#187 from aspeddro/fix-generic-type-aliasing-type
fix: support aliasing type for generic-type
2 parents f2be69c + 6577e2f commit 7690f08

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

grammar.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,11 @@ module.exports = grammar({
424424

425425
),
426426

427-
generic_type: $ => seq(
427+
generic_type: $ => prec.left(seq(
428428
$._type_identifier,
429-
$.type_arguments
430-
),
429+
$.type_arguments,
430+
optional($.as_aliasing_type)
431+
)),
431432

432433
type_arguments: $ => seq(
433434
'<',

test/corpus/type_declarations.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ Generic
349349

350350
type t<'a, 'b> = (array<'a>, array<'b>)
351351
type t = result<(), string>
352+
type t<'a> = generic<'a> as 's
352353

353354
---
354355

@@ -365,7 +366,15 @@ type t = result<(), string>
365366
(type_identifier)
366367
(type_arguments
367368
(unit)
368-
(type_identifier)))))
369+
(type_identifier))))
370+
371+
(type_declaration
372+
(type_identifier)
373+
(type_parameters (type_identifier))
374+
(generic_type
375+
(type_identifier)
376+
(type_arguments (type_identifier))
377+
(as_aliasing_type (type_identifier)))))
369378

370379
===========================================
371380
Recursive

0 commit comments

Comments
 (0)