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

Commit 24a318e

Browse files
committed
Experiment: use {} for empty record.
1 parent 2cd5c6a commit 24a318e

File tree

3 files changed

+5
-51
lines changed

3 files changed

+5
-51
lines changed

src/res_core.ml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,13 +2691,9 @@ and parseBracedOrRecordExpr p =
26912691
Parser.expect Lbrace p;
26922692
match p.Parser.token with
26932693
| Rbrace ->
2694-
Parser.err p (Diagnostics.unexpected Rbrace p.breadcrumbs);
26952694
Parser.next p;
26962695
let loc = mkLoc startPos p.prevEndPos in
2697-
let braces = makeBracesAttr loc in
2698-
Ast_helper.Exp.construct ~attrs:[braces] ~loc
2699-
(Location.mkloc (Longident.Lident "()") loc)
2700-
None
2696+
Ast_helper.Exp.record ~loc [] None
27012697
| DotDotDot ->
27022698
(* beginning of record spread, parse record *)
27032699
Parser.next p;
Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,2 @@
1-
2-
Syntax error!
3-
tests/parsing/errors/expressions/emptyBlock.res:1:10
4-
5-
1 │ let x = {}
6-
2 │
7-
3 │ let f = (a, b) => {}
8-
9-
This let-binding misses an expression
10-
11-
12-
Syntax error!
13-
tests/parsing/errors/expressions/emptyBlock.res:3:20
14-
15-
1 │ let x = {}
16-
2 │
17-
3 │ let f = (a, b) => {}
18-
4 │
19-
20-
Missing expression
21-
22-
let x = ((())[@ns.braces ])
23-
let f a b = ((())[@ns.braces ])
1+
let x = { }
2+
let f a b = { }
Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,2 @@
1-
2-
Syntax error!
3-
tests/parsing/recovery/expression/emptyBlock.res:1:10
4-
5-
1 │ let x = {}
6-
2 │
7-
3 │ let f = (a, b) => {}
8-
9-
This let-binding misses an expression
10-
11-
12-
Syntax error!
13-
tests/parsing/recovery/expression/emptyBlock.res:3:20
14-
15-
1 │ let x = {}
16-
2 │
17-
3 │ let f = (a, b) => {}
18-
4 │
19-
20-
Missing expression
21-
22-
let x = ((())[@ns.braces ])
23-
let f a b = ((())[@ns.braces ])
1+
let x = { }
2+
let f a b = { }

0 commit comments

Comments
 (0)