Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005057OCamlOCaml generalpublic2010-05-20 14:472010-05-21 03:27
Reporterygrek 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.2 
Target VersionFixed in Version3.12.0+dev 
Summary0005057: fatal typing error with local module + functor + polymorphic variant
Description$ cat bug.ml

module TT = struct
module IntSet = Set.Make(struct type t = int let compare = compare end)
end

let () =
  let f flag =
    let module T = TT in
    let _ = match flag with `A -> 0 | `B r -> r in
    let _ = match flag with `A -> T.IntSet.mem | `B r -> r in
    ()
  in
  f ()

$ ocamlc -c bug.ml
Fatal error: exception Ctype.Unify(_, _)

$ ocamlc -version
3.11.2
Additional InformationThis is a minimized example, originally occurred in real sensible code.
Also reported to fail in 3.12.0+dev17
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005478)
garrigue (manager)
2010-05-21 03:27

The correct code should be "f `A" :-)

There was a bug in the handling of levels inside polymorphic variant fields.
This is now fixed for 3.12.
Note that your report helped discover a more serious problem, where the following
code was wrongly accepted. Thank you very much.

let f flag =
  let module T = Set.Make(struct type t = int let compare = compare end) in
  let _ = match flag with `A -> 0 | `B r -> r in
  let _ = match flag with `A -> T.mem | `B r -> r in
  ()

- Issue History
Date Modified Username Field Change
2010-05-20 14:47 ygrek New Issue
2010-05-21 03:27 garrigue Note Added: 0005478
2010-05-21 03:27 garrigue Status new => closed
2010-05-21 03:27 garrigue Resolution open => fixed
2010-05-21 03:27 garrigue Fixed in Version => 3.12.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker