Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
- Allow empty inline records in variants. https://github.com/rescript-lang/rescript-compiler/pull/6494
- Allow empty record patterns in pattern matching. https://github.com/rescript-lang/rescript-compiler/pull/6494

#### :bug: Bug Fix
- Fix issue where an inline record with attributes did not parse. https://github.com/rescript-lang/rescript-compiler/pull/6499

# 11.0.0-rc.6

#### :rocket: New Feature
Expand Down
11 changes: 7 additions & 4 deletions jscomp/syntax/src/res_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4675,12 +4675,15 @@ and parseConstrDeclArgs p =
let attrs =
if optional then optionalAttr :: attrs else attrs
in
Parser.expect Comma p;
{field with Parsetree.pld_attributes = attrs}
in
first
:: parseCommaDelimitedRegion ~grammar:Grammar.FieldDeclarations
~closing:Rbrace ~f:parseFieldDeclarationRegion p
if p.token = Rbrace then [first]
else (
Parser.expect Comma p;
first
:: parseCommaDelimitedRegion
~grammar:Grammar.FieldDeclarations ~closing:Rbrace
~f:parseFieldDeclarationRegion p)
in
Parser.expect Rbrace p;
Parser.optional p Comma |> ignore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ type nonrec multipleWithAttrs = {
x: int ;
y: string [@res.optional ][@attr ]}
type nonrec singleWithAttrs = {
y: string [@res.optional ][@attr ]}
y: string [@res.optional ][@attr ]}
type nonrec inlineWithAttrs =
| A of {
value: string [@as {js|VALUE|js}]}
4 changes: 3 additions & 1 deletion jscomp/syntax/tests/parsing/grammar/expressions/record.res
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ type ttt = {x:int, y?: string}

type multipleWithAttrs = {x:int, @attr y?: string}

type singleWithAttrs = {@attr y?: string}
type singleWithAttrs = {@attr y?: string}

type inlineWithAttrs = | A({@as("VALUE") value: string})