Instanceness is lost when expanding absurd pattern in pattern synonym expression
andreasabel opened this issue · comments
open import Agda.Builtin.Bool
open import Agda.Builtin.Equality
data D : Set where
c : {{ i : true ≡ false }} → D
pattern ff = c {{ () }}
works : D → D
works ff
works' : D → D
works' c = c
test : D → D
test c = ff
The test
fails with an unsolved constraint:
_i_12
: Agda.Builtin.Bool.Bool.true Agda.Builtin.Equality.≡
Agda.Builtin.Bool.Bool.false
The code to translate a pattern synonym with absurd pattern to an expression is this one (last line):
agda/src/full/Agda/Syntax/Abstract.hs
Lines 997 to 1006 in fc866f9
There are two problems:
- The meta info has no scope info, thus the constraint is printed in the top-level scope (full qualification).
- The absurd pattern is in instance position and should turn into an instance meta, but it does not.
The second problem is a consequence of rejecting the semantics of {{_}}
suggested in #2172, but after #7173 we have some machinery to fix this.