File tree Expand file tree Collapse file tree 4 files changed +22
-0
lines changed
tests/syntax_tests/data/parsing/errors/other Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 31
31
#### :nail_care : Polish
32
32
33
33
- 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
34
35
35
36
#### :house : Internal
36
37
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ module ErrorMessages = struct
97
97
...b}` wouldn't make sense, as `b` would override every field of `a` \
98
98
anyway."
99
99
100
+ let dict_expr_spread = " Dict literals do not support spread (`...`) yet."
101
+
100
102
let variant_ident =
101
103
" A polymorphic variant (e.g. #id) must start with an alphabetical letter \
102
104
or be a number (e.g. #742)"
@@ -3368,6 +3370,12 @@ and parse_record_expr_row p :
3368
3370
3369
3371
and parse_dict_expr_row p =
3370
3372
match p.Parser. token with
3373
+ | DotDotDot ->
3374
+ Parser. err p (Diagnostics. message ErrorMessages. dict_expr_spread);
3375
+ Parser. next p;
3376
+ (* Parse the expr so it's consumed *)
3377
+ let _spread_expr = parse_constrained_or_coerced_expr p in
3378
+ None
3371
3379
| String s -> (
3372
3380
let loc = mk_loc p.start_pos p.end_pos in
3373
3381
Parser. next p;
Original file line number Diff line number Diff line change
1
+ let x = dict {... foo , "bar" : 3 }
2
+
Original file line number Diff line number Diff line change
1
+
2
+ Syntax error!
3
+ syntax_tests/data/parsing/errors/other/dict_spread.res:1:14-16
4
+
5
+ 1 │ let x = dict{...foo, "bar": 3}
6
+ 2 │
7
+ 3 │
8
+
9
+ Dict literals do not support spread (`...`) yet.
10
+
11
+ let x = Primitive_dict.make [|("bar", 3)|]
You can’t perform that action at this time.
0 commit comments