summaryrefslogtreecommitdiff
path: root/dev-ml/ppx_optcomp/files/ppx_optcomp-0.14.0-ppxlib-0.18.0.patch
blob: 063b9df74aba371dbd23d9b06a0cda0861aa050c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
commit a4422ecd7e0677569533b1dae07924f5d786e8f6 (HEAD, origin/upgrade-ppxlib-0.18.0)
Author: Nathan Rebours <nathan.p.rebours@gmail.com>
Date:   Mon Oct 5 18:35:26 2020 +0200

    Make ppx_optcomp compatible with ppxlib.0.18.0
    
    ppxlib.0.18.0 upgrades to the 4.11 AST which results in a change
    in string constants representation. This PR makes ppx_optcomp
    compatible with the latest ppxlib.
    
    You might want for the actual release of ppxlib.0.18.0 before merging
    this!
    
    Signed-off-by: Nathan Rebours <nathan.p.rebours@gmail.com>

diff --git a/ppx_optcomp.opam b/ppx_optcomp.opam
index 20eb7c5..cbe8b5c 100644
--- a/ppx_optcomp.opam
+++ b/ppx_optcomp.opam
@@ -15,7 +15,7 @@ depends: [
   "base"   {>= "v0.14" & < "v0.15"}
   "stdio"  {>= "v0.14" & < "v0.15"}
   "dune"   {>= "2.0.0"}
-  "ppxlib" {>= "0.11.0"}
+  "ppxlib" {>= "0.18.0"}
 ]
 synopsis: "Optional compilation for OCaml"
 description: "
diff --git a/src/interpreter.ml b/src/interpreter.ml
index f1da14b..1c6d726 100644
--- a/src/interpreter.ml
+++ b/src/interpreter.ml
@@ -241,7 +241,7 @@ let rec eval env e : Value.t =
   match e.pexp_desc with
   | Pexp_constant (Pconst_integer    (x, None)) -> Int (parse_int loc x)
   | Pexp_constant (Pconst_char    x       ) -> Char x
-  | Pexp_constant (Pconst_string (x, _   )) -> String x
+  | Pexp_constant (Pconst_string (x, _, _   )) -> String x
 
   | Pexp_construct ({ txt = Lident "true" ; _ }, None) -> Bool true
   | Pexp_construct ({ txt = Lident "false"; _ }, None) -> Bool false
@@ -361,7 +361,7 @@ and bind env patt value =
 
   | Ppat_constant (Pconst_integer    (x, None)), Int    y when parse_int loc x = y -> env
   | Ppat_constant (Pconst_char    x       ), Char   y when Char.equal   x y -> env
-  | Ppat_constant (Pconst_string (x, _   )), String y when String.equal x y -> env
+  | Ppat_constant (Pconst_string (x, _, _   )), String y when String.equal x y -> env
 
   | Ppat_construct ({ txt = Lident "true" ; _ }, None), Bool true  -> env
   | Ppat_construct ({ txt = Lident "false"; _ }, None), Bool false -> env
diff --git a/src/ppx_optcomp.ml b/src/ppx_optcomp.ml
index a2573de..d87ea24 100644
--- a/src/ppx_optcomp.ml
+++ b/src/ppx_optcomp.ml
@@ -81,7 +81,7 @@ module Ast_utils = struct
   let get_string ~loc payload =
     let e = get_expr ~loc payload in
     match e with
-    | { pexp_desc = Pexp_constant (Pconst_string (x, _ )); _ } -> x
+    | { pexp_desc = Pexp_constant (Pconst_string (x, _, _ )); _ } -> x
     | _ -> Location.raise_errorf ~loc "optcomp: invalid directive syntax, expected string"
 
 end