You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Options used for different modules must be consistent with each other, and options used when loading an interface must be consistent with those used when the interface was created #2487
Currently, even in a module marked {-# OPTIONS --safe #-}, you may still import (and use!) primTrustMe and postulates from other modules.
It wouldn't bother me if you could import modules not marked as --safe provided they still follow the safe rules, but it seems currently imported modules are totally exempt from these rules.
I guess it's due to the fact it's the options in the persistent state that get used to typecheck submodules. I don't think we want to modify the persistent state but we could grab the status of the --safe flag right before the call to bracket_ and push it back in after the reset.
This is an instance of a more general problem: Agda does not check that options for different modules in the same project are consistent with each other. For instance, one can use --without-K in one module, and --with-K in another. I suggest that interfaces should contain information about "important" features (various options, use of unsafe features like postulates, and possibly more; perhaps we could even check whether the K rule is used, even when --without-K is not active). When modules are imported one can then check that the imported modules and the importing module use these features in a consistent way:
Modules using --safe may only import safe modules.
Modules using --without-K may only import modules that do not use the K rule.
Other features should also be considered: --cubical, perhaps sized types, perhaps something else.
As noted by @identicalsnowflake (#2515 (comment)) there is an additional problem: when a .agdai file is loaded we don't check that the current options are consistent with those used when the file was created.
changed the title [-]Make --safe require safety of imported modules[/-][+]Options used for different modules must be consistent with each other, and options used when loading an interface must be consistent with those used when the interface was created[/+]on Mar 28, 2017
There may be some logic for this already, actually, it just seems to be backwards. For example, you may have a {-# OPTIONS --safe #-} module depend on a {-# OPTIONS --type-in-type #-} and Agda will not complain; however, if you try to make a --type-in-type module depend on a --safe module, Agda will forbid it.
I've added the "false" label, because I assume that one can currently use --cubical in one module, --with-K in another, and produce an inconsistency by combining the two.
Activity
gallais commentedon Mar 4, 2017
I guess it's due to the fact it's the options in the persistent state that get used to typecheck submodules. I don't think we want to modify the persistent state but we could grab the status of the--safeflag right before the call tobracket_and push it back in after the reset.Doesn't seem to work.
gallais commentedon Mar 5, 2017
Minimal test case:
nad commentedon Mar 6, 2017
This is an instance of a more general problem: Agda does not check that options for different modules in the same project are consistent with each other. For instance, one can use
--without-Kin one module, and--with-Kin another. I suggest that interfaces should contain information about "important" features (various options, use of unsafe features like postulates, and possibly more; perhaps we could even check whether the K rule is used, even when--without-Kis not active). When modules are imported one can then check that the imported modules and the importing module use these features in a consistent way:--safemay only import safe modules.--without-Kmay only import modules that do not use the K rule.--cubical, perhaps sized types, perhaps something else.nad commentedon Mar 27, 2017
As noted by @identicalsnowflake (#2515 (comment)) there is an additional problem: when a
.agdaifile is loaded we don't check that the current options are consistent with those used when the file was created.[-]Make --safe require safety of imported modules[/-][+]Options used for different modules must be consistent with each other, and options used when loading an interface must be consistent with those used when the interface was created[/+]identicalsnowflake commentedon Mar 31, 2017
There may be some logic for this already, actually, it just seems to be backwards. For example, you may have a
{-# OPTIONS --safe #-}module depend on a{-# OPTIONS --type-in-type #-}and Agda will not complain; however, if you try to make a--type-in-typemodule depend on a--safemodule, Agda will forbid it.nad commentedon May 9, 2017
I've added the "false" label, because I assume that one can currently use
--cubicalin one module,--with-Kin another, and produce an inconsistency by combining the two.42 remaining items
[ #2487 ] restarting if options change, update user-manual
[ #2487 ] Use Utils.getAgdaFilesInDir instead of using listDirectory
[ #2487 ] consistency checking of options
[ #2487 ] restarting if options change, update user-manual
[ #2487 ] Use Utils.getAgdaFilesInDir instead of using listDirectory
[ #2487 ] consistency checking of options
[ #2487 ] restarting if options change, update user-manual
[ #2487 ] Use Utils.getAgdaFilesInDir instead of using listDirectory
nad commentedon Jan 22, 2019
Thanks!
[ re agda/agda#2487 ] making sure options choices are consistent
[ agda#2487 ] consistency checking of options
[ agda#2487 ] restarting if options change, update user-manual
[ agda#2487 ] Use Utils.getAgdaFilesInDir instead of using listDirectory
[ re agda/agda#2487 ] making sure options choices are consistent