Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007837OCamltypingpublic2018-08-10 16:022018-08-13 19:57
Assigned To 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0007837: Add warning for [f ?a ~b] and similar
DescriptionWarning 16 covers cases where an optional argument is at the end of a function type, where it cannot be erased.

In 0007836 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.

I.e. for

let f ?a ~b = ()

the function call

f ()

(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.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
nojebar (developer)
2018-08-11 13:56
edited on: 2018-08-11 13:56

I am a bit skeptical about adding a new warning for this. What about triggering warning 16 in this situation if warning 6 is active and made into an error?

jtsang (reporter)
2018-08-13 19:57

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.

- Issue History
Date Modified Username Field Change
2018-08-10 16:02 jtsang New Issue
2018-08-11 13:56 nojebar Note Added: 0019300
2018-08-11 13:56 nojebar Note Edited: 0019300 View Revisions
2018-08-13 19:57 jtsang Note Added: 0019304

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker