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

ocaml -rectypes is unsound wrt module subtyping #5343

vicuna opened this issue Aug 19, 2011 · 2 comments

ocaml -rectypes is unsound wrt module subtyping #5343

vicuna opened this issue Aug 19, 2011 · 2 comments


Copy link

@vicuna vicuna commented Aug 19, 2011

Original bug ID: 5343
Reporter: @garrigue
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2016-12-07T10:49:21Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.1
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #5863 #6505
Parent of: #6007 #6870
Monitored by: "Julien Signoles"

Bug description

The following example should not be accepted...

module M : sig
type 'a t
type u = u t and v = v t
val f : int -> u
val g : v -> bool
end = struct
type 'a t = 'a
type u = int and v = bool
let f x = x
let g x = x

let h x = M.g (M.f x);;

val h : int -> bool =

h 3;;

  • : bool =
Copy link

@vicuna vicuna commented Dec 10, 2011

Comment author: @garrigue

Fixed in trunk.
Leave 3.12 alone, as the problem is minor (hard to trigger by error), and this may break some programs.

Copy link

@vicuna vicuna commented Dec 2, 2012

Comment author: @garrigue

Fixed again in trunk, revision 13107.

Abstract types in the current module were assumed to be contractive, which is not true in the case of signatures.
Still think about making them contractive if they were not defined in the signature, but an outer implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants