From b0c6f1e70d544e235e611f11078e76ba8428ee26 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 27 May 2024 17:34:08 +0900 Subject: [PATCH] use `String.sub` intead of `unwrap_uppercase_exotic` --- jscomp/syntax/src/res_printer.ml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/jscomp/syntax/src/res_printer.ml b/jscomp/syntax/src/res_printer.ml index 86b9bf51c4..109a053bca 100644 --- a/jscomp/syntax/src/res_printer.ml +++ b/jscomp/syntax/src/res_printer.ml @@ -436,12 +436,10 @@ let print_poly_var_ident txt = else match classify_ident_content ~allow_uident:true txt with | UppercaseExoticIdent -> - Doc.concat - [ - Doc.text "\""; - Doc.text (Ext_ident.unwrap_uppercase_exotic txt); - Doc.text "\""; - ] + let len = String.length txt in + (* UppercaseExoticIdent follows the \"..." format, + so removing the leading backslash is enough to transform it into polyvar style *) + Doc.text ((String.sub [@doesNotRaise]) txt 1 (len - 1)) | ExoticIdent -> Doc.concat [Doc.text "\""; Doc.text txt; Doc.text "\""] | NormalIdent -> ( match txt with