简体   繁体   中英

OCaml Mascot can't find modules from .mli files

Given the following source files:

(* /tmp/src/A.mli *)
val f : B.t -> B.t

(* /tmp/src/A.ml *)
let f (x : B.t) = x

(* /tmp/src/B.mli *)
type t

(* /tmp/src/B.ml *)
type t = int

I tried running the mascot code checker but it can't bind modules referenced from .mli files despite the -I flag. It resolves bindings from .ml files just fine.

$ mascot.native -config mascot.cfg -I /tmp/src /tmp/src/{A,B}.{ml,mli} -html /tmp/out
File "/tmp/src/A.mli", line 2, characters 8-11:
Error: Unbound module B
loading configuration files...
configuring checks...
analyzing dependencies...
running checks...
reporting to "/tmp/out" with output "html"...

It resolves bindings from .ml files just fine.

$ mascot.native -config mascot.cfg -I /tmp/src /tmp/src/{A,B}.ml -html /tmp/out
loading configuration files...
configuring checks...
analyzing dependencies...
running checks...
reporting to "/tmp/out" with output "html"...

I can't find anything in the manual which explains files-to-analyze but I believe Mascot is supposed to be run on interface files because the examples page includes examples of documentation problems:

 (** Module descriptoion. *) type t (* This one is not actually documented (bare comment instead of ocamldoc one). *) 

and interface checks don't seem to be run when I only supply source files.

I hit the same problem, and could make Mascot find module B only by compiling its interface file and having B.cmi in current directory, for example:

cd /tmp/src
ocamlc B.mli
mascot.native -config mascot.cfg {A,B}.{ml,mli} -html /tmp/out.html

It seems that there is no command-line option for telling Mascot where to look for .mli / .cmi files; the -I flag does not work for this, as mentioned in the question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM