Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006194OCamlOCaml generalpublic2013-09-26 15:292013-09-26 21:40
Reportermottl 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.01.0 
Target VersionFixed in Version4.01.1+dev 
Summary0006194: Incorrect warning about unused match cases with first-class modules in patterns
DescriptionLets consider the following code snippet:

----------
module type S = sig val x : bool end

let f = function
  | Some (module M : S) when M.x -> ()
  | Some _ -> ()
  | None -> ()
----------

The compiler will warn that the second match case is unused. This is incorrect, because the first case is guarded. It seems that the warning mistakenly assumes that matching first-class modules in patterns makes them irrefutable even in the presence of guards.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0010403)
lpw25 (developer)
2013-09-26 17:11

The following fatal error is probably related:

    (* match.ml *)
    module type S = sig val x : bool end

    let f = function
    | Some (module M : S) when M.x -> ()
    | None -> ();;

$ ocamlc match.ml
>> Fatal error: Matching.comp_exit
Fatal error: exception Misc.Fatal_error
(0010406)
garrigue (manager)
2013-09-26 21:40

Fixed in 4.01 branch revision 14189, file parmatch.ml.
Apparently already fixed in trunk (but should check).

- Issue History
Date Modified Username Field Change
2013-09-26 15:29 mottl New Issue
2013-09-26 17:11 lpw25 Note Added: 0010403
2013-09-26 21:40 garrigue Note Added: 0010406
2013-09-26 21:40 garrigue Status new => resolved
2013-09-26 21:40 garrigue Fixed in Version => 4.01.1+dev
2013-09-26 21:40 garrigue Resolution open => fixed
2013-09-26 21:40 garrigue Assigned To => garrigue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker