Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005738OCamlOCaml tools (ocaml{lex,yacc,dep,browser,debug})public2012-08-25 09:452012-08-25 13:37
Reporterhongboz 
Assigned Togarrigue 
PrioritynormalSeveritymajorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.00.1+dev 
Summary0005738: ocamldep is broken (especially when you use first class module)
Descriptionlet f (module A : B) =
  A.v ;;

will generate dependency on module A, actually not. If you happens to have a file A.ml(very likely), it will tries to compile module A. Reading the mantis quite a bit, I found this is a long existing problem. Things become worse if you use first class modules a lot. Is there solutions to work around such problem?
I set the severity to be major, because it nearly breaks all my existing repos when I switched to first class modules.

Many thanks
TagsNo tags attached.
Attached Filestxt file icon patch-5738.txt [^] (4,317 bytes) 2012-08-25 12:21 [Show Content]

- Relationships

-  Notes
(0007979)
garrigue (manager)
2012-08-25 11:57

Fixed in trunk and 4.00, revisions 12878 and 12879.
(0007980)
lefessan (developer)
2012-08-25 12:20
edited on: 2012-08-25 12:22

Are you sure it is fixed ? Compiling latest SVN does not solve the problem for me:

$ touch a.ml
$ touch d.ml
$ cat > c.ml
module type B = sig val x : int end
let f (module A : B) = A.x
module X = struct let x = 4 end;;
let (module D : B) = (module X : B ) in D.x;;
$ ocamlc -c c.ml
 (works, no dependency on a.ml and d.ml)
$ ocamldep c.ml
c.cmo : d.cmo a.cmo
c.cmx : d.cmx a.cmx
 (dependencies are still there)

(0007981)
lefessan (developer)
2012-08-25 12:22

Jacques, could you check if it is fixed, and maybe try my patch that I was about to submit (attached to the bug report).
(0007982)
garrigue (manager)
2012-08-25 13:07

Sorry, I got confused by Ppat_type :-)
Fixed properly now, almost using Fabrice's code.
(0007983)
lefessan (developer)
2012-08-25 13:27

and add_bindings recf bv pel =
  let bv' = List.fold_left (fun bv (p, _) -> add_pattern bv p) bv pel in
>> let bv = if recf = Recursive then bv else bv' in
  List.iter (fun (_, e) -> add_expr bv e) pel;
  bv'

Isn't it

  let bv = if recf = Recursive then bv' else bv in

instead ?
(0007984)
garrigue (manager)
2012-08-25 13:37

Sorry, I'm too sleepy today.
I should have reused your code for this part.

By the way, the use of a mutable variable for patterns is intentional:
the module only comes in scope after processing the whole pattern.

- Issue History
Date Modified Username Field Change
2012-08-25 09:45 hongboz New Issue
2012-08-25 11:57 garrigue Note Added: 0007979
2012-08-25 11:57 garrigue Status new => closed
2012-08-25 11:57 garrigue Assigned To => garrigue
2012-08-25 11:57 garrigue Resolution open => fixed
2012-08-25 11:57 garrigue Fixed in Version => 4.00.1+dev
2012-08-25 12:20 lefessan Note Added: 0007980
2012-08-25 12:20 lefessan Status closed => feedback
2012-08-25 12:20 lefessan Resolution fixed => reopened
2012-08-25 12:21 lefessan File Added: patch-5738.txt
2012-08-25 12:22 lefessan Note Added: 0007981
2012-08-25 12:22 lefessan Note Edited: 0007980 View Revisions
2012-08-25 13:07 garrigue Note Added: 0007982
2012-08-25 13:07 garrigue Status feedback => closed
2012-08-25 13:07 garrigue Resolution reopened => fixed
2012-08-25 13:27 lefessan Note Added: 0007983
2012-08-25 13:27 lefessan Status closed => feedback
2012-08-25 13:27 lefessan Resolution fixed => reopened
2012-08-25 13:37 garrigue Note Added: 0007984
2012-08-25 13:37 garrigue Status feedback => closed
2012-08-25 13:37 garrigue Resolution reopened => fixed
2013-08-19 15:58 doligez Category OCaml tools (ocaml{lex,yacc,dep,browser}) => OCaml tools (ocaml{lex,yacc,dep,browser,debug})


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker