From 04ee6b0b2d683a202fc79fa1d3b2dddcf5d389d4 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 2 Jul 2018 16:33:12 +0700 Subject: [PATCH] Set M.syntax when reading subsystems generated by dune Signed-off-by: Rudi Grinberg --- src/installed_dune_file.ml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/installed_dune_file.ml b/src/installed_dune_file.ml index ad7fbf9a..5e1c0476 100644 --- a/src/installed_dune_file.ml +++ b/src/installed_dune_file.ml @@ -21,6 +21,17 @@ let parse_sub_systems ~parsing_context sexps = |> Sub_system_name.Map.mapi ~f:(fun name (_, version, data) -> let (module M) = Jbuild.Sub_system_info.get name in Syntax.check_supported M.syntax version; + let parsing_context = + (* We set the syntax to the version used when generating this subsystem. + We cannot do this for jbuild defined subsystems however since those use + 1.0 as the version. Which would correspond to the dune syntax (because + subsystems share the syntax of the dune lang) *) + match Univ_map.find_exn parsing_context (Syntax.key Stanza.syntax) with + | (0, 0) -> + parsing_context + | (_, _) -> + Univ_map.add parsing_context (Syntax.key M.syntax) (snd version) + in M.T (Sexp.Of_sexp.parse M.parse parsing_context data)) let of_sexp =