forked from agda/agda
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ fixed agda#4647 ] top-level interaction: access to private decls.
This commit addresses the problem that interaction commands that run in the top-level, like C-c C-n, do not have access to private decls of the main module. These are deleted from the scope before serialization, for reasons of performance (see agda#1806). The solution implemented here is that interaction gets two modes: 1. RegularInteraction: Initial mode after C-c C-l. The internal representation of the top module, hence its insideScope, is loaded from the interface file and thus has no knowledge of private declarations. 2. TopLevelInteraction: Top-level interaction commands switch to this mode, leading to a reload of the current top module in a way that private declarations are preserved in the insideScope. The module is not serialized. When a new file is loaded, we switch back to RegularInteraction. The emacs mode had to be changed to switch on highlighting for top-level commands, which was off because no highlighting would happen. Now, highlighting can happen due to a reload. UPDATE: only switch to TopLevelInteraction when NotInScope error. Catch not-in-scope errors in top-level interaction commands such as C-c C-d infer C-c C-n evaluate C-c C-o module contents C-c C-w why in scope and try to handle by reloading file in TopLevelInteraction mode that preserves the private declarations. Caveat: commands that do not throw scope errors such as C-c C-z search about will by default (RegularInteraction) not include the private declarations, only if some other top-level command switches to TopLevelInteraction, then the private declarations will also be listed. Note: Top-level commands that lead to a reload have to be used with care in interaction tests. Solutions given to metas by interaction commands get lost by reloads, since they are not incorporated into the source file (naturally). The situation is now similar to why case splits do no update the state of the interaction. Instructions how to revert ... ------------------------------ ... the changes introduced in interaction that are introduced by this patch: A simple `git revert` won't do since there are code improvements contained in this patch that should not be reverted. However, a manual revert is: remove data type Agda.Interaction.Base.InteractionMode and go with the flow. Any choices that use this bit should collapsed as if there was only the value RegularInteraction
- Loading branch information
1 parent
4201780
commit 841b347
Showing
12 changed files
with
204 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.