Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn about repeated function arguments especially for optional arguments #4904

Closed
vicuna opened this issue Oct 30, 2009 · 4 comments
Closed

Comments

@vicuna
Copy link

vicuna commented Oct 30, 2009

Original bug ID: 4904
Reporter: lukstafi
Assigned to: @alainfrisch
Status: closed (set by @alainfrisch on 2017-02-20T09:56:36Z)
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Has duplicate: #7029
Monitored by: domsj @gasche @ygrek @hcarty

Bug description

If this feature is implemented, the warning should be on by default.

let f ?(a=0) b ?(a=0) c = a+b+c;;

val f : ?a:int -> int -> ?a:int -> int -> int =

f ~a:7 1 2;;

  • : int = 3
@vicuna
Copy link
Author

vicuna commented Dec 12, 2016

Comment author: @mshinwell

@garrigue Ping (from 2010)...

@vicuna
Copy link
Author

vicuna commented Dec 13, 2016

Comment author: @garrigue

This case is covered by warning 27, which is not enabled by default.
Should we move it to warning 26 (which is enabled by default)?
What could be a good criterion? A combination of unused variable and shadowing?

I move it to Alain, since he is our unused variable specialist...

@vicuna
Copy link
Author

vicuna commented Dec 16, 2016

Comment author: lukstafi

As the original reporter, I would not object for this bug to be closed; perhaps as "Won't fix" -- referring to making this case enabled -- if the unused variable detection "warning 27" is covering this case since time immemorial. If this case (with labeled arguments) can be easily/efficiently differentiated though, it would still be beneficial to move it to warning 26 I think.

@vicuna
Copy link
Author

vicuna commented Feb 20, 2017

Comment author: @alainfrisch

I confirm that warning 27 is triggered (not in the toplevel, though). I don't think that triggering warning 26 for this case is relevant considering the current description of warning 26 (unused variable that is bound with "let" or "as"). And it would be weird to have a different warning than for

let f a b a c = a+b+c;;

(which also triggers warning 27)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants