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

Poly. variants expression prints warning instead of error #3424

Closed
vicuna opened this issue Jan 7, 2005 · 2 comments
Closed

Poly. variants expression prints warning instead of error #3424

vicuna opened this issue Jan 7, 2005 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jan 7, 2005

Original bug ID: 3424
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Gilles Dubochet
Version: 3.08.2
OS: Mac OS X
Submission from: dhcp-11-126.inf.ed.ac.uk (129.215.11.126)

When this following expression is compiled:
"let f : ([A]->int) = function A -> 1 | `B -> 2"

The following warning is printed:
"Warning: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
AnyExtraTag Warning: this match case is unused. val tata : [ A ] -> int = "

This warning is not correct: the pattern is complete, or rather is more than
complete. The B case cannot be used ("f B" will generate as expected a type
error), and the `AnyExtraTag cannot be used either.

I don't know what the correct behaviour would be: either changing the warning
message, or treat this as an error (this seems to be the more natural way: I
cannot see any situation where such code would be acceptable).

@vicuna
Copy link
Author

vicuna commented Feb 2, 2005

Comment author: administrator

Full_Name: Gilles Dubochet
Version: 3.08.2

When this following expression is compiled:
"let f : ([A]->int) = function A -> 1 | `B -> 2"

The following warning is printed:
"Warning: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
AnyExtraTag Warning: this match case is unused. val tata : [ A ] -> int = "

Indeed, the first warning is wrong, due to a small bug in the way tags were
counted.
Thank you for the report; this will be fixed in 3.08.3.

The second warning is correct, and sufficient here.

Jacques Garrigue

@vicuna
Copy link
Author

vicuna commented Feb 2, 2005

Comment author: administrator

Fixed by JG in 3.08 branch (2005-02-02)

@vicuna vicuna closed this as completed Feb 2, 2005
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant