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

Elaborate-and-give does not respect --postfix-projections #6082

Closed
plt-amy opened this issue Sep 4, 2022 · 1 comment · Fixed by #6147
Closed

Elaborate-and-give does not respect --postfix-projections #6082

plt-amy opened this issue Sep 4, 2022 · 1 comment · Fixed by #6147
Assignees
Labels
postfix-projections Issue with projections in postfix form reflection Elaborator reflection, macros, tactic arguments type: bug Issues and pull requests about actual bugs
Milestone

Comments

@plt-amy
Copy link
Member

plt-amy commented Sep 4, 2022

{-# OPTIONS --postfix-projections #-}
module asdf where

open import Agda.Primitive
open import Agda.Builtin.Reflection
open import Agda.Builtin.Sigma
open import Agda.Builtin.Unit
open import Agda.Builtin.List

module _ {A : Set} {B : A  Set} (x : Σ A B) where
  ai : ArgInfo
  ai = arg-info visible (modality relevant quantity-ω)
  macro
    foo : Term  TC ⊤
    foo goal = unify goal (def (quote fst) (arg ai (var 0 []) ∷ []))

  _ : A
  _ = {! foo  !}

Elaborate-and-giving that interaction point should probably expand to x .fst rather than fst x, since the user asked for --postfix-projections.

@plt-amy plt-amy added type: bug Issues and pull requests about actual bugs reflection Elaborator reflection, macros, tactic arguments give Problems with the "give" command labels Sep 4, 2022
@jespercockx jespercockx added this to the 2.6.3 milestone Sep 13, 2022
@andreasabel andreasabel self-assigned this Sep 29, 2022
@andreasabel andreasabel added postfix-projections Issue with projections in postfix form and removed give Problems with the "give" command labels Sep 29, 2022
@andreasabel
Copy link
Member

I identified the source of the problem: the translation ReflectedToAbstract does not recover projections:

mkDef :: HasConstInfo m => QName -> m A.Expr
mkDef f =
ifM (isMacro . theDef <$> getConstInfo f)
(return $ A.Macro f)
(return $ A.Def f)

It only distinguishes A.Macro from A.Def, not A.Proj and A.Con. Fixing this fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
postfix-projections Issue with projections in postfix form reflection Elaborator reflection, macros, tactic arguments type: bug Issues and pull requests about actual bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants