Sort metas produce ill-typed reflected terms when quoted
UlfNorell opened this issue · comments
Ulf Norell commented
open import Agda.Builtin.Reflection renaming (bindTC to _>>=_)
open import Agda.Builtin.Unit
open import Agda.Builtin.Nat
open import Agda.Builtin.List
macro
`Nat : Term → TC ⊤
`Nat hole = do
ty ← inferType hole
_ ← debugPrint "tactic" 10 (termErr ty ∷ [])
unify hole (def (quote Nat) [])
boom : `Nat
boom = 1
We hit the impossible on line 462 in Unquote.hs
trying to unquote (the Term
) meta _13 []
as a sort. Meta 13 is the type of the hole we are trying to fill, and a sort meta.
Ulf Norell commented
Culprit is this (introduced in 9d6a654 by @jespercockx)
agda/src/full/Agda/TypeChecking/Quote.hs
Line 182 in d6e0844
which builds a
Term
instead of a Sort
.
My proposed fix is to return unsupportedSort
instead. The alternative is to add a meta
constructor to reflected sorts.