diff --git a/src/stages/common/PP.ml b/src/stages/common/PP.ml index a3928e26a..7a943c603 100644 --- a/src/stages/common/PP.ml +++ b/src/stages/common/PP.ml @@ -166,7 +166,7 @@ let literal ppf (l : literal) = | Literal_string s -> fprintf ppf "%S" s | Literal_bytes b -> - fprintf ppf "0x%s" @@ Bytes.to_string @@ Bytes.escaped b + fprintf ppf "0x%a" Hex.pp (Hex.of_bytes b) | Literal_address s -> fprintf ppf "@%S" s | Literal_operation _ -> diff --git a/src/stages/common/test.ml b/src/stages/common/test.ml new file mode 100644 index 000000000..757b68b46 --- /dev/null +++ b/src/stages/common/test.ml @@ -0,0 +1,5 @@ +open PP + +let%expect_test _ = + Format.printf "%a" literal (Literal_bytes (Bytes.of_string "foo")) ; + [%expect{| 0x666f6f |}]