You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7295 Reporter: tormen Assigned to:@gasche Status: closed (set by @xavierleroy on 2017-09-24T15:33:13Z) Resolution: fixed Priority: normal Severity: minor Version: 4.02.3 Fixed in version: later Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Bug description
NOT 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
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 information
So 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.
The text was updated successfully, but these errors were encountered:
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.
Original bug ID: 7295
Reporter: tormen
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2017-09-24T15:33:13Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.3
Fixed in version: later
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Bug description
NOT 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 information
So 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.
The text was updated successfully, but these errors were encountered: