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
Bad error message for some pattern matching on extensible variants #6897
Comments
Comment author: @garrigue I'm not sure what your problem is with this message. |
Comment author: @Drup For this program: type t = .. let f x = match x with The error message is the following: File "bla.ml", line 4, characters 10-33: This is a much better error message:
|
Comment author: @garrigue I see that at some point a hack was added to replace the extension by a clearer message, but that this does not work when the pattern is more complex. |
Comment author: @alainfrisch One could keep the pseudo pattern printed as today in the complex case, but when extension appear in it, add the additional text: Matching over values of open types (marked as *extension* above) must include a wild card pattern in order to be exhaustive. I've attached a patch (which keeps the special case for the open type at toplevel). |
Comment author: @garrigue Fixed in trunk at 16176, as suggested by Alain. |
Comment author: @gasche (I think you forgot to update the testsuite's reference file, CI fails.) |
Original bug ID: 6897
Reporter: @Drup
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-02-16T14:14:09Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.02.3+dev
Fixed in version: 4.03.0+dev / +beta1
Category: typing
Monitored by: @Drup @gasche
Bug description
type t = ..
type t += A
let f x = match x with
| [A] -> 1
| ::::_ -> 3
| [] -> 2
This code gives the following error message:
File "bla.ml", line 4, characters 10-64:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
extension::[]
The messages for extensible variants is usually far more understandable.
(Bug found by Adrien Nader)
File attachments
The text was updated successfully, but these errors were encountered: