Skip to content

Typing for parameterised libraries #1726

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

Merged
merged 387 commits into from
Oct 28, 2024

Conversation

lukemaurer
Copy link
Contributor

@lukemaurer lukemaurer commented Aug 10, 2023

Typechecking of references to parameterised libraries, with or without arguments. Currently such references can't actually be compiled to working code because we don't have the -instantiate pass, but this contains all the typechecking logic to make sure that, for instance, a module A can't refer to a parameterised module B unless A takes all the parameters that B does (the subset rule) or the reference includes an argument for each missing parameter.

@mshinwell mshinwell added typing parameterized-libs PRs needed for parameterized libraries labels Aug 10, 2023
@goldfirere
Copy link
Collaborator

This is a big PR! What’s the review plan here? Maybe this question is premature (feel free to tell me to look away), but I’m curious if any other type-systems person has this on their radar…

@lukemaurer
Copy link
Contributor Author

This is a big PR! What’s the review plan here? Maybe this question is premature (feel free to tell me to look away), but I’m curious if any other type-systems person has this on their radar…

Step one is certainly for me to split it up. (I just did a bit of that with #1746, which turns out to be largely orthogonal.) I had things nicely split into a stack of branches, but everything's so interrelated that it got impractical to keep them split up, but now that things are actually working I feel a bit more confident drawing lines around things. (That said, it's annoyingly possible that instantiation will require yet more changes to this code. But at least I can write meaningful tests against this PR, which is more than I can say for, say, just the syntax extension.)

@lukemaurer lukemaurer changed the base branch from main to lmaurer/instance-syntax October 19, 2023 17:54
Copy link
Contributor

@riaqn riaqn left a comment

Choose a reason for hiding this comment

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

Some preliminary comments on the tests.

Previously this was pretty rare (only one existing test needed to be promoted),
with the exception of `Not_found` which has special handling, but parameterised
modules add new and interesting ways for the user to mess up, and we want those
errors to have location information (which `Persistent_env` functions aren't
aware of).
Also exercises a couple of new cases: passing the same name as `-parameter` and
`-as-argument-for` (i.e., implementing operators over parameter modules), and
having a parameter module just include an `_intf.S`. (The latter isn't
technically difficult but I expect it to be an important use case.)
Copy link
Contributor

@riaqn riaqn left a comment

Choose a reason for hiding this comment

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

Thank you - my first round of review is finished.

Admittedly I didn't look carefully at utils/symbol.ml.

Copy link
Contributor

@riaqn riaqn left a comment

Choose a reason for hiding this comment

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

I think it's good to go.

A gentle reminder that maybe we want to move some changes from the next PR to the current PR:
#1905 (comment)
#1905 (comment)
I have no strong opinion - maybe it's not worthwhile.

@lukemaurer lukemaurer merged commit 9768a53 into ocaml-flambda:main Oct 28, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parameterized-libs PRs needed for parameterized libraries typing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants