Add somewhat hacky patch to get it to compile - sent upstream today.

This commit is contained in:
Richard W.M. Jones 2020-04-22 15:52:18 +01:00
parent 50f4b71bb7
commit 23126a7d23
2 changed files with 130 additions and 0 deletions

View File

@ -15,6 +15,9 @@ License: MIT
URL: https://github.com/ocaml-ppx/%{upname}
Source0: %{url}/archive/%{version}+%{ocamlvr}/%{upname}-%{version}.tar.gz
# Sent upstream 2020-04-22.
Patch1: ppx_tools-6.1-ocaml-4.11.patch
BuildRequires: ocaml >= %{ocamlvr}
BuildRequires: ocaml-dune >= 1.6
BuildRequires: ocaml-findlib

View File

@ -0,0 +1,127 @@
diff -ur ppx_tools-6.1-4.10.0.old/ast_convenience.ml ppx_tools-6.1-4.10.0.new/ast_convenience.ml
--- ppx_tools-6.1-4.10.0.old/ast_convenience.ml 2020-02-12 00:59:14.000000000 +0000
+++ ppx_tools-6.1-4.10.0.new/ast_convenience.ml 2020-04-22 15:41:13.243499094 +0100
@@ -29,7 +29,7 @@
type t = Parsetree.constant =
Pconst_integer of string * char option
| Pconst_char of char
- | Pconst_string of string * string option
+ | Pconst_string of string * Location.t * string option
| Pconst_float of string * char option
let of_constant x = x
@@ -53,7 +53,7 @@
| xs -> Exp.tuple ?loc ?attrs xs
let cons ?loc ?attrs hd tl = constr ?loc ?attrs "::" [hd; tl]
let list ?loc ?attrs l = List.fold_right (cons ?loc ?attrs) l (nil ?loc ?attrs ())
-let str ?loc ?attrs s = Exp.constant ?loc ?attrs (Pconst_string (s, None))
+let str ?loc ?attrs s = Exp.constant ?loc ?attrs (Pconst_string (s, Location.none, None))
let int ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (string_of_int x, None))
let int32 ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (Int32.to_string x, Some 'l'))
let int64 ?loc ?attrs x = Exp.constant ?loc ?attrs (Pconst_integer (Int64.to_string x, Some 'L'))
@@ -85,7 +85,7 @@
| xs -> Pat.tuple ?loc ?attrs xs
let plist ?loc ?attrs l = List.fold_right (pcons ?loc ?attrs) l (pnil ?loc ?attrs ())
-let pstr ?loc ?attrs s = Pat.constant ?loc ?attrs (Pconst_string (s, None))
+let pstr ?loc ?attrs s = Pat.constant ?loc ?attrs (Pconst_string (s, Location.none, None))
let pint ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_integer (string_of_int x, None))
let pchar ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_char x)
let pfloat ?loc ?attrs x = Pat.constant ?loc ?attrs (Pconst_float (string_of_float x, None))
@@ -93,11 +93,11 @@
let tconstr ?loc ?attrs c l = Typ.constr ?loc ?attrs (lid ?loc c) l
let get_str = function
- | {pexp_desc=Pexp_constant (Pconst_string (s, _)); _} -> Some s
+ | {pexp_desc=Pexp_constant (Pconst_string (s, _, _)); _} -> Some s
| _ -> None
let get_str_with_quotation_delimiter = function
- | {pexp_desc=Pexp_constant (Pconst_string (s, d)); _} -> Some (s, d)
+ | {pexp_desc=Pexp_constant (Pconst_string (s, _, d)); _} -> Some (s, d)
| _ -> None
let get_lid = function
diff -ur ppx_tools-6.1-4.10.0.old/ast_convenience.mli ppx_tools-6.1-4.10.0.new/ast_convenience.mli
--- ppx_tools-6.1-4.10.0.old/ast_convenience.mli 2020-02-12 00:59:14.000000000 +0000
+++ ppx_tools-6.1-4.10.0.new/ast_convenience.mli 2020-04-22 15:38:39.785437823 +0100
@@ -32,7 +32,7 @@
type t = Parsetree.constant =
Pconst_integer of string * char option
| Pconst_char of char
- | Pconst_string of string * string option
+ | Pconst_string of string * Location.t * string option
| Pconst_float of string * char option
(** Convert Asttypes.constant to Constant.t *)
diff -ur ppx_tools-6.1-4.10.0.old/ast_mapper_class.ml ppx_tools-6.1-4.10.0.new/ast_mapper_class.ml
--- ppx_tools-6.1-4.10.0.old/ast_mapper_class.ml 2020-02-12 00:59:14.000000000 +0000
+++ ppx_tools-6.1-4.10.0.new/ast_mapper_class.ml 2020-04-22 15:48:15.989092767 +0100
@@ -603,6 +603,8 @@
| PTyp x -> PTyp (this # typ x)
| PPat (x, g) -> PPat (this # pat x, map_opt (this # expr) g)
| PSig x -> PSig (this # signature x)
+
+ method constant (c : Parsetree.constant) = c (* XXX? *)
end
@@ -623,6 +625,7 @@
class_type = (fun _ -> this # class_type);
class_type_declaration = (fun _ -> this # class_type_declaration);
class_type_field = (fun _ -> this # class_type_field);
+ constant = (fun _ -> this # constant);
constructor_declaration = (fun _ -> this # constructor_declaration);
expr = (fun _ -> this # expr);
extension = (fun _ -> this # extension);
diff -ur ppx_tools-6.1-4.10.0.old/ast_mapper_class.mli ppx_tools-6.1-4.10.0.new/ast_mapper_class.mli
--- ppx_tools-6.1-4.10.0.old/ast_mapper_class.mli 2020-02-12 00:59:14.000000000 +0000
+++ ppx_tools-6.1-4.10.0.new/ast_mapper_class.mli 2020-04-22 15:47:01.257106016 +0100
@@ -22,6 +22,7 @@
method class_type: class_type -> class_type
method class_type_declaration: class_type_declaration -> class_type_declaration
method class_type_field: class_type_field -> class_type_field
+ method constant : constant -> constant
method constructor_arguments: constructor_arguments -> constructor_arguments
method constructor_declaration: constructor_declaration -> constructor_declaration
method expr: expression -> expression
diff -ur ppx_tools-6.1-4.10.0.old/dune ppx_tools-6.1-4.10.0.new/dune
--- ppx_tools-6.1-4.10.0.old/dune 2020-02-12 00:59:14.000000000 +0000
+++ ppx_tools-6.1-4.10.0.new/dune 2020-04-22 15:50:10.948610676 +0100
@@ -3,7 +3,8 @@
(synopsis "Tools for authors of ppx rewriters and other syntactic tools")
(wrapped false)
(modules ast_convenience ast_mapper_class)
- (libraries compiler-libs.common))
+ (libraries compiler-libs.common)
+ (flags (:standard -w "-3")))
(library
(name ppx_metaquot)
@@ -14,12 +15,14 @@
(modules ppx_metaquot)
(ppx.driver (main Ppx_metaquot.Main.main))
(ppx_runtime_libraries ppx_tools)
- (libraries compiler-libs.common ppx_tools ast_lifter))
+ (libraries compiler-libs.common ppx_tools ast_lifter)
+ (flags (:standard -w "-3")))
(executable
(name genlifter)
(modules genlifter)
- (libraries compiler-libs.common ppx_tools))
+ (libraries compiler-libs.common ppx_tools)
+ (flags (:standard -w "-3")))
(executable
(name dumpast)
@@ -29,7 +32,8 @@
(executable
(name ppx_metaquot_main)
(modules ppx_metaquot_main)
- (libraries ppx_metaquot))
+ (libraries ppx_metaquot)
+ (flags (:standard -w "-3")))
(executable
(name rewriter)