Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007504OCamllanguage featurespublic2017-03-14 19:392017-03-15 00:16
Reporterjohnwhitington 
Assigned Tooctachron 
PrioritynormalSeveritytweakReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.04.0 
Target Version4.05.0 +dev/beta1/beta2/beta3/rc1Fixed in Version4.05.0 +dev/beta1/beta2/beta3/rc1 
Summary0007504: Case suggested by exhaustivity checker is wrong
DescriptionConsider:

type t =
  {a : int;
   b : string}

let f x y =
  match x with {a = c}, 0 -> 0

Which gives:

Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
({}, 1)

{} isn't legal pattern match syntax. Shouldn't it read "(_, 1)"?
TagsNo tags attached.
Attached Files

- Relationships
related to 0007169resolvedgasche Wording of non-exhaustivity warning is confusing for beginners 

-  Notes
(0017654)
octachron (developer)
2017-03-14 20:24

Good catch, this case is indeed mishandled; a fix is incoming in https://github.com/ocaml/ocaml/pull/1106. [^]
(0017655)
gasche (developer)
2017-03-14 22:27

I have memories of working on a very similar issue in the recent months -- maybe of having already changed the formulation in 4.05+dev. (Is this just jetlag?)
(0017656)
octachron (developer)
2017-03-14 22:38

@gasche, maybe some remininescences of https://github.com/ocaml/ocaml/pull/501 [^]
or 0007169? This is from last year, but the code in trunk and the 4.05 branch is still from this PR.
(0017657)
gasche (developer)
2017-03-14 22:44

Yes, exactly, thanks. We should have noticed the current issue if we had been more careful thinking about the corner cases of the last patch.

(I think one could argue that "{ _ }" should be accepted by the language when no field is matched upon, and that using it there could make the code more regular, but your patch is just fine.)
(0017658)
octachron (developer)
2017-03-14 22:56

Would it not be unpratical to type `{ _ }` without a record kind?
(0017659)
gasche (developer)
2017-03-15 00:16

Solved by merging octachron's proposed fix. Thanks for the patch, and thanks for the report.

- Issue History
Date Modified Username Field Change
2017-03-14 19:39 johnwhitington New Issue
2017-03-14 20:00 octachron Assigned To => octachron
2017-03-14 20:00 octachron Status new => assigned
2017-03-14 20:00 octachron Target Version => 4.05.0 +dev/beta1/beta2/beta3/rc1
2017-03-14 20:24 octachron Note Added: 0017654
2017-03-14 22:27 gasche Note Added: 0017655
2017-03-14 22:38 octachron Note Added: 0017656
2017-03-14 22:44 gasche Note Added: 0017657
2017-03-14 22:56 octachron Note Added: 0017658
2017-03-15 00:16 gasche Relationship added related to 0007169
2017-03-15 00:16 gasche Note Added: 0017659
2017-03-15 00:16 gasche Status assigned => resolved
2017-03-15 00:16 gasche Fixed in Version => 4.05.0 +dev/beta1/beta2/beta3/rc1
2017-03-15 00:16 gasche Resolution open => fixed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker