Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make aliases absent in module type of #1750

Merged
merged 3 commits into from May 4, 2018

Conversation

lpw25
Copy link
Contributor

@lpw25 lpw25 commented May 1, 2018

Module aliases can be either absent or present -- indicating whether they exist at runtime or not. The two kinds of module alias can be coerced to each other, but they are not equal. This distinction is not observable to users because present aliases only exist in covariant positions and so they are never compared for equality only for coercibility. However, #1652 changes that by allowing module type of to copy a present alias into an invariant position. This leads to errors like:

module X = struct module N = struct end end
module Y : sig
  module type S = sig module N = X.N end
end = struct
  module type S = module type of struct include X end
end;;

Line _, characters 6-70:
  ......struct
    module type S = module type of struct include X end
  end..
Error: Signature mismatch:
       Modules do not match:
         sig module type S = sig module N = X.N end end
       is not included in
         sig module type S = sig module N = X.N end end
       Module type declarations do not match:
         module type S = sig module N = X.N end
       does not match
         module type S = sig module N = X.N end
       At position module type S = <here>
       Illegal permutation of structure fields

which aren't great. This PR fixes the problem by converting all aliases to absent in module type of.

@lpw25
Copy link
Contributor Author

lpw25 commented May 2, 2018

@garrigue Could you review this one? I think we should get it in to 4.07.

Copy link
Contributor

@garrigue garrigue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning an alias into absent seems innocuous.

@garrigue
Copy link
Contributor

garrigue commented May 4, 2018

By the way I'm still waiting for your input on #1676 .

@lpw25 lpw25 merged commit dd01cab into ocaml:trunk May 4, 2018
@lpw25
Copy link
Contributor Author

lpw25 commented May 4, 2018

Thanks, I'll try to have a look at #1676 some time next week.

@lpw25
Copy link
Contributor Author

lpw25 commented May 4, 2018

Cherry-picked to 4.07 as 04cfaec..0f8f761.

EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants