Skip to content

Commit

Permalink
fix: record labels
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Aug 24, 2024
1 parent f8701a6 commit 194b0a0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/reason-parser/reason_pprint_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3109,9 +3109,8 @@ let createFormatter () =
let recordRow pld =
let hasPunning = recordRowIsPunned pld in
let name =
if hasPunning
then [ atom pld.pld_name.txt ]
else [ atom pld.pld_name.txt; atom ":" ]
let name = add_raw_identifier_prefix pld.pld_name.txt in
if hasPunning then [ atom name ] else [ atom name; atom ":" ]
in
let name = source_map ~loc:pld.pld_name.loc (makeList name) in
let withMutable =
Expand Down
10 changes: 10 additions & 0 deletions test/raw-identifiers.t/input.re
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ type y = [ | \#module ]
let x = `\#module

external \#external: unit => unit = "external";

type \#rec = {
\#type: \#type,
\#module: module_
};

let \#rec = {
\#type: \#type,
\#module: module_
}
10 changes: 10 additions & 0 deletions test/raw-identifiers.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ Test raw identifiers in Reason syntax
let x = `\#module;

external \#external: unit => unit = "external";

type \#rec = {
\#type,
\#module: module_,
};

let \#rec = {
\#type,
\#module: module_,
};

Check idempotency

Expand Down

0 comments on commit 194b0a0

Please sign in to comment.