Skip to content

Commit

Permalink
[ re #5744 ] Also allow unquoting at top-level with erased macros
Browse files Browse the repository at this point in the history
  • Loading branch information
jespercockx authored and andreasabel committed Mar 14, 2022
1 parent 276b384 commit 3dbfa03
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/full/Agda/TypeChecking/Rules/Decl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ unquoteTop xs e = do
lzero <- primLevelZero
let vArg = defaultArg
hArg = setHiding Hidden . vArg
m <- checkExpr e $ El (mkType 0) $ apply tcm [hArg lzero, vArg unit]
m <- applyQuantityToContext zeroQuantity $
checkExpr e $ El (mkType 0) $ apply tcm [hArg lzero, vArg unit]
res <- runUnquoteM $ tell xs >> evalTCM m
case res of
Left err -> typeError $ UnquoteFailed err
Expand Down
16 changes: 16 additions & 0 deletions test/Succeed/ErasedMacro.agda
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,26 @@ open import Agda.Builtin.List
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
open import Agda.Builtin.Reflection
open import Agda.Builtin.Sigma

macro
@0 trivial : Term TC ⊤
trivial = unify (con (quote refl) [])

test : 4242
test = trivial

@0 m : Name TC ⊤
m F = defineFun F
(clause
(( "A"
, arg (arg-info visible (modality relevant quantity-0))
(agda-sort (lit 0))) ∷
[])
(arg (arg-info visible (modality relevant quantity-0)) (var 0) ∷
[])
(var 0 []) ∷
[])

F : Set Set
unquoteDef F = m F

0 comments on commit 3dbfa03

Please sign in to comment.