Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007295OCaml-for ocamlbuild use https://github.com/ocaml/ocamlbuild/issuespublic2016-07-20 15:412017-09-24 17:33
Reportertormen 
Assigned Togasche 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version4.02.3 
Target VersionFixed in Versionlater 
Summary0007295: ocamlbuild foo.inferred.ml does yield a WRONG signature and ocamlc complains...
DescriptionNOT SURE IF THIS IS AN OCAMLBUILD or ocamlc problem... as I am quite new to the ocaml ecosystem, I let you figure that out if it's okey... (but I will hungrily consume any explanation about what category this bug should or should not be assigned to :)).

inferred.mli tells me
   val not_found : (unit -> 'a) -> bool and
when I compile it complains about
   val not_found : (unit -> unit) -> bool
not matching
   val not_found : (unit -> 'a) -> bool
                
Steps To Reproduce
1.) foo.ml:
let not_found f = try f (); false with Not_found -> true

2.) ocamlbuild -use-ocamlfind -pkg core -tag "ppx(ppx-jane -as-ppx)" -tag thread -tag debug -tag bin_annot -tag short_paths -tag safe_string -cflags "-w +27@0..26-4@28..99-33-40-41-42-43-34-44" -cflags -strict-sequence -cflags -safe-string -verbose 0 -Is -use-ocamlfind -pkgs pgocaml,pgocaml.syntax,deriving,deriving-yojson.syntax,deriving-yojson,calendar -syntax camlp4o -tag thread foo.inferred.mli

3.) cat _build/foo.inferred.mli:
val not_found : (unit -> 'a) -> bool

4.) cp _build/foo.inferred.mli foo.mli

5.) ocamlbuild -use-ocamlfind -pkg core -tag "ppx(ppx-jane -as-ppx)" -tag thread -tag debug -tag bin_annot -tag short_paths -tag safe_string -cflags "-w +27@0..26-4@28..99-33-40-41-42-43-34-44" -cflags -strict-sequence -cflags -safe-string -verbose 0 -Is -use-ocamlfind -pkgs pgocaml,pgocaml.syntax,deriving,deriving-yojson.syntax,deriving-yojson,calendar -syntax camlp4o -tag thread foo.native

Should yield:
File "foo.ml", line 1:
Error: The implementation foo.ml does not match the interface foo.cmi:
       Values do not match:
         val not_found : (unit -> unit) -> bool
       is not included in
         val not_found : (unit -> 'a) -> bool
       File "foo.ml", line 2, characters 4-13: Actual declaration
Command exited with code 2.
Additional InformationSo IMHO (also myself looking at the code) the _build/foo.inferred.mli should have contained:
         val not_found : (unit -> unit) -> bool

(because "f (); false" means f () needs to evaluate to unit (because of the following ";" and it certainly gets a unit input, so (unit -> unit) is correct.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0016101)
yallop (developer)
2016-07-20 15:49

In summary: ocamlbuild doesn't pass -strict-sequence through to 'ocamlc -i', so the inferred type used to generate the interface is more general than the type inferred when compiling the implementation.
(0016102)
tormen (reporter)
2016-07-20 15:55

Similar problem happens, when you change "f ()" to (Lazy.force f) in the above foo.ml
(0016103)
gasche (administrator)
2016-07-20 16:52

This is indeed an ocamlbuild issue and I fixed it in

  https://github.com/ocaml/ocamlbuild/commit/3d8e6385c8c7aba354984e315802a93a9dcf89f9 [^]

It will be available in the next release of ocamlbuild.

- Issue History
Date Modified Username Field Change
2016-07-20 15:41 tormen New Issue
2016-07-20 15:49 yallop Note Added: 0016101
2016-07-20 15:55 tormen Note Added: 0016102
2016-07-20 16:52 gasche Note Added: 0016103
2016-07-20 16:52 gasche Status new => resolved
2016-07-20 16:52 gasche Fixed in Version => later
2016-07-20 16:52 gasche Resolution open => fixed
2016-07-20 16:52 gasche Assigned To => gasche
2017-02-23 16:34 doligez Category OCamlbuild (the tool) => for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues [^]
2017-02-23 16:44 doligez Category for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues [^] => -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues [^]
2017-09-24 17:33 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker