From 12bf6bda4a033bce5e9ab8ce993c13d022b17841 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 | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 0e1d55e4..a28e1a7c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,9 @@ next - Fix duplicate profile argument in suggested command when an external library is missing (#1109, #1106, @emillon) +- 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 a8167001..a504e0a4 100644 --- a/src/module_compilation.ml +++ b/src/module_compilation.ml @@ -88,7 +88,9 @@ 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 = cm_kind = Cmi && not (Module.has_impl m) in + if opaque + || (intf_only && Ocaml_version.supports_opaque_for_mli ctx.version) then Arg_spec.A "-opaque" else As []