Ashish Agarwal
2014-09-15 15:20:37 UTC
The following example leads to an assertion from printtyp.ml when loaded in
utop. I made the example as small as I could, but unfortunately it still
depends on a package called Future which in turn depends on Core.
To run it you'll have to do:
$ opam pin add future https://github.com/agarwal/future
Then hit Y to install the package.
$ cat tmp.ml
open Future_std
let f items =
Pipe.peek_deferred items >>= function
| `Comment _ -> return ()
#require "future.std";;
# #use "tmp.ml";;
Fatal error: exception "Assert_failure typing/printtyp.ml:583:12"
Raised at file "bytes.ml", line 220, characters 25-34
Doing the equivalent in the standard ocaml toploop or compiling with
ocamlc/ocamlopt doesn't exhibit this assertion. You correctly get the real
error reported:
$ ocamlfind ocamlc -package future.std -thread tmp.ml
File "tmp.ml", line 5, characters 4-14:
Error: This pattern matches values of type [? `Comment of 'a ]
but a pattern was expected which matches values of type
('b Future_std.Deferred.t as 'b) Future_std.Deferred.t
The second variant type does not allow tag(s) `Comment
The assertion is also avoided if you replace `open Future_std` with a
copy/paste of the relevant part of Future_std.
utop. I made the example as small as I could, but unfortunately it still
depends on a package called Future which in turn depends on Core.
To run it you'll have to do:
$ opam pin add future https://github.com/agarwal/future
Then hit Y to install the package.
$ cat tmp.ml
open Future_std
let f items =
Pipe.peek_deferred items >>= function
| `Comment _ -> return ()
#require "future.std";;
# #use "tmp.ml";;
Fatal error: exception "Assert_failure typing/printtyp.ml:583:12"
Raised at file "bytes.ml", line 220, characters 25-34
Doing the equivalent in the standard ocaml toploop or compiling with
ocamlc/ocamlopt doesn't exhibit this assertion. You correctly get the real
error reported:
$ ocamlfind ocamlc -package future.std -thread tmp.ml
File "tmp.ml", line 5, characters 4-14:
Error: This pattern matches values of type [? `Comment of 'a ]
but a pattern was expected which matches values of type
('b Future_std.Deferred.t as 'b) Future_std.Deferred.t
The second variant type does not allow tag(s) `Comment
The assertion is also avoided if you replace `open Future_std` with a
copy/paste of the relevant part of Future_std.
--
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs