Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004824OCamlOCaml generalpublic2009-06-15 17:012010-06-08 10:46
Reporterpveber 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.0 
Target VersionFixed in Version3.12.0+dev 
Summary0004824: Narrowing the type of class parameters with module specification
DescriptionThe following definition is rejected :

# module M :
   sig
     class x : int -> object method m : int end
  end
=
struct
  class x _ = object
    method m = 42
  end
end;;
Error: Signature mismatch:
       Modules do not match:
         sig class x : 'a -> object method m : int end end
       is not included in
         sig class x : int -> object method m : int end end
       Class declarations do not match:
         class x : 'a -> object method m : int end
       does not match
         class x : int -> object method m : int end
       One parameter has type 'a but is expected to have type int

Is there a good reason for this ?

Philippe.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004997)
pveber (reporter)
2009-06-16 15:31

Sorry, I wrongly labeled this report's category, which should be "Ocaml general".
Maybe it should also be labeled as feature, rather than bug ...
(0005549)
garrigue (manager)
2010-06-08 10:40

While trying to fix this problem, I discovered a gaping hole in the type system, at least since ocaml 2.00:

module M : sig class c : 'a -> object val x : 'b end end =
  struct class c x = object val x = x end end

class c (x : int) = object inherit M.c x method x : bool = x end

let r = (new c 2)#x;;
(0005550)
garrigue (manager)
2010-06-08 10:46

Allow narrowing of class parameters, and close the unsoundness bug mentioned as note.
Fixed in version/3.12 revision 10541.

Note that the closing of this unsoundness is going to break many programs,
including lablgtk.

- Issue History
Date Modified Username Field Change
2009-06-15 17:01 pveber New Issue
2009-06-16 15:31 pveber Note Added: 0004997
2009-06-22 17:59 doligez Category OCaml documentation => OCaml general
2010-04-30 06:50 garrigue Status new => assigned
2010-04-30 06:50 garrigue Assigned To => garrigue
2010-06-08 10:40 garrigue Note Added: 0005549
2010-06-08 10:46 garrigue Note Added: 0005550
2010-06-08 10:46 garrigue Status assigned => closed
2010-06-08 10:46 garrigue Resolution open => fixed
2010-06-08 10:46 garrigue Fixed in Version => 3.12.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker