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

Warning 8 suppresses warning 25 #7059

Closed
vicuna opened this issue Nov 26, 2015 · 7 comments
Closed

Warning 8 suppresses warning 25 #7059

vicuna opened this issue Nov 26, 2015 · 7 comments
Assignees
Milestone

Comments

@vicuna
Copy link

vicuna commented Nov 26, 2015

Original bug ID: 7059
Reporter: @johnwhitington
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2017-02-16T14:18:17Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Duplicate of: #6438
Monitored by: @gasche @hcarty

Bug description

match 1 with 1 when x = y -> 1;;

Warning 25: bad style, all clauses in this pattern-matching are guarded.

  • : int = 1

match 1 with 1 -> 1;;

Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
0

Shouldn't warning 8 be triggered in the first case in addition to warning 25 -- it's more important, isn't it?

@vicuna
Copy link
Author

vicuna commented Nov 26, 2015

Comment author: @johnwhitington

This appears to have already been discussed in 6438, and set to won't_fix. Sorry for the noise. Perhaps update the message as lpw25 suggests in 6438.

@vicuna
Copy link
Author

vicuna commented Nov 26, 2015

Comment author: @garrigue

Well, maybe we should have done something for 6438.
There are actually two problems with the current situation:

  • the message is not very clear
  • one may do -warn-error +8, and it will not result in an error for this specific case.

I would rather vote for suppressing warning 25, and have it raise warning 8 instead, with the following message:

Warning 8: this pattern-matching is not exhaustive.
All clauses in this pattern-matching are guarded.

@vicuna
Copy link
Author

vicuna commented Nov 27, 2015

Comment author: @alainfrisch

I would rather vote for suppressing warning 25, and have it raise warning 8 instead, with the following message:

I'm in favor of this change.

@vicuna
Copy link
Author

vicuna commented Nov 27, 2015

Comment author: @alainfrisch

Git PR: #315

@vicuna
Copy link
Author

vicuna commented Nov 27, 2015

Comment author: @johnwhitington

I like this solution.

@vicuna
Copy link
Author

vicuna commented Dec 9, 2015

Comment author: @alainfrisch

#315 merged for 4.03.

@vicuna
Copy link
Author

vicuna commented Dec 9, 2015

Comment author: @gasche

I consider this issue only partially solved as the current state does not print an exhaustivity counter-example in this case. Would it be ok if I re-opened the bug for tracking purposes? (Eg. "suspended".)

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