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
Add warning for [f ?a ~b] and similar #7837
Original bug ID: 7837
Warning 16 covers cases where an optional argument is at the end of a function type, where it cannot be erased.
In #7836 it was determined that if the optional argument is followed by only labeled arguments, warning 16 does not apply because the special case for total application can erase the optional argument.
let f ?a ~b = ()
the function call
(and not f ~b:()) will succeed in erasing ?a.
However, under the circumstances of enabling warning 6 (label was omitted in the application of function) and warnings to errors, it is again statically impossible to call f without the optional argument.
I would like to propose a separate warning for this case, with a message similar to:
Warning #: this optional argument can only be erased by totally applying the function while omitting all labels
and if possible, enabling warning 6 should imply this hypothetical new warning.
Comment author: jtsang
This is certainly a solution, but I'm wary of making the semantics of warnings depend on the state of other warnings.
Additionally, warning 6/-Werr is at the call site, whereas this is at the definition point, so it might not be consistent between the two.