You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5036 Reporter: kaustuv Status: closed (set by @garrigue on 2010-04-30T05:13:39Z) Resolution: fixed Priority: normal Severity: minor Fixed in version: 3.12.0+dev Category: ~DO NOT USE (was: OCaml general) Monitored by: "Julien Signoles" @hcarty
Bug 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.
The text was updated successfully, but these errors were encountered:
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.
Many apologies for reopening this with a trivial nitpick, but you got the test for closedness and the simplification (#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
Original bug ID: 5036
Reporter: kaustuv
Status: closed (set by @garrigue on 2010-04-30T05:13:39Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: "Julien Signoles" @hcarty
Bug description
module type S =
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.
The text was updated successfully, but these errors were encountered: