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

Unfolding fails when code is split up into multiple files #6972

Closed
nad opened this issue Nov 9, 2023 · 0 comments · Fixed by #6974
Closed

Unfolding fails when code is split up into multiple files #6972

nad opened this issue Nov 9, 2023 · 0 comments · Fixed by #6974
Labels
import Issues to do with importing modules opaque Issues about `opaque` definitions open-public type: bug Issues and pull requests about actual bugs
Milestone

Comments

@nad
Copy link
Contributor

nad commented Nov 9, 2023

The following code is accepted:

module _ where

open import Agda.Builtin.Equality

module M (A : Set₁) where

  opaque

    B : Set₁
    B = A

module N (A : Set₁) where

  open M A public

open N Set

opaque
  unfolding B

  _ : B ≡ Set
  _ = refl

However, if I replace the local modules with modules in separate files (in a certain way), then Agda rejects the code:

module M (A : Set₁) where

opaque

  B : Set₁
  B = A
module N (A : Set₁) where

open import M A public
module _ where

open import Agda.Builtin.Equality

open import N Set

opaque
  unfolding B

  _ : B ≡ Set
  _ = refl
———— Error —————————————————————————————————————————————————
[…]/Bug.agda:11,7-11
B != Set of type Set₁
when checking that the expression refl has type B ≡ Set

———— Warning(s) ————————————————————————————————————————————
[…]/Bug.agda:8,13-14
warning: -W[no]UnfoldTransparentName
The name B, mentioned by an unfolding clause, does not belong to an
opaque block. This has no effect.

I can make the code work again by referring to the underlying definition of B instead of the reexported one:

module _ where

open import Agda.Builtin.Equality

import M

open import N Set

opaque
  unfolding M.B

  _ : B ≡ Set
  _ = refl

I don't think Agda should care if the code is in one or multiple files.

@nad nad added type: bug Issues and pull requests about actual bugs import Issues to do with importing modules open-public opaque Issues about `opaque` definitions labels Nov 9, 2023
@nad nad added this to the 2.6.5 milestone Nov 9, 2023
@andreasabel andreasabel modified the milestones: 2.7.0, 2.6.4.2 Feb 8, 2024
@andreasabel andreasabel mentioned this issue Feb 8, 2024
3 tasks
VitalyAnkh pushed a commit to VitalyAnkh/agda that referenced this issue Mar 5, 2024
JobPetrovcic pushed a commit to JobPetrovcic/agda that referenced this issue Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
import Issues to do with importing modules opaque Issues about `opaque` definitions open-public type: bug Issues and pull requests about actual bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants