Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006090OCamltypingpublic2013-07-26 20:422015-12-11 19:21
Assigned Togarrigue 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.01.0+dev 
Summary0006090: Module constraint + private type seems brocken in ocaml 4.01.0
DescriptionThe following test-case doesn't compile using ocaml-4.01.0 but does compile with older versions.

It produce the following error:
Error: This variant or record definition does not match that of type Test.t
       A private type would be revealed.
Steps To Reproducemodule Test = struct type t = private A end
module Test2 : module type of Test with type t = Test.t = Test
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
garrigue (manager)
2013-07-27 01:07

Actually, I wonder which older versions you are talking about.
I tested with 3.12.1 and 4.00.1, and in both cases your code is refused
(albeit for a different reason).

This said, now that a with constraint adds equations rather than overwrite
the original definition, it makes sense to allow this.
This is now accepted in 4.01 and trunk (revisions 13936 and 13937)
jpdeplaix (reporter)
2013-07-27 15:44

Ok, sorry. It was a wrong test-case. But, good news, it seems to fix the original case. So, thanks.

The original case was in eliom, in this file line 100:;a=headblob;f=/src/server/eliom_content_core.mli [^]
and it fails to compile with 4.01.0 with the same error than the test-case (after replacing Test.t with Xml.acontent).
garrigue (manager)
2013-07-31 04:57

For backward compatibility reasons, we need to allow using private in the with clause in that case:

module Test = struct type t = private A end
module Test2 : (module type of Test with type t = private Test.t) = Test

This was the only way to obtain the expected behavior in 3.12 and 4.00, and is used actively in Core.

I have added a deprecation warning in trunk (but not 4.00), since this use of private is not semantically correct.

- Issue History
Date Modified Username Field Change
2013-07-26 20:42 jpdeplaix New Issue
2013-07-27 01:07 garrigue Note Added: 0009877
2013-07-27 01:07 garrigue Status new => resolved
2013-07-27 01:07 garrigue Fixed in Version => 4.01.0+dev
2013-07-27 01:07 garrigue Resolution open => fixed
2013-07-27 01:07 garrigue Assigned To => garrigue
2013-07-27 15:44 jpdeplaix Note Added: 0009896
2013-07-31 04:57 garrigue Note Added: 0010034
2015-12-11 19:21 xleroy Status resolved => closed
2017-02-23 16:45 doligez Category OCaml typing => typing

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker