Skip to content

Commit 1d32837

Browse files
authored
Merge pull request #5 from NathanReb/upgrade-ppxlib-0.18.0
Make hardcaml compatible with ppxlib.0.18.0
2 parents 6817d5c + 61aba46 commit 1d32837

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

hardcaml.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ depends: [
1818
"stdio" {>= "v0.14" & < "v0.15"}
1919
"topological_sort" {>= "v0.14" & < "v0.15"}
2020
"dune" {>= "2.0.0"}
21-
"ppxlib" {>= "0.11.0"}
21+
"ppxlib" {>= "0.18.0"}
2222
"zarith" {>= "1.5"}
2323
]
2424
synopsis: "RTL Hardware Design in OCaml"

ppx/src/ppx_deriving_hardcaml_zero.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ let get_length ~loc label_declaration =
7575
| None -> raise_errorf ~loc "[%s] length attribute must be set" deriver
7676

7777

78-
let field_name ~loc txt =
79-
pexp_constant ~loc (Pconst_string (txt, None))
78+
let field_name ~loc txt = estring ~loc txt
8079

8180
let get_rtlname ~loc txt label_declaration =
8281
match Attribute.(find rtlname) label_declaration with
@@ -104,7 +103,7 @@ let get_doc ~loc label_declaration =
104103
match Attribute.(find doc) label_declaration with
105104
| Some (expr) -> (
106105
match expr.pexp_desc with
107-
| Pexp_constant (Pconst_string(str, _)) -> Some str
106+
| Pexp_constant (Pconst_string(str, _, _)) -> Some str
108107
| _ -> raise_errorf ~loc "[%s] doc atttribute must be a string" deriver)
109108
| None -> None
110109

@@ -507,7 +506,7 @@ let expand_ast_label opts var
507506
let ast = pexp_ident ~loc (Located.mk ~loc (Ldot (mname, "ast"))) in
508507
let mname =
509508
let mname = Longident.flatten_exn mname |> String.concat ~sep:"." in
510-
pexp_constant ~loc (Pconst_string(mname, None)) in
509+
estring ~loc mname in
511510
[%expr Module { name = [%e mname]
512511
; ast = [%e ast] }]
513512
in
@@ -559,7 +558,7 @@ let expand_ast_label opts var
559558
let doc =
560559
match get_doc ~loc label_declaration with
561560
| None -> [%expr None]
562-
| Some doc -> [%expr Some [%e pexp_constant ~loc (Pconst_string(doc, None))]]
561+
| Some doc -> [%expr Some [%e estring ~loc doc]]
563562
in
564563
[%expr { Ppx_deriving_hardcaml_runtime.Interface.Ast.Field.
565564
name = [%e field_name]

0 commit comments

Comments
 (0)