Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
"Optional argument cannot be erased" warning is not issued when an optional argument is followed only by labeled arguments #5342
Original bug ID: 5342
An optional argument that is followed by labeled arguments but by no anonymous arguments cannot be erased, but no warning is issued.
let f ?x ~y = x,y;;
val f : ?x:'a -> y:'b -> 'a option * 'b =
Comment author: elnatan
This is true, but then I think the manual needs correction: http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html says, 'A function taking some optional arguments must also take at least one non-labeled argument.'
Also, when warning 6 ('labels were omitted in the application of this function.') is treated as an error, it would helpful to have the unerasable optional argument warning when an optional argument is followed by only labeled arguments.