Commit dd99f2ec authored by eir@cis.upenn.edu's avatar eir@cis.upenn.edu

Fix #11797.

DsMeta curiously omitted quantified tyvars in certain circumstances.
This patch means it doesn't.

Test case: th/T11797
parent b1084fd7
......@@ -872,12 +872,9 @@ repContext ctxt = do preds <- repList typeQTyConName repLTy ctxt
repCtxt preds
repHsSigType :: LHsSigType Name -> DsM (Core TH.TypeQ)
repHsSigType ty = repLTy (hsSigType ty)
repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ)
repHsSigWcType (HsIB { hsib_vars = vars
, hsib_body = sig1 })
| (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy (hswc_body sig1)
repHsSigType (HsIB { hsib_vars = vars
, hsib_body = body })
| (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy body
= addTyVarBinds (HsQTvs { hsq_implicit = []
, hsq_explicit = map (noLoc . UserTyVar . noLoc) vars ++
explicit_tvs
......@@ -889,6 +886,10 @@ repHsSigWcType (HsIB { hsib_vars = vars
then return th_ty
else repTForall th_tvs th_ctxt th_ty }
repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ)
repHsSigWcType ib_ty@(HsIB { hsib_body = sig1 })
= repHsSigType (ib_ty { hsib_body = hswc_body sig1 })
-- yield the representation of a list of types
--
repLTys :: [LHsType Name] -> DsM [Core TH.TypeQ]
......
......@@ -445,6 +445,14 @@ Template Haskell
whether flags such as :ghc-flag:`-XStrictData` or
:ghc-flag:`-funbox-strict-fields` are enabled.
- Previously, quoting a type signature like ``a -> a`` would produce the
abstract syntax for ``forall a. a -> a``. This behavior remains, but it
is extended to kinds, too, meaning that ``Proxy a -> Proxy a`` becomes
``forall k (a :: k). Proxy a -> Proxy a``. This change is not intentional,
but is forced by the fact that GHC has a hard time telling kinds apart
from types. The effect of this change is that round-tripping kind-
polymorphic types will now require :ghc-flag:`-XTypeInType`.
Runtime system
~~~~~~~~~~~~~~
......
{-# LANGUAGE TemplateHaskell #-}
module T11797 where
import Language.Haskell.TH
import System.IO
$(do dec <- [d| class Foo a where
meth :: a -> b -> a |]
runIO $ do putStrLn $ pprint dec
hFlush stdout
return [] )
-- the key bit is the forall b. in the type of the method
class Foo_0 a_1
where meth_2 :: forall b_3 . a_1 -> b_3 -> a_1
{-# LANGUAGE TemplateHaskell, RankNTypes, DataKinds, TypeOperators, PolyKinds,
{-# LANGUAGE TemplateHaskell, RankNTypes, TypeOperators, TypeInType,
GADTs #-}
module T8031 where
import Data.Proxy
import Data.Kind
data SList :: [k] -> * where
SCons :: Proxy h -> Proxy t -> SList (h ': t)
......
......@@ -400,3 +400,4 @@ test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques'])
test('T11463', normal, compile_and_run, ['-v0 -dsuppress-uniques'])
test('T11680', normal, compile_fail, ['-v0'])
test('T11809', normal, compile, ['-v0'])
test('T11797', normal, compile, ['-v0 -dsuppress-uniques'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment