Underapplied pattern synonyms expand to lambdas with wrong hiding in expressions
andreasabel opened this issue · comments
data D : Set where
c : D → {y : D} → D → D
pattern p x {y} z = c x {y} z
f : D → {y : D} → D → D
f = p
Error:
(z : D) → D !=< D
when checking that the expression λ z → p x {y} z has type D
This is already broken in 2.4.2.4 (the oldest Agda I have at my disposal).
Found this bug when reading the code:
agda/src/full/Agda/TypeChecking/Rules/Application.hs
Lines 144 to 156 in 7ad9543
lambdaLiftExpr
does not take the hiding into account (it is discarded), so the generated lambdas have the wrong hiding.