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

Library (.agda-lib) files below the project root #5644

Closed
nad opened this issue Nov 11, 2021 · 6 comments · Fixed by #5640
Closed

Library (.agda-lib) files below the project root #5644

nad opened this issue Nov 11, 2021 · 6 comments · Fixed by #5640
Assignees
Labels
documented-in-changelog Issues already documented in the CHANGELOG type: bug Issues and pull requests about actual bugs ux: library management Issues relating to the library management system
Milestone

Comments

@nad
Copy link
Contributor

nad commented Nov 11, 2021

Consider the following situation:

  • The top-level directory contains the file top.agda-lib, and no other files:
    name:    top
    include: .
    flags:   --safe
    
  • The subdirectory A contains the file B.agda:
    module A.B where
    
    {-# NON_TERMINATING #-}
    
    easy : (A : Set)  A
    easy = easy

Would you expect Agda to complain if you run agda A/B.agda in the top-level directory? I would have hoped so, but that is not necessarily the case. See what happens if the directory A contains B.agda and the empty file sneaky.agda-lib (and no other files):

$ agda A/B.agda
Checking A.B ([…]/A/B.agda).

In this case the module name of A.B suggests to me that any .agda-lib files for this module should be in a parent directory of A. I consider the current behaviour to be a bug.

@nad nad added type: bug Issues and pull requests about actual bugs ux: library management Issues relating to the library management system labels Nov 11, 2021
@nad nad added this to the 2.6.3 milestone Nov 11, 2021
@nad nad self-assigned this Nov 11, 2021
@jespercockx
Copy link
Member

Yep, I agree that this is a bug. We should probably have a check that the root of the hierarchy of top-level modules corresponds to the location of the .agda-lib file.

@nad
Copy link
Contributor Author

nad commented Nov 11, 2021

That would mean that you could not have the source files in a subdirectory (like src). I've changed the code so that the .agda-lib files have to be in or above the root directory.

@nad nad linked a pull request Nov 11, 2021 that will close this issue
@nad nad closed this as completed in #5640 Nov 11, 2021
@andreasabel andreasabel changed the title One can override .agda-lib files in "sneaky" ways Library (.agda-lib) files below the project root Oct 25, 2022
@nad nad added the documented-in-changelog Issues already documented in the CHANGELOG label Oct 25, 2022
@nad
Copy link
Contributor Author

nad commented Jan 23, 2023

I suggested a further change (#6465).

@nad
Copy link
Contributor Author

nad commented Jan 23, 2023

I noticed that one part of the documentation should be updated:

If the ``.agda`` source file is part of a project with an *identifiable root*
(i.e. if there is an ``.agda-lib`` file in any of the directories above it),
then the interface file is stored in the ``_build/VERSION`` directory at the
identified root. This prevents losing the interface file when switching between

@nad nad reopened this Jan 23, 2023
@andreasabel
Copy link
Member

I noticed that one part of the documentation should be updated:

Please open a new issue for this. We should proceed with the release now. Documentation shortcomings don't count as release-blockers at this stage.

@nad
Copy link
Contributor Author

nad commented Jan 23, 2023

I have already created a pull request.

nad added a commit that referenced this issue Jan 23, 2023
With input from Andreas Abel.
nad added a commit that referenced this issue Jan 23, 2023
With input from Andreas Abel.
nad added a commit that referenced this issue Jan 23, 2023
With input from Andreas Abel.
@nad nad mentioned this issue Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documented-in-changelog Issues already documented in the CHANGELOG type: bug Issues and pull requests about actual bugs ux: library management Issues relating to the library management system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants