diff options
author | sheaf <sam.derbyshire@gmail.com> | 2023-04-01 16:30:24 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-04-01 18:28:37 -0400 |
commit | 3b7bbb39f28c926f8cfd30744253a418854bee31 (patch) | |
tree | ef26c6952f6035af31af7ada635aeacc3a694a97 | |
parent | 3da693466fd3e6a609a1a77361c50ed1b141858d (diff) | |
download | haskell-3b7bbb39f28c926f8cfd30744253a418854bee31.tar.gz |
TH: revert changes to GadtC & RecGadtC
Commit 3f374399 included a breaking-change to the template-haskell
library when it made the GadtC and RecGadtC constructors take non-empty
lists of names. As this has the potential to break many users' packages,
we decided to revert these changes for now.
-rw-r--r-- | compiler/GHC/HsToCore/Quote.hs | 14 | ||||
-rw-r--r-- | compiler/GHC/Tc/Errors/Ppr.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Tc/Errors/Types.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Tc/Gen/Splice.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/ThToHs.hs | 51 | ||||
-rw-r--r-- | compiler/GHC/Types/Error/Codes.hs | 4 | ||||
-rw-r--r-- | docs/users_guide/9.8.1-notes.rst | 4 | ||||
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs | 10 | ||||
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | 9 | ||||
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 23 | ||||
-rw-r--r-- | libraries/template-haskell/changelog.md | 4 | ||||
-rw-r--r-- | testsuite/tests/th/T10828.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/th/T10828b.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/th/T10828b.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/th/T11345.hs | 5 |
15 files changed, 79 insertions, 66 deletions
diff --git a/compiler/GHC/HsToCore/Quote.hs b/compiler/GHC/HsToCore/Quote.hs index 3166370e14..75a7121548 100644 --- a/compiler/GHC/HsToCore/Quote.hs +++ b/compiler/GHC/HsToCore/Quote.hs @@ -95,7 +95,7 @@ import Language.Haskell.Syntax.Basic (FieldLabelString(..)) import Data.ByteString ( unpack ) import Control.Monad import Data.List (sort, sortBy) -import Data.List.NonEmpty ( NonEmpty(..) ) +import Data.List.NonEmpty ( NonEmpty(..), toList ) import Data.Function import Control.Monad.Trans.Reader import Control.Monad.Trans.Class @@ -2742,19 +2742,16 @@ repGadtDataCons :: NonEmpty (LocatedN Name) -> LHsType GhcRn -> MetaM (Core (M TH.Con)) repGadtDataCons cons details res_ty - = do ne_tycon <- lift $ dsLookupTyCon nonEmptyTyConName - name_tycon <- lift $ dsLookupTyCon nameTyConName - let mk_nonEmpty = coreListNonEmpty ne_tycon (mkTyConTy name_tycon) - cons' <- mapM lookupLOcc cons -- See Note [Binders and occurrences] + = do cons' <- mapM lookupLOcc cons -- See Note [Binders and occurrences] case details of PrefixConGADT ps -> do arg_tys <- repPrefixConArgs ps res_ty' <- repLTy res_ty - rep2 gadtCName [unC (mk_nonEmpty cons'), unC arg_tys, unC res_ty'] + rep2 gadtCName [ unC (nonEmptyCoreList' cons'), unC arg_tys, unC res_ty'] RecConGADT ips _ -> do arg_vtys <- repRecConArgs ips res_ty' <- repLTy res_ty - rep2 recGadtCName [unC (mk_nonEmpty cons'), unC arg_vtys, + rep2 recGadtCName [unC (nonEmptyCoreList' cons'), unC arg_vtys, unC res_ty'] -- TH currently only supports linear constructors. @@ -3060,6 +3057,9 @@ nonEmptyCoreList :: [Core a] -> Core [a] nonEmptyCoreList [] = panic "coreList: empty argument" nonEmptyCoreList xs@(MkC x:_) = MkC (mkListExpr (exprType x) (map unC xs)) +nonEmptyCoreList' :: NonEmpty (Core a) -> Core [a] +nonEmptyCoreList' xs@(MkC x:|_) = MkC (mkListExpr (exprType x) (toList $ fmap unC xs)) + coreStringLit :: MonadThings m => FastString -> m (Core String) coreStringLit s = do { z <- mkStringExprFS s; return (MkC z) } diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs index d33a5647ae..09918d4014 100644 --- a/compiler/GHC/Tc/Errors/Ppr.hs +++ b/compiler/GHC/Tc/Errors/Ppr.hs @@ -4831,6 +4831,10 @@ pprConversionFailReason = \case text "Implicit parameters mixed with other bindings" InvalidCCallImpent from -> text (show from) <+> text "is not a valid ccall impent" + RecGadtNoCons -> + quotes (text "RecGadtC") <+> text "must have at least one constructor name" + GadtNoCons -> + quotes (text "GadtC") <+> text "must have at least one constructor name" InvalidTypeInstanceHeader tys -> text "Invalid type instance header:" <+> text (show tys) diff --git a/compiler/GHC/Tc/Errors/Types.hs b/compiler/GHC/Tc/Errors/Types.hs index 5f567495a3..648074f4f3 100644 --- a/compiler/GHC/Tc/Errors/Types.hs +++ b/compiler/GHC/Tc/Errors/Types.hs @@ -3683,6 +3683,8 @@ data ConversionFailReason | CasesExprWithoutAlts | ImplicitParamsWithOtherBinds | InvalidCCallImpent !String -- ^ Source + | RecGadtNoCons + | GadtNoCons | InvalidTypeInstanceHeader !TH.Type | InvalidTyFamInstLHS !TH.Type | InvalidImplicitParamBinding diff --git a/compiler/GHC/Tc/Gen/Splice.hs b/compiler/GHC/Tc/Gen/Splice.hs index f3d7c3c381..fcfe39cb4d 100644 --- a/compiler/GHC/Tc/Gen/Splice.hs +++ b/compiler/GHC/Tc/Gen/Splice.hs @@ -143,7 +143,6 @@ import Unsafe.Coerce ( unsafeCoerce ) import Control.Monad import Data.Binary import Data.Binary.Get -import qualified Data.List.NonEmpty as NE ( singleton ) import Data.Maybe import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as LB @@ -2235,7 +2234,7 @@ reifyDataCon isGadtDataCon tys dc dcdBangs r_arg_tys) | not (null fields) -> do { res_ty <- reifyType g_res_ty - ; return $ TH.RecGadtC (NE.singleton name) + ; return $ TH.RecGadtC [name] (zip3 (map reifyFieldLabel fields) dcdBangs r_arg_tys) res_ty } -- We need to check not isGadtDataCon here because GADT @@ -2248,7 +2247,7 @@ reifyDataCon isGadtDataCon tys dc ; return $ TH.InfixC (s1,r_a1) name (s2,r_a2) } | isGadtDataCon -> do { res_ty <- reifyType g_res_ty - ; return $ TH.GadtC (NE.singleton name) + ; return $ TH.GadtC [name] (dcdBangs `zip` r_arg_tys) res_ty } | otherwise -> return $ TH.NormalC name (dcdBangs `zip` r_arg_tys) diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs index 3b2cfc47a7..991674db34 100644 --- a/compiler/GHC/ThToHs.hs +++ b/compiler/GHC/ThToHs.hs @@ -276,7 +276,11 @@ cvtDec (DataD ctxt tc tvs ksig constrs derivs) cvtDec (NewtypeD ctxt tc tvs ksig constr derivs) = do { (ctxt', tc', tvs') <- cvt_tycl_hdr ctxt tc tvs ; ksig' <- cvtKind `traverse` ksig - ; con' <- cvtConstr (NE.head $ get_cons_names constr) cNameN constr + ; let first_datacon = + case get_cons_names constr of + [] -> panic "cvtDec: empty list of constructors" + c:_ -> c + ; con' <- cvtConstr first_datacon cNameN constr ; derivs' <- cvtDerivs derivs ; let defn = HsDataDefn { dd_ext = noExtField , dd_cType = Nothing @@ -348,8 +352,10 @@ cvtDec (DataFamilyD tc tvs kind) cvtDec (DataInstD ctxt bndrs tys ksig constrs derivs) = do { (ctxt', tc', bndrs', typats') <- cvt_datainst_hdr ctxt bndrs tys ; ksig' <- cvtKind `traverse` ksig - - ; let first_datacon = NE.head $ get_cons_names $ head constrs + ; let first_datacon = + case get_cons_names $ head constrs of + [] -> panic "cvtDec: empty list of constructors" + c:_ -> c ; cons' <- mapM (cvtConstr first_datacon cNameN) constrs ; derivs' <- cvtDerivs derivs ; let defn = HsDataDefn { dd_ext = noExtField @@ -372,7 +378,11 @@ cvtDec (DataInstD ctxt bndrs tys ksig constrs derivs) cvtDec (NewtypeInstD ctxt bndrs tys ksig constr derivs) = do { (ctxt', tc', bndrs', typats') <- cvt_datainst_hdr ctxt bndrs tys ; ksig' <- cvtKind `traverse` ksig - ; con' <- cvtConstr (NE.head $ get_cons_names $ constr) cNameN constr + ; let first_datacon = + case get_cons_names constr of + [] -> panic "cvtDec: empty list of constructors" + c:_ -> c + ; con' <- cvtConstr first_datacon cNameN constr ; derivs' <- cvtDerivs derivs ; let defn = HsDataDefn { dd_ext = noExtField , dd_cType = Nothing @@ -507,7 +517,10 @@ cvtGenDataDec type_data ctxt tc tvs ksig constrs derivs ; (ctxt', tc', tvs') <- cvt_tycl_hdr ctxt tc tvs ; ksig' <- cvtKind `traverse` ksig - ; let first_datacon = NE.head $ get_cons_names $ head constrs + ; let first_datacon = + case get_cons_names $ head constrs of + [] -> panic "cvtGenDataDec: empty list of constructors" + c:_ -> c ; cons' <- mapM (cvtConstr first_datacon con_name) constrs ; derivs' <- cvtDerivs derivs @@ -709,18 +722,22 @@ cvtConstr parent_con do_con_name (ForallC tvs ctxt con) where all_tvs = tvs' ++ ex_tvs -cvtConstr _ do_con_name (GadtC cs strtys ty) - = do { cs' <- mapM do_con_name cs - ; args <- mapM cvt_arg strtys - ; ty' <- cvtType ty - ; mk_gadt_decl cs' (PrefixConGADT $ map hsLinear args) ty'} - -cvtConstr parent_con do_con_name (RecGadtC cs varstrtys ty) - = do { cs' <- mapM do_con_name cs - ; ty' <- cvtType ty - ; rec_flds <- mapM (cvt_id_arg parent_con) varstrtys - ; lrec_flds <- returnLA rec_flds - ; mk_gadt_decl cs' (RecConGADT lrec_flds noHsUniTok) ty' } +cvtConstr _ do_con_name (GadtC c strtys ty) = case nonEmpty c of + Nothing -> failWith GadtNoCons + Just c -> do + { c' <- mapM do_con_name c + ; args <- mapM cvt_arg strtys + ; ty' <- cvtType ty + ; mk_gadt_decl c' (PrefixConGADT $ map hsLinear args) ty'} + +cvtConstr parent_con do_con_name (RecGadtC c varstrtys ty) = case nonEmpty c of + Nothing -> failWith RecGadtNoCons + Just c -> do + { c' <- mapM do_con_name c + ; ty' <- cvtType ty + ; rec_flds <- mapM (cvt_id_arg parent_con) varstrtys + ; lrec_flds <- returnLA rec_flds + ; mk_gadt_decl c' (RecConGADT lrec_flds noHsUniTok) ty' } mk_gadt_decl :: NonEmpty (LocatedN RdrName) -> HsConDeclGADTDetails GhcPs -> LHsType GhcPs -> CvtM (LConDecl GhcPs) diff --git a/compiler/GHC/Types/Error/Codes.hs b/compiler/GHC/Types/Error/Codes.hs index 7edcbbddbd..90950b3bb4 100644 --- a/compiler/GHC/Types/Error/Codes.hs +++ b/compiler/GHC/Types/Error/Codes.hs @@ -622,6 +622,8 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "CasesExprWithoutAlts" = 91745 GhcDiagnosticCode "ImplicitParamsWithOtherBinds" = 42974 GhcDiagnosticCode "InvalidCCallImpent" = 60220 + GhcDiagnosticCode "RecGadtNoCons" = 18816 + GhcDiagnosticCode "GadtNoCons" = 38140 GhcDiagnosticCode "InvalidTypeInstanceHeader" = 37056 GhcDiagnosticCode "InvalidTyFamInstLHS" = 78486 GhcDiagnosticCode "InvalidImplicitParamBinding" = 51603 @@ -705,8 +707,6 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "TcRnNameByTemplateHaskellQuote" = 40027 GhcDiagnosticCode "TcRnIllegalBindingOfBuiltIn" = 69639 GhcDiagnosticCode "TcRnMixedSelectors" = 40887 - GhcDiagnosticCode "RecGadtNoCons" = 18816 - GhcDiagnosticCode "GadtNoCons" = 38140 {- ********************************************************************* * * diff --git a/docs/users_guide/9.8.1-notes.rst b/docs/users_guide/9.8.1-notes.rst index 5bf426f8b0..352e0689ce 100644 --- a/docs/users_guide/9.8.1-notes.rst +++ b/docs/users_guide/9.8.1-notes.rst @@ -104,10 +104,6 @@ Runtime system ``template-haskell`` library ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- The ``GadtC`` and ``RecGadtC`` constructors of the ``Con`` datatype now take - non-empty lists of constructors. This means that the ``gadtC`` and ``recGadtC`` - smart constructors also expect non-empty lists as arguments. - - Record fields now belong to separate ``NameSpace``s, keyed by the parent of the record field. This is the name of the first constructor of the parent type, even if this constructor does not have the field in question. diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs index 542f1e16b6..8d0cf5adde 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs @@ -23,7 +23,7 @@ import qualified Language.Haskell.TH.Syntax as TH import Control.Applicative(liftA, Applicative(..)) import qualified Data.Kind as Kind (Type) import Data.Word( Word8 ) -import Data.List.NonEmpty ( NonEmpty(..), toList ) +import Data.List.NonEmpty ( NonEmpty(..) ) import GHC.Exts (TYPE) import Prelude hiding (Applicative(..)) @@ -680,10 +680,10 @@ forallC ns ctxt con = do con' <- con pure $ ForallC ns' ctxt' con' -gadtC :: Quote m => NonEmpty Name -> [m StrictType] -> m Type -> m Con +gadtC :: Quote m => [Name] -> [m StrictType] -> m Type -> m Con gadtC cons strtys ty = liftA2 (GadtC cons) (sequenceA strtys) ty -recGadtC :: Quote m => NonEmpty Name -> [m VarStrictType] -> m Type -> m Con +recGadtC :: Quote m => [Name] -> [m VarStrictType] -> m Type -> m Con recGadtC cons varstrtys ty = liftA2 (RecGadtC cons) (sequenceA varstrtys) ty ------------------------------------------------------------------------------- @@ -1177,7 +1177,7 @@ docCons :: (Q Con, Maybe String, [Maybe String]) -> Q () docCons (c, md, arg_docs) = do c' <- c -- Attach docs to the constructors - sequence_ [ putDoc (DeclDoc nm) d | Just d <- [md], nm <- toList $ get_cons_names c' ] + sequence_ [ putDoc (DeclDoc nm) d | Just d <- [md], nm <- get_cons_names c' ] -- Attach docs to the arguments case c' of -- Record selector documentation isn't stored in the argument map, @@ -1188,6 +1188,6 @@ docCons (c, md, arg_docs) = do ] _ -> sequence_ [ putDoc (ArgDoc nm i) arg_doc - | nm <- toList $ get_cons_names c' + | nm <- get_cons_names c' , (i, Just arg_doc) <- zip [0..] arg_docs ] diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs index d3101a985b..034d2687b3 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs @@ -11,7 +11,6 @@ module Language.Haskell.TH.Ppr where import Text.PrettyPrint (render) import Language.Haskell.TH.PprLib import Language.Haskell.TH.Syntax -import qualified Data.List.NonEmpty as NE ( toList ) import Data.Word ( Word8 ) import Data.Char ( toLower, chr) import GHC.Show ( showMultiLineString ) @@ -684,21 +683,21 @@ instance Ppr Con where <+> pprBangType st2 ppr (ForallC ns ctxt (GadtC cs sts ty)) - = commaSepApplied (NE.toList cs) <+> dcolon <+> pprForall ns ctxt + = commaSepApplied cs <+> dcolon <+> pprForall ns ctxt <+> pprGadtRHS sts ty ppr (ForallC ns ctxt (RecGadtC cs vsts ty)) - = commaSepApplied (NE.toList cs) <+> dcolon <+> pprForall ns ctxt + = commaSepApplied cs <+> dcolon <+> pprForall ns ctxt <+> pprRecFields vsts ty ppr (ForallC ns ctxt con) = pprForall ns ctxt <+> ppr con ppr (GadtC cs sts ty) - = commaSepApplied (NE.toList cs) <+> dcolon <+> pprGadtRHS sts ty + = commaSepApplied cs <+> dcolon <+> pprGadtRHS sts ty ppr (RecGadtC cs vsts ty) - = commaSepApplied (NE.toList cs) <+> dcolon <+> pprRecFields vsts ty + = commaSepApplied cs <+> dcolon <+> pprRecFields vsts ty instance Ppr PatSynDir where ppr Unidir = text "<-" diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index 221fd5ca28..6d96d414c6 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -48,7 +48,6 @@ import System.IO ( hPutStrLn, stderr ) import Data.Char ( isAlpha, isAlphaNum, isUpper, ord ) import Data.Int import Data.List.NonEmpty ( NonEmpty(..) ) -import qualified Data.List.NonEmpty as NE ( singleton ) import Data.Void ( Void, absurd ) import Data.Word import Data.Ratio @@ -2732,16 +2731,20 @@ data Con = | ForallC [TyVarBndr Specificity] Cxt Con -- @C :: a -> b -> T b Int@ - | GadtC (NonEmpty Name) + | GadtC [Name] -- ^ The list of constructors, corresponding to the GADT constructor - -- syntax @C1, C2 :: a -> T b@ + -- syntax @C1, C2 :: a -> T b@. + -- + -- Invariant: the list must be non-empty. [BangType] -- ^ The constructor arguments Type -- ^ See Note [GADT return type] -- | @C :: { v :: Int } -> T b Int@ - | RecGadtC (NonEmpty Name) + | RecGadtC [Name] -- ^ The list of constructors, corresponding to the GADT record - -- constructor syntax @C1, C2 :: { fld :: a } -> T b@ + -- constructor syntax @C1, C2 :: { fld :: a } -> T b@. + -- + -- Invariant: the list must be non-empty. [VarBangType] -- ^ The constructor arguments Type -- ^ See Note [GADT return type] deriving (Show, Eq, Ord, Data, Generic) @@ -2941,14 +2944,14 @@ thenCmp :: Ordering -> Ordering -> Ordering thenCmp EQ o2 = o2 thenCmp o1 _ = o1 -get_cons_names :: Con -> NonEmpty Name -get_cons_names (NormalC n _) = NE.singleton n -get_cons_names (RecC n _) = NE.singleton n -get_cons_names (InfixC _ n _) = NE.singleton n +get_cons_names :: Con -> [Name] +get_cons_names (NormalC n _) = [n] +get_cons_names (RecC n _) = [n] +get_cons_names (InfixC _ n _) = [n] get_cons_names (ForallC _ _ con) = get_cons_names con -- GadtC can have multiple names, e.g -- > data Bar a where -- > MkBar1, MkBar2 :: a -> Bar a -- Will have one GadtC with [MkBar1, MkBar2] as names get_cons_names (GadtC ns _ _) = ns -get_cons_names (RecGadtC ns _ _) = ns
\ No newline at end of file +get_cons_names (RecGadtC ns _ _) = ns diff --git a/libraries/template-haskell/changelog.md b/libraries/template-haskell/changelog.md index 821c776d96..f6ed4d6b5f 100644 --- a/libraries/template-haskell/changelog.md +++ b/libraries/template-haskell/changelog.md @@ -2,10 +2,6 @@ ## 2.21.0.0 - * The `GadtC` and `RecGadtC` constructors of the `Con` datatype now take - non-empty lists of constructors. This means that the `gadtC` and `recGadtC` - smart constructors also expect non-empty lists as arguments. - * Record fields now belong to separate `NameSpace`s, keyed by the parent of the record field. This is the name of the first constructor of the parent type, even if this constructor does not have the field in question. diff --git a/testsuite/tests/th/T10828.hs b/testsuite/tests/th/T10828.hs index d73b5015ae..1285174cce 100644 --- a/testsuite/tests/th/T10828.hs +++ b/testsuite/tests/th/T10828.hs @@ -6,7 +6,6 @@ module T10828 where import Language.Haskell.TH hiding (Type) import System.IO import Data.Kind (Type) -import qualified Data.List.NonEmpty as NE ( singleton ) $( do { decl <- [d| data family D a :: Type -> Type data instance D Int Bool :: Type where @@ -34,7 +33,7 @@ $( return [ DataD [] (mkName "T") [ PlainTV (mkName "a") () ] (Just StarT) - [ GadtC (NE.singleton (mkName "MkT")) + [ GadtC [mkName "MkT"] [ ( Bang NoSourceUnpackedness NoSourceStrictness , VarT (mkName "a") ) @@ -47,7 +46,7 @@ $( return , ForallC [PlainTV (mkName "a") SpecifiedSpec, PlainTV (mkName "b") SpecifiedSpec] [AppT (AppT EqualityT (VarT $ mkName "a" ) ) (ConT $ mkName "Int") ] $ - RecGadtC (NE.singleton (mkName "MkC")) + RecGadtC [mkName "MkC"] [ ( mkName "foo" , Bang NoSourceUnpackedness NoSourceStrictness , VarT (mkName "a") diff --git a/testsuite/tests/th/T10828b.hs b/testsuite/tests/th/T10828b.hs index 36e91eb11a..4ea4d82f9c 100644 --- a/testsuite/tests/th/T10828b.hs +++ b/testsuite/tests/th/T10828b.hs @@ -4,7 +4,6 @@ module T10828b where import Language.Haskell.TH import System.IO -import qualified Data.List.NonEmpty as NE ( singleton ) -- attempting to mix GADT and normal constructors $( return @@ -24,7 +23,7 @@ $( return [AppT (AppT EqualityT (VarT $ mkName "a" ) ) (ConT $ mkName "Int") ] $ RecGadtC - (NE.singleton (mkName "MkC")) + [mkName "MkC"] [ ( mkName "foo" , Bang NoSourceUnpackedness NoSourceStrictness , VarT (mkName "a") diff --git a/testsuite/tests/th/T10828b.stderr b/testsuite/tests/th/T10828b.stderr index 6e78ca9087..357c86c458 100644 --- a/testsuite/tests/th/T10828b.stderr +++ b/testsuite/tests/th/T10828b.stderr @@ -1,5 +1,5 @@ -T10828b.hs:10:2: error: [GHC-24104] +T10828b.hs:9:2: error: [GHC-24104] Cannot mix GADT constructors with Haskell 98 constructors When splicing a TH declaration: data T a :: * diff --git a/testsuite/tests/th/T11345.hs b/testsuite/tests/th/T11345.hs index 11de6d8bd5..2288cdad15 100644 --- a/testsuite/tests/th/T11345.hs +++ b/testsuite/tests/th/T11345.hs @@ -5,7 +5,6 @@ module Main (main) where import Language.Haskell.TH -import qualified Data.List.NonEmpty as NE ( singleton ) infixr 7 :***: data GADT a where @@ -17,11 +16,11 @@ $(do gadtName <- newName "GADT2" infixName <- newName ":****:" a <- newName "a" return [ DataD [] gadtName [KindedTV a () StarT] Nothing - [ GadtC (NE.singleton prefixName) + [ GadtC [prefixName] [ (Bang NoSourceUnpackedness NoSourceStrictness,ConT ''Int) , (Bang NoSourceUnpackedness NoSourceStrictness,ConT ''Int) ] (AppT (ConT gadtName) (ConT ''Int)) - , GadtC (NE.singleton infixName) + , GadtC [infixName] [ (Bang NoSourceUnpackedness NoSourceStrictness,ConT ''Int) , (Bang NoSourceUnpackedness NoSourceStrictness,ConT ''Int) ] (AppT (ConT gadtName) (ConT ''Int)) |