-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Ocamldep can miss dependencies #7470
Description
Original bug ID: 7470
Reporter: @Octachron
Assigned to: @Octachron
Status: assigned (set by @xavierleroy on 2017-02-19T16:55:35Z)
Resolution: open
Priority: low
Severity: minor
Target version: 4.07.0+dev/beta2/rc1/rc2
Category: tools (ocaml{lex,yacc,dep,debug,...})
Related to: #8427 #4081 #4618 #5624 #5870
Bug description
Ocamldep is overly optimistic when opening or including unknown modules, which can lead to missed dependencies.
Consider this set of three files
(* a.ml *)
module M = struct module N = struct end end
open B
open M
;; N.x
(* b.ml *)
module M = struct end
(* n.ml *)
let x = 1
Running ocamldep -modules a.ml yields:
a.ml : B
whereas the correct dependencies would be
a.ml : B N
The dependency over the module N is missed, because ocamldep infers (erroneously) that the module M opened by "open M" is A.M whereas the module truly opened is B.M.
(I am not sure if this problem ever happens in real situation, but I thought it ought to be at least referenced.)