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 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
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ module ErrorMessages = struct
9797 ...b}` wouldn't make sense, as `b` would override every field of `a` \
9898 anyway."
9999
100+ let dict_expr_spread = " Dict literals do not support spread (`...`) yet."
101+
100102 let variant_ident =
101103 " A polymorphic variant (e.g. #id) must start with an alphabetical letter \
102104 or be a number (e.g. #742)"
@@ -3368,6 +3370,12 @@ and parse_record_expr_row p :
33683370
33693371and parse_dict_expr_row p =
33703372 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
33713379 | String s -> (
33723380 let loc = mk_loc p.start_pos p.end_pos in
33733381 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