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

fatal typing error with local module + functor + polymorphic variant #5057

vicuna opened this issue May 20, 2010 · 1 comment


None yet
1 participant
Copy link

commented May 20, 2010

Original bug ID: 5057
Reporter: @ygrek
Status: closed (set by @garrigue on 2010-05-21T01:27:44Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11.2
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

$ cat

module TT = struct
module IntSet = Set.Make(struct type t = int let compare = compare 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
f ()

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

$ ocamlc -version

Additional information

This is a minimized example, originally occurred in real sensible code.
Also reported to fail in 3.12.0+dev17


This comment has been minimized.

Copy link

commented May 21, 2010

Comment author: @garrigue

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

@vicuna vicuna closed this May 21, 2010

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.