Skip to content

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

Closed

Description

@identicalsnowflake

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.

Activity

  1. added
    type: bugIssues and pull requests about actual bugs
    safeSubset of Agda features which is expected to be consistent
    on Mar 4, 2017
  2. added this to the 2.5.3 milestone on Mar 4, 2017
  3. gallais commented on Mar 4, 2017

    @gallais
    Member

    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.

    Doesn't seem to work.

  4. self-assigned this
    on Mar 4, 2017
  5. gallais commented on Mar 5, 2017

    @gallais
    Member

    Minimal test case:

    {-# OPTIONS --safe #-}
    module Issue2487 where
    open import Issue2487-2
    module Issue2487-2 where
    postulate A : Set
  6. removed their assignment
    on Mar 5, 2017
  7. nad commented on Mar 6, 2017

    @nad
    Collaborator

    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.
  8. nad commented on Mar 27, 2017

    @nad
    Collaborator

    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.

  9. 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
  10. identicalsnowflake commented on Mar 31, 2017

    @identicalsnowflake
    ContributorAuthor

    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.

  11. added
    falseProof of the empty type which checks without known-unsafe flags (e.g. without --type-in-type)
    on May 9, 2017
  12. nad commented on May 9, 2017

    @nad
    Collaborator

    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.

  13. added this to the 2.5.4 milestone on Aug 9, 2017
  14. 42 remaining items

  15. added 8 commits that reference this issue on Jan 21, 2019
  16. nad commented on Jan 22, 2019

    @nad
    Collaborator

    Thanks!

  17. added a commit that references this issue on Feb 3, 2019
  18. added 3 commits that reference this issue on Feb 26, 2019
  19. added a commit that references this issue on Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

falseProof of the empty type which checks without known-unsafe flags (e.g. without --type-in-type)importIssues to do with importing modulespragmasafeSubset of Agda features which is expected to be consistenttype: bugIssues and pull requests about actual bugsux: optionsIssues relating to Agda's command line options

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions