-
Notifications
You must be signed in to change notification settings - Fork 127
Avoid discarding any docstring comments #1664
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
Conversation
glguy
commented
May 17, 2024
- include, import, and type constraint docstrings are now preserved
- parameter and private block docstrings are not supported
Thanks for the PR, @glguy! I realize that this is still a draft, but when you get a chance, could you open an issue describing what problem you are trying to solve? (If you can include one or two test cases showing what goes wrong with Cryptol's current behavior, all the better.) That way, this PR can reference the issue and provide better traceability into why we need to make the changes here. |
7bb618d
to
1718b10
Compare
@glguy do you think there's any reason to allow doc comments on imports/includes? We can't really refer to them easily, and they don't really seem to be part of the API of a module... I haven't looked carefully, but my guess is that they were there in the first place to avoid ambiguities in the grammar---I am thinking it might be easier to just report an error instead of saving them. |
I tracked them because they were there. I think it might make more sense not to allow them, however. Int place I could imagine them making sense is if you wanted to assert something about the way you instantiated a parameterized module because you're relying on properties if it specific to your instantiation. Is that plausible? |
I think we should make them an error, and keep the AST simpler. I think if you wanted to say something about instantiation you should probably do it where you define the instantiation. Which reminds me that we may want to allow doc comments at the top of a module, to say what the module is for (we don't have to do it in this PR though) |
* include, import, and type constraint docstrings are now preserved * parameter and private block docstrings are not supported
661bbc7
to
1009680
Compare
This bumps the `cryptol` submodule to bring in the changes from GaloisInc/cryptol#1664. This requires some minor code changes in `cryptol-saw-core` to adapt to the `Import` data constructor now having an `iDoc :: Maybe (Located Text)` field to represent docstrings. None of the `Import`s that `cryptol-saw-core` generates require any docstrings, so it suffices to instantiate them with `Nothing`.