diff --git a/src/reason-parser/reason_pprint_ast.ml b/src/reason-parser/reason_pprint_ast.ml index 82f5eb6e1..67f02ab36 100644 --- a/src/reason-parser/reason_pprint_ast.ml +++ b/src/reason-parser/reason_pprint_ast.ml @@ -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 = diff --git a/test/raw-identifiers.t/input.re b/test/raw-identifiers.t/input.re index b70308fc2..db1158e0e 100644 --- a/test/raw-identifiers.t/input.re +++ b/test/raw-identifiers.t/input.re @@ -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_ +} diff --git a/test/raw-identifiers.t/run.t b/test/raw-identifiers.t/run.t index ac7a6f9d4..e4189a3e8 100644 --- a/test/raw-identifiers.t/run.t +++ b/test/raw-identifiers.t/run.t @@ -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