From f47834d80b3fe6300bbd61ea0e0278b9f10136ec Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 29 Aug 2018 20:22:59 +0300 Subject: [PATCH] Add modules_without_implementation example to wrapped transition mode Signed-off-by: Rudi Grinberg --- src/module.ml | 13 +++++++++---- .../test-cases/wrapped-transition/fooexe.ml | 3 +++ .../test-cases/wrapped-transition/lib/dune | 1 + .../test-cases/wrapped-transition/lib/intf_only.mli | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 test/blackbox-tests/test-cases/wrapped-transition/lib/intf_only.mli diff --git a/src/module.ml b/src/module.ml index c7d26694..2ef21c34 100644 --- a/src/module.ml +++ b/src/module.ml @@ -166,11 +166,16 @@ let to_sexp { name; impl; intf; obj_name ; pp } = let deprecate t = { t with - intf = None - ; impl = + impl = Some ( - let impl = Option.value_exn t.impl in - let (base, _) = Path.split_extension impl.path in + let path = + match t.intf, t.impl with + | Some _, Some impl + | None, Some impl -> impl.path + | Some intf, _ -> intf.path + | None, None -> assert false + in + let (base, _) = Path.split_extension path in { syntax = OCaml ; path = Path.extend_basename base ~suffix:".ml-gen" } diff --git a/test/blackbox-tests/test-cases/wrapped-transition/fooexe.ml b/test/blackbox-tests/test-cases/wrapped-transition/fooexe.ml index 05f52bc8..7ea5bdc1 100644 --- a/test/blackbox-tests/test-cases/wrapped-transition/fooexe.ml +++ b/test/blackbox-tests/test-cases/wrapped-transition/fooexe.ml @@ -2,3 +2,6 @@ Mylib.Bar.run ();; Mylib.Foo.run ();; Bar.run ();; Foo.run ();; + +module Y : Mylib.Intf_only.S = struct end +module X : Intf_only.S = struct end diff --git a/test/blackbox-tests/test-cases/wrapped-transition/lib/dune b/test/blackbox-tests/test-cases/wrapped-transition/lib/dune index 29516cc2..8cd2dab1 100644 --- a/test/blackbox-tests/test-cases/wrapped-transition/lib/dune +++ b/test/blackbox-tests/test-cases/wrapped-transition/lib/dune @@ -1,3 +1,4 @@ (library (name mylib) + (modules_without_implementation intf_only) (wrapped (transition "Will be removed past 2020-20-20"))) \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/wrapped-transition/lib/intf_only.mli b/test/blackbox-tests/test-cases/wrapped-transition/lib/intf_only.mli new file mode 100644 index 00000000..d63d6c08 --- /dev/null +++ b/test/blackbox-tests/test-cases/wrapped-transition/lib/intf_only.mli @@ -0,0 +1 @@ +module type S = sig end