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 names in scope in functors accessible when their instantiations are loaded at the REPL #1559

Merged
merged 17 commits into from
Aug 11, 2023

Conversation

qsctr
Copy link
Contributor

@qsctr qsctr commented Jul 29, 2023

Fixes #1455, making anything in scope of the functor in scope at the REPL as well when an instantiation of the functor is loaded and focused. In particular, the prelude will be in scope. As part of handling functor parameters correctly, this also fixes #1556, fixes #1237, fixes #1561, and fixes #1562.

In addition, this does some work towards implementing #1382, by storing the in-scope information for nested modules into Cryptol.ModuleSystem.Interface.IFaceNames.

@qsctr qsctr added parameterized modules Related to Cryptol's parameterized modules command-line-repl Related to Cryptol's text-based UI labels Jul 29, 2023
@qsctr qsctr self-assigned this Jul 29, 2023
@qsctr qsctr temporarily deployed to github-pages July 29, 2023 01:23 — with GitHub Actions Inactive
@weaversa
Copy link
Collaborator

Thank you!

Say, does this capability port over to SAW? That is, when a Cryptol module is loaded in SAW, will the scope be the same as when a module is loaded into Cryptol, or does this work need to be ported to SAW as well?

@qsctr qsctr temporarily deployed to github-pages July 29, 2023 01:46 — with GitHub Actions Inactive
@qsctr
Copy link
Contributor Author

qsctr commented Aug 1, 2023

For the most part, this change only fixes the behavior of what is in scope in the Cryptol REPL, so it does not affect SAW. However I don't think we need a fix for SAW since SAW does not follow Cryptol's normal module system scoping rules and everything would already be accessible in a SAW import. In particular, Prelude functions, things defined in the functor, instantiated value parameters, and type synonyms in the interface are already all available when a module instantiation is imported in SAW.

The one exception is instantiated type parameters: currently these are not available when an instantiation is imported in SAW since they are treated slightly differently internally in Cryptol. This PR should fix that.

@qsctr qsctr temporarily deployed to github-pages August 2, 2023 22:21 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 2, 2023 22:46 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 4, 2023 00:04 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 4, 2023 18:22 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 8, 2023 22:54 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 9, 2023 00:08 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 9, 2023 00:43 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 9, 2023 00:46 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 9, 2023 01:34 — with GitHub Actions Inactive
@qsctr qsctr marked this pull request as ready for review August 9, 2023 03:05
@yav yav temporarily deployed to github-pages August 10, 2023 18:18 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 10, 2023 22:29 — with GitHub Actions Inactive
@qsctr qsctr temporarily deployed to github-pages August 10, 2023 22:39 — with GitHub Actions Inactive
@qsctr
Copy link
Contributor Author

qsctr commented Aug 11, 2023

Reviewed in person by @yav

@qsctr qsctr merged commit cd5d006 into master Aug 11, 2023
43 checks passed
@qsctr qsctr deleted the T1455 branch August 11, 2023 00:06
RyanGlScott added a commit to GaloisInc/saw-script that referenced this pull request Aug 21, 2023
This is primarily motivated by a need to bring in a fix for
GaloisInc/crucible#1105 into SAW soon. In order to do
this, I will need to bump the `crucible` submodule to a more recent commit, so
this patch lays the groundwork for doing so.

Most of the changes can be brought in directly without any further changes to
SAW.  One exception in `cryptol`, where I had to explicitly initialize
`mInScope` to accommodate the changes from
GaloisInc/cryptol#1559.  Just like how `cryptol`
initializes `mInScope` to `mempty` after parsing a Cryptol `NormalModule`, so
too does SAW.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment