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

Fix loader with paths to module types #128

Merged
merged 3 commits into from
Feb 18, 2025

Conversation

panglesd
Copy link
Collaborator

Fix #121 (with a simplified minimal reproduction in the test).

Consider the following signature items:

module A = A.B.X
module B : A.B.Y

Here, the module type of A is the module type of A.B.Y (which is a path to a module). This is represented in Types as Mty_alias path.
The module type of B is A.B.Y (which is a path to a module type). This is represented in Types as Mty_ident path.

Before this PR, the two cases were treated equally, as if they were path to modules.

We now distinguish the two cases.

(This PR does not address the fact that we do not expand module types during loading! But we are not diffing them anyway as of today.)

Eg in:

```
module X : A.B.Y
```

The module type of `X` is the path to module type `A.B.Y`.

This is represented in `Types` as `Mty_ident`. Before this commit it was treated
as `Mty_alias` which represents module aliases (`module X = A.B.Y` where `A.B.Y`
has to be a path to a module)
Comment on lines +182 to +186
let presence =
match md_type with
| Mty_alias _ -> presence
| _ -> Mp_present (* What is this fixing? *)
in
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe a comment on why we need this is worth it

Copy link
Collaborator

@NathanReb NathanReb left a comment

Choose a reason for hiding this comment

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

Looks good to me!

You raise valid concerns regarding some bits of the loading code, I'll add test and specify those.

@NathanReb
Copy link
Collaborator

Don't forget to update the changelog!

@panglesd panglesd merged commit e2f635c into ocaml-semver:main Feb 18, 2025
2 of 3 checks passed
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.

Loading sometimes fail
2 participants