diff options
-rw-r--r-- | camlp4/test/fixtures/bug_escaping_quot.ml | 7 | ||||
-rw-r--r-- | camlp4/test/fixtures/metalib.ml | 5 | ||||
-rw-r--r-- | camlp4/test/fixtures/pr4452.ml | 24 |
3 files changed, 36 insertions, 0 deletions
diff --git a/camlp4/test/fixtures/bug_escaping_quot.ml b/camlp4/test/fixtures/bug_escaping_quot.ml new file mode 100644 index 000000000..57e5ecdbd --- /dev/null +++ b/camlp4/test/fixtures/bug_escaping_quot.ml @@ -0,0 +1,7 @@ +open Camlp4.PreCast;; +Camlp4_config.antiquotations := true;; +let expand_my_quot_expr _loc _loc_name_opt quotation_contents = + Printf.eprintf "%S\n%!" quotation_contents; + <:expr< dummy >> +;; +Syntax.Quotation.add "my" Syntax.Quotation.DynAst.expr_tag expand_my_quot_expr;; diff --git a/camlp4/test/fixtures/metalib.ml b/camlp4/test/fixtures/metalib.ml new file mode 100644 index 000000000..22dff11c6 --- /dev/null +++ b/camlp4/test/fixtures/metalib.ml @@ -0,0 +1,5 @@ +#load "camlp4of.cma";; +open Camlp4.PreCast;; +module M = Ast.Meta.Make(Ast.Meta.MetaGhostLoc);; +let ghost = Loc.ghost;; +M.Expr.meta_ctyp ghost <:ctyp@ghost< int >>;; diff --git a/camlp4/test/fixtures/pr4452.ml b/camlp4/test/fixtures/pr4452.ml new file mode 100644 index 000000000..bed7db7b7 --- /dev/null +++ b/camlp4/test/fixtures/pr4452.ml @@ -0,0 +1,24 @@ +open Camlp4.PreCast + +let _loc = Loc.mk "?" + +let base base fields ty = + let fields = List.fold_right (fun field acc -> + let c = <:ctyp< $lid:field$ : $uid:field$.record >> in + <:ctyp< $c$ ; $acc$ >>) fields <:ctyp< >> + in + <:module_binding< $uid:base$ : + sig type record = { + key : $ty$; + $fields$ + } end = struct + type record = { + key : $ty$; + $fields$ + } end + >> + +let _ = + let b = base "b" ["f1"; "f2"] <:ctyp< int >> in + Camlp4.PreCast.Printers.OCaml.print_implem + <:str_item< module rec $b$ >> |