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

Closed
vicuna opened this issue May 20, 2010 · 1 comment
Closed

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

vicuna opened this issue May 20, 2010 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna 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 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 information

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

@vicuna
Copy link
Author

vicuna 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 as completed 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
Labels
Projects
None yet
Development

No branches or pull requests

1 participant