Skip to content

Commit

Permalink
Imprpove loc for include_subdirs qualified
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg committed Nov 11, 2019
1 parent c927fb5 commit 1b02b4e
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/dune/dir_contents.ml
Original file line number Diff line number Diff line change
Expand Up @@ -593,24 +593,25 @@ end = struct
in
let libs_and_exes =
Memo.lazy_ (fun () ->
check_no_qualified Loc.none qualif_mode;
let loc =
Loc.in_file
(Path.source
( match File_tree.Dir.dune_file ft_dir with
| Some d -> File_tree.Dune_file.path d
| None ->
Path.Source.relative
(File_tree.Dir.path ft_dir)
"_unknown_" ))
in
check_no_qualified loc qualif_mode;
let modules =
let dialects = Dune_project.dialects (Scope.project d.scope) in
List.fold_left ((dir, [], files) :: subdirs)
~init:Module_name.Map.empty
~f:(fun acc ((dir : Path.Build.t), _local, files) ->
let modules = modules_of_files ~dialects ~dir ~files in
Module_name.Map.union acc modules ~f:(fun name x y ->
User_error.raise
~loc:
(Loc.in_file
(Path.source
( match File_tree.Dir.dune_file ft_dir with
| None ->
Path.Source.relative
(File_tree.Dir.path ft_dir)
"_unknown_"
| Some d -> File_tree.Dune_file.path d )))
User_error.raise ~loc
[ Pp.textf "Module %S appears in several directories:"
(Module_name.to_string name)
; Pp.textf "- %s"
Expand Down

0 comments on commit 1b02b4e

Please sign in to comment.