Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005036OCamlOCaml generalpublic2010-04-24 06:232010-04-30 07:13
Reporterkaustuv 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.12.0+dev 
Summary0005036: 3.12.0+dev18: "module type of" leaves weak polymorphic types in module type
Description   # module type S =
       module type of (struct
                        let f = (fun x -> x) (fun x -> x)
                       end) ;;
   module type S = sig val f : '_a -> '_a end

Light experimentation suggests that only modules that define a value f : 'a. 'a -> 'a will ascribe to the above signature, so "module type of" should promote weak polymorphic types to strong polymorphic types.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005398)
xleroy (administrator)
2010-04-28 10:13

I'm not comfortable with generalizing these type variables automatically. Added a check to reject "module type of M" if "M" contains nongeneralized type variables.
(0005399)
kaustuv (reporter)
2010-04-28 11:23

Many apologies for reopening this with a trivial nitpick, but you got the test for closedness and the simplification (PR#5037) in the wrong order in typing/typemod.ml/type_module_type_of. Witness this startling result:

# module M = struct let f = (fun x -> x) (fun x -> x) let f x = x end ;;
module M : sig val f : 'a -> 'a end
# module type S = module type of M ;;
Error: The type of this module, sig val f : '_a -> '_a val f : 'a -> 'a end,
       contains type variables that cannot be generalized
(0005424)
garrigue (manager)
2010-04-30 07:13

Indeed, type_implementation was doing it in the opposite order.
Fixed in revision 10330.

- Issue History
Date Modified Username Field Change
2010-04-24 06:23 kaustuv New Issue
2010-04-28 10:13 xleroy Note Added: 0005398
2010-04-28 10:13 xleroy Status new => closed
2010-04-28 10:13 xleroy Resolution open => fixed
2010-04-28 11:23 kaustuv Note Added: 0005399
2010-04-28 11:23 kaustuv Status closed => feedback
2010-04-28 11:23 kaustuv Resolution fixed => reopened
2010-04-30 07:13 garrigue Note Added: 0005424
2010-04-30 07:13 garrigue Status feedback => closed
2010-04-30 07:13 garrigue Resolution reopened => fixed
2010-04-30 07:13 garrigue Fixed in Version => 3.12.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker