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: 6651 Reporter:@lpw25 Assigned to:@garrigue Status: closed (set by @xavierleroy on 2017-09-24T15:32:50Z) Resolution: fixed Priority: normal Severity: minor Fixed in version: 4.03.0+dev / +beta1 Category: typing Related to:#2388#7192 Monitored by:@gasche@hcarty
Bug description
The following code works:
module type S = sig
module type T
module X : T
end
module M = struct
module type T = sig type t end
module X = struct type t = int end
end
module F (X : S) = X.X
type t = F(M).t
However, if we change the order of the definitions of F and M:
module type S = sig
module type T
module X : T
end
module F (X : S) = X.X
module M = struct
module type T = sig type t end
module X = struct type t = int end
end
type t = F(M).t
then it fails:
$ ocamlc -c test.ml
File "test.ml", line 13, characters 13-19:
Error: Unbound type constructor F(M).t
This is because components_of_module_maker uses the environment from the definition of F to perform scrape_alias, so it does not see the definition of M if it is defined after F.
The env.diff patch solves this problem by replacing the environment inherited from the functor by the current one.
The test suite goes through, so this does not seem too bad.
However, this means that we would no longer be using the fcomp_env field, and this field comes with the comment "Environment in which the result signature makes sense". This seems to imply that without it it does not make sense, so maybe we need a specialist to check this.
Original bug ID: 6651
Reporter: @lpw25
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-09-24T15:32:50Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.03.0+dev / +beta1
Category: typing
Related to: #2388 #7192
Monitored by: @gasche @hcarty
Bug description
The following code works:
However, if we change the order of the definitions of
F
andM
:then it fails:
This is because
components_of_module_maker
uses the environment from the definition ofF
to performscrape_alias
, so it does not see the definition ofM
if it is defined afterF
.File attachments
The text was updated successfully, but these errors were encountered: