From 09442811de631427715a2c70bfb89aa252ebc099 Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Mon, 13 Mar 2023 13:44:42 +0100 Subject: [PATCH] Compute keep_flags from within for_alias_module Signed-off-by: Etienne Millon --- src/dune_rules/compilation_context.ml | 3 ++- src/dune_rules/compilation_context.mli | 2 +- src/dune_rules/module_compilation.ml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dune_rules/compilation_context.ml b/src/dune_rules/compilation_context.ml index e50b5f5d92ca..77f11124d4d1 100644 --- a/src/dune_rules/compilation_context.ml +++ b/src/dune_rules/compilation_context.ml @@ -208,7 +208,8 @@ let create ~super_context ~scope ~expander ~obj_dir ~modules ~flags ; loc } -let for_alias_module t ?(keep_flags = false) alias_module = +let for_alias_module t alias_module = + let keep_flags = Modules.is_stdlib_alias (modules t) alias_module in let flags = if keep_flags then t.flags else diff --git a/src/dune_rules/compilation_context.mli b/src/dune_rules/compilation_context.mli index b0495272701e..308c2ead0b8a 100644 --- a/src/dune_rules/compilation_context.mli +++ b/src/dune_rules/compilation_context.mli @@ -43,7 +43,7 @@ val create : -> t Memo.t (** Return a compilation context suitable for compiling the alias module. *) -val for_alias_module : t -> ?keep_flags:bool -> Module.t -> t +val for_alias_module : t -> Module.t -> t val super_context : t -> Super_context.t diff --git a/src/dune_rules/module_compilation.ml b/src/dune_rules/module_compilation.ml index 63ee922212ab..666c50763836 100644 --- a/src/dune_rules/module_compilation.ml +++ b/src/dune_rules/module_compilation.ml @@ -486,7 +486,7 @@ let build_all cctx = if Modules.is_stdlib_alias modules m then (* XXX it would probably be simpler if the flags were just for this module in the definition of the stanza *) - Compilation_context.for_alias_module cctx m ~keep_flags:true + Compilation_context.for_alias_module cctx m else cctx in build_module cctx m))