Skip to content

Commit

Permalink
feat: parse universal type variables in signature items (#2797)
Browse files Browse the repository at this point in the history
* feat: parse universal type variables in signature items

* add changelog entry
  • Loading branch information
anmonteiro authored Aug 24, 2024
1 parent d60fc12 commit 564cc3d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
[#2790](https://github.com/reasonml/reason/pull/2790))
- Support quoted extensions (@anmonteiro,
[#2794](https://github.com/reasonml/reason/pull/2794))
- Parse universal type variables in signature items (@anmonteiro,
[#2797](https://github.com/reasonml/reason/pull/2797))

## 3.12.0

Expand Down
2 changes: 1 addition & 1 deletion src/reason-parser/reason_parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@ signature:

signature_item:
| item_attributes
LET item_extension_sugar? as_loc(val_ident) COLON core_type
LET item_extension_sugar? as_loc(val_ident) COLON poly_type
{ let loc = mklocation $startpos($2) $endpos in
wrap_sig_ext
~loc
Expand Down
4 changes: 4 additions & 0 deletions test/general-syntax-re.t/input.re
Original file line number Diff line number Diff line change
Expand Up @@ -1322,3 +1322,7 @@ let () = {
3
};

module type x = {
let a: 'a. 'a => unit;
};

4 changes: 4 additions & 0 deletions test/general-syntax-re.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -1545,3 +1545,7 @@ Format general implementation syntax
let x = 1;
3;
};

module type x = {
let a: 'a. 'a => unit;
};
7 changes: 7 additions & 0 deletions test/general-syntax-rei.t/input.rei
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,10 @@ open! %foo Bar;
type%foo t = int;

type%x foo += Int;

module type x = {
let a: 'a. 'a => unit;
};

let a: 'a. 'a => unit;

6 changes: 6 additions & 0 deletions test/general-syntax-rei.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ Format general interface syntax
type%x foo +=
| Int;
module type x = {
let a: 'a. 'a => unit;
};
let a: 'a. 'a => unit;

0 comments on commit 564cc3d

Please sign in to comment.