From 53b65edd57ea98a39c9f8268973a7aea23e54262 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 7 Aug 2018 11:33:22 +0300 Subject: [PATCH] Fix #1107 -opaque should be passed for mli only modules or for all modules when opaque mode is on Signed-off-by: Rudi Grinberg --- CHANGES.md | 3 +++ src/module_compilation.ml | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index e4b4238d8bb7..111899a2aa8a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,9 @@ next - Fix `$ jbuilder --dev` (#1104, fixes #1103, @rgrinberg) +- Fix #1107. `-opaque` wasn't correctly being added to modules without + an interface. (#1108, fix #1107, @rgrinberg) + 1.1.0 (06/08/2018) ------------------ diff --git a/src/module_compilation.ml b/src/module_compilation.ml index a8167001b888..2baafd52bd59 100644 --- a/src/module_compilation.ml +++ b/src/module_compilation.ml @@ -88,7 +88,12 @@ let build_cm cctx ?sandbox ?(dynlink=true) ~dep_graphs ~cm_kind (m : Module.t) = SC.add_rule sctx (Build.symlink ~src:in_obj_dir ~dst:in_dir)) end; let opaque_arg = - if opaque && cm_kind = Cmi then + let intf_only = (* we add opaque even outside "dev" for mli only *) + cm_kind = Cmi + && not (Module.has_impl m) + && Ocaml_version.supports_opaque_for_mli ctx.version + in + if opaque || intf_only then Arg_spec.A "-opaque" else As []