Use splitLHs{ForAll,Sigma}TyInvis throughout the codebase
Richard points out in #17688 (closed) that we use splitLHsForAllTy
and
splitLHsSigmaTy
in places that we ought to be using the
corresponding -Invis
variants instead, identifying two bugs
that are caused by this oversight:
- Certain TH-quoted type signatures, such as those that appear in
quoted
SPECIALISE
pragmas, silently turn visibleforall
s into invisibleforall
s. - When quoted, the type
forall a -> (a ~ a) => a
will turn intoforall a -> a
due to a bug inDsMeta.repForall
that drops contexts that follow visibleforall
s.
These are both ultimately caused by the fact that splitLHsForAllTy
and splitLHsSigmaTy
split apart visible forall
s in addition to
invisible ones. This patch cleans things up:
- We now use
splitLHsForAllTyInvis
andsplitLHsSigmaTyInvis
throughout the codebase. Relatedly, thesplitLHsForAllTy
andsplitLHsSigmaTy
have been removed, as they are easy to misuse. -
DsMeta.repForall
now only handles invisibleforall
s to reduce the chance for confusion with visibleforall
s, which need to be handled differently. I also renamed it fromrepForall
torepForallT
to emphasize that its distinguishing characteristic is the fact that it desugars down toL.H.TH.Syntax.ForallT
.
Fixes #17688 (closed).