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: 6485 Reporter:@diml Assigned to:@garrigue Status: resolved (set by @Octachron on 2017-03-11T15:28:05Z) Resolution: fixed Priority: normal Severity: minor Version: 4.01.0 Target version: undecided Category: typing Has duplicate:#6882 Related to:#6011 Monitored by:@lpw25@hcarty
Bug description
Tested with 4.01, 4.02 and trunk.
In the following example, the 'type t = private string' in the result of [String_id.Make] becomes 'type t' after rebinding [String_id]:
module String_id : sig
module type S = sig
type t = private string
val of_string : string -> t
end
include S
module Make (M : sig val module_name : string end) : S
end = struct
module type S = sig
type t = private string
val of_string : string -> t
end
module String = struct
type t = string
end
module Make (M : sig val module_name : string end) = struct
include String
let of_string s =
Printf.printf "converting %s\n" M.module_name;
s
end
include Make (struct let module_name = "String_id" end)
end
let () =
(* this compiles *)
let foo = String_id.of_string "foo" in
Printf.printf "foo = %s\n" (foo :> string)
let () =
(* and this compiles *)
let module Bar = String_id.Make(struct let module_name="Bar" end) in
let bar = Bar.of_string "bar" in
Printf.printf "bar = %s\n" (bar :> string)
let () =
(* this does not *)
let module String_id2 = String_id in
let module Baz = String_id2.Make(struct let module_name="Baz" end) in
let baz = Baz.of_string "baz" in
Printf.printf "baz = %s\n" (baz :> string)
The text was updated successfully, but these errors were encountered:
It seems that this specific example was fixed by the incremental weakening of module alias (e757455) patch in OCaml 4.03. Since there is an open duplicate issue expliciting the underlying cause of both issues, I am marking this issue as resolved.
Original bug ID: 6485
Reporter: @diml
Assigned to: @garrigue
Status: resolved (set by @Octachron on 2017-03-11T15:28:05Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.01.0
Target version: undecided
Category: typing
Has duplicate: #6882
Related to: #6011
Monitored by: @lpw25 @hcarty
Bug description
Tested with 4.01, 4.02 and trunk.
In the following example, the 'type t = private string' in the result of [String_id.Make] becomes 'type t' after rebinding [String_id]:
module String_id : sig
module type S = sig
type t = private string
val of_string : string -> t
end
include S
module Make (M : sig val module_name : string end) : S
end = struct
module type S = sig
type t = private string
val of_string : string -> t
end
module String = struct
type t = string
end
module Make (M : sig val module_name : string end) = struct
include String
end
include Make (struct let module_name = "String_id" end)
end
let () =
(* this compiles *)
let foo = String_id.of_string "foo" in
Printf.printf "foo = %s\n" (foo :> string)
let () =
(* and this compiles *)
let module Bar = String_id.Make(struct let module_name="Bar" end) in
let bar = Bar.of_string "bar" in
Printf.printf "bar = %s\n" (bar :> string)
let () =
(* this does not *)
let module String_id2 = String_id in
let module Baz = String_id2.Make(struct let module_name="Baz" end) in
let baz = Baz.of_string "baz" in
Printf.printf "baz = %s\n" (baz :> string)
The text was updated successfully, but these errors were encountered: