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: 1780 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Aleksey Nogin
Version: 3.07beta1
OS: Red Hat Linux
Submission from: mojave2.cs.caltech.edu (131.215.44.187)
If I create .mli and .ml with the following contents:
--- .mli ---
module type TypeSig = sig
type t
end
module Test
(Mod1: TypeSig)
(Mod2: TypeSig with type t = Mod1.t) :
(TypeSig with type t = Mod1.t)
--- end .mli ---
--- .ml ---
module type TypeSig = sig
type t
end
module Test
(Mod1: TypeSig)
(Mod2: TypeSig with type t = Mod1.t) =
struct
type t = Mod2.t
end
--- end .ml ---
Then it compiles fine with 3.06, but 3.07 beta1 does not realize that Mod1.t and
Mod2.t are really the same:
The implementation weird.ml does not match the interface weird.cmi:
Modules do not match:
functor (Mod1 : TypeSig) ->
functor (Mod2 : sig type t = Mod1.t end) -> sig type t = Mod2.t end
is not included in
functor (Mod1 : TypeSig) ->
functor (Mod2 : sig type t = Mod1.t end) -> sig type t = Mod1.t end
Modules do not match:
functor (Mod2 : sig type t = Mod1.t end) -> sig type t = Mod2.t end
is not included in
functor (Mod2 : sig type t = Mod1.t end) -> sig type t = Mod1.t end
Modules do not match:
sig type t = Mod2.t end
is not included in
sig type t = Mod1.t end
Type declarations do not match:
type t = Mod2.t
is not included in
type t = Mod1.t
Note that this works correctly "locally" - if I add an explicit signature to the
.ml file :
--- different .ml ---
module type TypeSig = sig
type t
end
module Test
(Mod1: TypeSig)
(Mod2: TypeSig with type t = Mod1.t) :
(TypeSig with type t = Mod1.t) =
struct
type t = Mod2.t
end
--- end different .ml ---
then it compiles fine. Still, this is pretty annoying as it breaks existing code
in a way that takes a while to figure out and fix.
The text was updated successfully, but these errors were encountered:
Still, this is pretty annoying as it breaks existing code in a way
that takes a while to figure out and fix.
Don't change your code -- it's a bug on my side. The functor
subtyping rule was changed to match the theory (the implemented rule
was unnecessarily restrictive), but a (lack of) substitution bug crept up.
Below is a patch that fixes this issue.
Original bug ID: 1780
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Aleksey Nogin
Version: 3.07beta1
OS: Red Hat Linux
Submission from: mojave2.cs.caltech.edu (131.215.44.187)
If I create .mli and .ml with the following contents:
--- .mli ---
module type TypeSig = sig
type t
end
module Test
(Mod1: TypeSig)
(Mod2: TypeSig with type t = Mod1.t) :
(TypeSig with type t = Mod1.t)
--- end .mli ---
--- .ml ---
module type TypeSig = sig
type t
end
module Test
(Mod1: TypeSig)
(Mod2: TypeSig with type t = Mod1.t) =
struct
type t = Mod2.t
end
--- end .ml ---
Then it compiles fine with 3.06, but 3.07 beta1 does not realize that Mod1.t and
Mod2.t are really the same:
The implementation weird.ml does not match the interface weird.cmi:
Modules do not match:
functor (Mod1 : TypeSig) ->
functor (Mod2 : sig type t = Mod1.t end) -> sig type t = Mod2.t end
is not included in
functor (Mod1 : TypeSig) ->
functor (Mod2 : sig type t = Mod1.t end) -> sig type t = Mod1.t end
Modules do not match:
functor (Mod2 : sig type t = Mod1.t end) -> sig type t = Mod2.t end
is not included in
functor (Mod2 : sig type t = Mod1.t end) -> sig type t = Mod1.t end
Modules do not match:
sig type t = Mod2.t end
is not included in
sig type t = Mod1.t end
Type declarations do not match:
type t = Mod2.t
is not included in
type t = Mod1.t
Note that this works correctly "locally" - if I add an explicit signature to the
.ml file :
--- different .ml ---
module type TypeSig = sig
type t
end
module Test
(Mod1: TypeSig)
(Mod2: TypeSig with type t = Mod1.t) :
(TypeSig with type t = Mod1.t) =
struct
type t = Mod2.t
end
--- end different .ml ---
then it compiles fine. Still, this is pretty annoying as it breaks existing code
in a way that takes a while to figure out and fix.
The text was updated successfully, but these errors were encountered: