Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004623OCamlOCaml generalpublic2008-10-15 17:282010-04-27 09:16
Reporterdario 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11+dev 
Target VersionFixed in Version3.11+dev 
Summary0004623: Private constraints accepted by toplevel but not by compiler
DescriptionUsing the just released 3.11 Beta1, the following code is accepted by the top-level:

module Foobar:
sig
        type foo_t = [ `A ]
        type bar_t = [ `B ]
        type foobar_t = [ foo_t | bar_t ]
        type 'a t = private 'a constraint 'a = [< foobar_t ]

        val make_a: unit -> foo_t t
        val make_b: unit -> bar_t t
end =
struct
        type foo_t = [ `A ]
        type bar_t = [ `B ]
        type foobar_t = [ foo_t | bar_t ]
        type 'a t = 'a constraint 'a = [< foobar_t ]

        let make_a () = `A
        let make_b () = `B
end

But is rejected by both the byte and native code compilers:

File "constraint.ml", line 1, characters 0-1:
Error: The implementation constraint.ml
       does not match the interface (inferred signature):
       Modules do not match:
         sig
           type foo_t = [ `A ]
           type bar_t = [ `B ]
           type foobar_t = [ `A | `B ]
           type 'a t = 'a Foobar.t constraint 'a = [< foobar_t ]
           val make_a : unit -> foo_t t
           val make_b : unit -> bar_t t
         end
       is not included in
         sig
           type foo_t = [ `A ]
           type bar_t = [ `B ]
           type foobar_t = [ `A | `B ]
           type 'a t = private 'a constraint 'a = [< foobar_t ]
           val make_a : unit -> foo_t t
           val make_b : unit -> bar_t t
         end
       Type declarations do not match:
         type 'a t = 'a Foobar.t constraint 'a = [< foobar_t ]
       is not included in
         type 'a t = private 'a constraint 'a = [< foobar_t ]
TagsNo tags attached.
Attached Files

- Relationships
related to 0004580closedgarrigue Stack overflow with private row type 

-  Notes
(0004680)
garrigue (manager)
2008-10-16 04:14

Actually the problem was not unrelated to constraints.
A minimal reproduction case follows:

module Foobar : sig type t = private int end =
  struct type t = int end

This is now fixed in CVS/release311, by allowing head-expansion of private
abbreviations when defining a private type.
(0005385)
garrigue (manager)
2010-04-27 09:16

safe to close

- Issue History
Date Modified Username Field Change
2008-10-15 17:28 dario New Issue
2008-10-16 04:14 garrigue Status new => resolved
2008-10-16 04:14 garrigue Fixed in Version => 3.11+dev
2008-10-16 04:14 garrigue Resolution open => fixed
2008-10-16 04:14 garrigue Assigned To => garrigue
2008-10-16 04:14 garrigue Note Added: 0004680
2010-04-27 09:16 garrigue Relationship added related to 0004580
2010-04-27 09:16 garrigue Note Added: 0005385
2010-04-27 09:16 garrigue Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker