diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-01-15 13:02:34 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-01-25 07:58:57 -0500 |
commit | a9d772c757af7e9a7bd682df212ff70b70d51ae0 (patch) | |
tree | a3eb732036768279f97e2408b0796c08bab6bde1 /compiler/GHC/Rename/Source.hs | |
parent | b3e5c678851ed73897b0eb337e656ff377d242c9 (diff) | |
download | haskell-wip/T17688.tar.gz |
Use splitLHs{ForAll,Sigma}TyInvis throughout the codebasewip/T17688
Richard points out in #17688 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 visible `forall`s into
invisible `forall`s.
* When quoted, the type `forall a -> (a ~ a) => a` will turn into
`forall a -> a` due to a bug in `DsMeta.repForall` that drops
contexts that follow visible `forall`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` and `splitLHsSigmaTyInvis`
throughout the codebase. Relatedly, the `splitLHsForAllTy` and
`splitLHsSigmaTy` have been removed, as they are easy to misuse.
* `DsMeta.repForall` now only handles invisible `forall`s to reduce
the chance for confusion with visible `forall`s, which need to be
handled differently. I also renamed it from `repForall` to
`repForallT` to emphasize that its distinguishing characteristic
is the fact that it desugars down to `L.H.TH.Syntax.ForallT`.
Fixes #17688.
Diffstat (limited to 'compiler/GHC/Rename/Source.hs')
-rw-r--r-- | compiler/GHC/Rename/Source.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Rename/Source.hs b/compiler/GHC/Rename/Source.hs index f36a556224..6a84e30936 100644 --- a/compiler/GHC/Rename/Source.hs +++ b/compiler/GHC/Rename/Source.hs @@ -1834,7 +1834,7 @@ rnLDerivStrategy doc mds thing_inside do (via_ty', fvs1) <- rnHsSigType doc TypeLevel via_ty let HsIB { hsib_ext = via_imp_tvs , hsib_body = via_body } = via_ty' - (via_exp_tv_bndrs, _, _) = splitLHsSigmaTy via_body + (via_exp_tv_bndrs, _, _) = splitLHsSigmaTyInvis via_body via_exp_tvs = hsLTyVarNames via_exp_tv_bndrs via_tvs = via_imp_tvs ++ via_exp_tvs (thing, fvs2) <- extendTyVarEnvFVRn via_tvs thing_inside |