Skip to content

Commit 30c8562

Browse files
committed
fix and changelog
1 parent c41e56f commit 30c8562

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#### :nail_care: Polish
3232

3333
- Add (dev-)dependencies to build schema. https://github.com/rescript-lang/rescript/pull/7892
34+
- Dedicated error for dict literal spreads. https://github.com/rescript-lang/rescript/pull/7901
3435

3536
#### :house: Internal
3637

compiler/syntax/src/res_core.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3373,6 +3373,7 @@ and parse_dict_expr_row p =
33733373
| DotDotDot ->
33743374
Parser.err p (Diagnostics.message ErrorMessages.dict_expr_spread);
33753375
Parser.next p;
3376+
(* Parse the expr so it's consumed *)
33763377
let _spread_expr = parse_constrained_or_coerced_expr p in
33773378
None
33783379
| String s -> (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
let x = dict{...foo}
1+
let x = dict{...foo, "bar": 3}
22

tests/syntax_tests/data/parsing/errors/other/expected/dict_spread.res.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
Syntax error!
33
syntax_tests/data/parsing/errors/other/dict_spread.res:1:14-16
44

5-
1 │ let x = dict{...foo}
5+
1 │ let x = dict{...foo, "bar": 3}
66
2 │
77
3 │
88

99
Dict literals do not support spread (`...`) yet.
1010

11-
let x = Primitive_dict.make [||]
11+
let x = Primitive_dict.make [|("bar", 3)|]

0 commit comments

Comments
 (0)