Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 155eded

Browse files
committed
Support type definition of empty record.
1 parent cc8a356 commit 155eded

File tree

3 files changed

+1
-17
lines changed

3 files changed

+1
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
- :boom: when V4 is activated, at most one component is allowed for each module.
2020

21-
- Add support for empty record literal `{}` for records with only optional fields https://github.com/rescript-lang/syntax/pull/632
21+
- Add support for empty record literal `{}` for records with only optional fields, and type definition of empty record (e.g. `type empty = {}`) https://github.com/rescript-lang/syntax/pull/632
2222

2323
#### :bug: Bug Fix
2424

src/res_core.ml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4909,13 +4909,6 @@ and parseRecordOrObjectDecl p =
49094909
:: parseCommaDelimitedRegion ~grammar:Grammar.FieldDeclarations
49104910
~closing:Rbrace ~f:parseFieldDeclarationRegion p
49114911
in
4912-
let () =
4913-
match fields with
4914-
| [] ->
4915-
Parser.err ~startPos p
4916-
(Diagnostics.message "A record needs at least one field")
4917-
| _ -> ()
4918-
in
49194912
Parser.expect Rbrace p;
49204913
Parser.eatBreadcrumb p;
49214914
(None, Asttypes.Public, Parsetree.Ptype_record fields))
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
1-
2-
Syntax error!
3-
tests/parsing/errors/typeDef/emptyRecord.res:1:15-16
4-
5-
1 │ type record = {}
6-
2 │
7-
8-
A record needs at least one field
9-
101
type nonrec record = {
112
}

0 commit comments

Comments
 (0)