diff --git a/compiler/GHC/Hs.hs b/compiler/GHC/Hs.hs index 3f049e326dd1e0d04fdb998ad00086f7658d26bc..bf902e25b4fbd895efb1738028ecfbd6ce0d03fd 100644 --- a/compiler/GHC/Hs.hs +++ b/compiler/GHC/Hs.hs @@ -101,12 +101,14 @@ deriving instance Data (HsModule GhcPs) data AnnsModule = AnnsModule { am_main :: [AddEpAnn], - am_decls :: [TrailingAnn], - am_eof :: Maybe (RealSrcSpan, RealSrcSpan) -- End of file and end of prior token + am_decls :: [TrailingAnn], -- ^ Semis before the start of top decls + am_cs :: [LEpaComment], -- ^ Comments before start of top decl, + -- used in exact printing only + am_eof :: Maybe (RealSrcSpan, RealSrcSpan) -- ^ End of file and end of prior token } deriving (Data, Eq) instance NoAnn AnnsModule where - noAnn = AnnsModule [] [] Nothing + noAnn = AnnsModule [] [] [] Nothing instance Outputable (HsModule GhcPs) where ppr (HsModule { hsmodExt = XModulePs { hsmodHaddockModHeader = mbDoc } diff --git a/compiler/GHC/Hs/Binds.hs b/compiler/GHC/Hs/Binds.hs index c14acb4c826a8574712e883a2b0bac2015aee721..47cd4cc1c7b746fce84732f75bcecc5c8fe643a6 100644 --- a/compiler/GHC/Hs/Binds.hs +++ b/compiler/GHC/Hs/Binds.hs @@ -116,7 +116,7 @@ type instance XFunBind (GhcPass pL) GhcTc = (HsWrapper, [CoreTickish]) -- type Int -> forall a'. a' -> a' -- Notice that the coercion captures the free a'. -type instance XPatBind GhcPs (GhcPass pR) = [AddEpAnn] +type instance XPatBind GhcPs (GhcPass pR) = NoExtField type instance XPatBind GhcRn (GhcPass pR) = NameSet -- See Note [Bind free vars] type instance XPatBind GhcTc (GhcPass pR) = ( Type -- Type of the GRHSs diff --git a/compiler/GHC/Hs/Type.hs b/compiler/GHC/Hs/Type.hs index 4d925a58c0007f175c056f7549e24c188110c20a..2d401e1807b3379d97f95448886ec0aa15050747 100644 --- a/compiler/GHC/Hs/Type.hs +++ b/compiler/GHC/Hs/Type.hs @@ -219,7 +219,7 @@ type instance XHsPS GhcPs = EpAnnCO type instance XHsPS GhcRn = HsPSRn type instance XHsPS GhcTc = HsPSRn -type instance XHsTP GhcPs = EpAnnCO +type instance XHsTP GhcPs = NoExtField type instance XHsTP GhcRn = HsTyPatRn type instance XHsTP GhcTc = DataConCantHappen @@ -295,9 +295,9 @@ mkHsPatSigType :: EpAnnCO -> LHsType GhcPs -> HsPatSigType GhcPs mkHsPatSigType ann x = HsPS { hsps_ext = ann , hsps_body = x } -mkHsTyPat :: EpAnnCO -> LHsType GhcPs -> HsTyPat GhcPs -mkHsTyPat ann x = HsTP { hstp_ext = ann - , hstp_body = x } +mkHsTyPat :: LHsType GhcPs -> HsTyPat GhcPs +mkHsTyPat x = HsTP { hstp_ext = noExtField + , hstp_body = x } mkEmptyWildCardBndrs :: thing -> HsWildCardBndrs GhcRn thing mkEmptyWildCardBndrs x = HsWC { hswc_body = x @@ -589,7 +589,7 @@ mkHsAppTys = foldl' mkHsAppTy mkHsAppKindTy :: XAppKindTy (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) -mkHsAppKindTy x ty k = addCLocA ty k (HsAppKindTy x ty k) +mkHsAppKindTy at ty k = addCLocA ty k (HsAppKindTy at ty k) {- ************************************************************************ diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index 5a53cfb7c8777d0cfcac3f6bc6e0c6ff6c187328..2e036d021b887d55041177009995ad6f03b5cf62 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -881,7 +881,7 @@ signature :: { Located (HsModule GhcPs) } : 'signature' modid maybe_warning_pragma maybeexports 'where' body {% fileSrcSpan >>= \ loc -> acs loc (\loc cs-> (L loc (HsModule (XModulePs - (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnSignature $1, mj AnnWhere $5] (fstOf3 $6) Nothing) cs) + (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnSignature $1, mj AnnWhere $5] (fstOf3 $6) [] Nothing) cs) (thdOf3 $6) $3 Nothing) (Just $2) $4 (fst $ sndOf3 $6) (snd $ sndOf3 $6))) @@ -891,7 +891,7 @@ module :: { Located (HsModule GhcPs) } : 'module' modid maybe_warning_pragma maybeexports 'where' body {% fileSrcSpan >>= \ loc -> acsFinal (\cs eof -> (L loc (HsModule (XModulePs - (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1, mj AnnWhere $5] (fstOf3 $6) eof) cs) + (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1, mj AnnWhere $5] (fstOf3 $6) [] eof) cs) (thdOf3 $6) $3 Nothing) (Just $2) $4 (fst $ sndOf3 $6) (snd $ sndOf3 $6)) @@ -899,7 +899,7 @@ module :: { Located (HsModule GhcPs) } | body2 {% fileSrcSpan >>= \ loc -> acsFinal (\cs eof -> (L loc (HsModule (XModulePs - (EpAnn (spanAsAnchor loc) (AnnsModule [] (fstOf3 $1) eof) cs) + (EpAnn (spanAsAnchor loc) (AnnsModule [] (fstOf3 $1) [] eof) cs) (thdOf3 $1) Nothing Nothing) Nothing Nothing (fst $ sndOf3 $1) (snd $ sndOf3 $1)))) } @@ -939,14 +939,14 @@ header :: { Located (HsModule GhcPs) } : 'module' modid maybe_warning_pragma maybeexports 'where' header_body {% fileSrcSpan >>= \ loc -> acs loc (\loc cs -> (L loc (HsModule (XModulePs - (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1,mj AnnWhere $5] [] Nothing) cs) + (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1,mj AnnWhere $5] [] [] Nothing) cs) EpNoLayout $3 Nothing) (Just $2) $4 $6 [] ))) } | 'signature' modid maybe_warning_pragma maybeexports 'where' header_body {% fileSrcSpan >>= \ loc -> acs loc (\loc cs -> (L loc (HsModule (XModulePs - (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1,mj AnnWhere $5] [] Nothing) cs) + (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1,mj AnnWhere $5] [] [] Nothing) cs) EpNoLayout $3 Nothing) (Just $2) $4 $6 [] ))) } @@ -1257,8 +1257,7 @@ topdecl :: { LHsDecl GhcPs } -- but we treat an arbitrary expression just as if -- it had a $(..) wrapped around it | infixexp {% runPV (unECP $1) >>= \ $1 -> - do { d <- mkSpliceDecl $1 - ; commentsPA d }} + commentsPA $ mkSpliceDecl $1 } -- Type classes -- @@ -2585,7 +2584,7 @@ decl_no_th :: { LHsDecl GhcPs } ; !cs <- getCommentsFor l ; return $! (sL (commentsA l cs) $ ValD noExtField r) } } | PREFIX_PERCENT atype infixexp opt_sig rhs {% runPV (unECP $3) >>= \ $3 -> - do { let { l = comb2 $3 $> } + do { let { l = comb2 $1 $> } ; r <- checkValDef l $3 (mkMultAnn (epTok $1) $2, $4) $5; -- parses bindings of the form %p x or -- %p x :: sig @@ -2603,7 +2602,7 @@ decl :: { LHsDecl GhcPs } -- Why do we only allow naked declaration splices in top-level -- declarations and not here? Short answer: because readFail009 -- fails terribly with a panic in cvBindsAndSigs otherwise. - | splice_exp {% mkSpliceDecl $1 } + | splice_exp { mkSpliceDecl $1 } rhs :: { Located (GRHSs GhcPs (LHsExpr GhcPs)) } : '=' exp wherebinds {% runPV (unECP $2) >>= \ $2 -> @@ -3401,7 +3400,7 @@ bindpat : exp {% -- See Note [Parser-Validator Details] in GHC.Parse argpat :: { LPat GhcPs } argpat : apat { $1 } - | PREFIX_AT atype { L (getLocAnn (reLoc $2)) (InvisPat (epTok $1) (mkHsTyPat noAnn $2)) } + | PREFIX_AT atype { sLLa $1 $> (InvisPat (epTok $1) (mkHsTyPat $2)) } argpats :: { [LPat GhcPs] } : argpat argpats { $1 : $2 } @@ -4559,7 +4558,8 @@ addTrailingCommaN (L anns a) span = do return (L anns' a) addTrailingCommaS :: Located StringLiteral -> EpaLocation -> Located StringLiteral -addTrailingCommaS (L l sl) span = L l (sl { sl_tc = Just (epaToNoCommentsLocation span) }) +addTrailingCommaS (L l sl) span + = L (widenSpan l [AddEpAnn AnnComma span]) (sl { sl_tc = Just (epaToNoCommentsLocation span) }) -- ------------------------------------- diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index d3f797aea981bd4c0a68c93eef6c0fd473f8728b..5a3cf7219be807f6b00045b9da8bb6d42dca9b71 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -386,7 +386,7 @@ mkFamDecl loc info topLevel lhs ksig injAnn annsIn OpenTypeFamily -> empty ClosedTypeFamily {} -> whereDots -mkSpliceDecl :: LHsExpr GhcPs -> P (LHsDecl GhcPs) +mkSpliceDecl :: LHsExpr GhcPs -> (LHsDecl GhcPs) -- If the user wrote -- [pads| ... ] then return a QuasiQuoteD -- $(e) then return a SpliceD @@ -397,18 +397,15 @@ mkSpliceDecl :: LHsExpr GhcPs -> P (LHsDecl GhcPs) -- Typed splices are not allowed at the top level, thus we do not represent them -- as spliced declaration. See #10945 mkSpliceDecl lexpr@(L loc expr) - | HsUntypedSplice _ splice@(HsUntypedSpliceExpr {}) <- expr = do - !cs <- getCommentsFor (locA loc) - return $ L (addCommentsToEpAnn loc cs) $ SpliceD noExtField (SpliceDecl noExtField (L loc splice) DollarSplice) - - | HsUntypedSplice _ splice@(HsQuasiQuote {}) <- expr = do - cs <- getCommentsFor (locA loc) - return $ L (addCommentsToEpAnn loc cs) $ SpliceD noExtField (SpliceDecl noExtField (L loc splice) DollarSplice) - - | otherwise = do - !cs <- getCommentsFor (locA loc) - return $ L (addCommentsToEpAnn loc cs) $ SpliceD noExtField (SpliceDecl noExtField - (L loc (HsUntypedSpliceExpr noAnn lexpr)) + | HsUntypedSplice _ splice@(HsUntypedSpliceExpr {}) <- expr + = L loc $ SpliceD noExtField (SpliceDecl noExtField (L (l2l loc) splice) DollarSplice) + + | HsUntypedSplice _ splice@(HsQuasiQuote {}) <- expr + = L loc $ SpliceD noExtField (SpliceDecl noExtField (L (l2l loc) splice) DollarSplice) + + | otherwise + = L loc $ SpliceD noExtField (SpliceDecl noExtField + (L (l2l loc) (HsUntypedSpliceExpr noAnn (la2la lexpr))) BareSplice) mkRoleAnnotDecl :: SrcSpan @@ -1323,7 +1320,7 @@ checkValDef loc lhs (mult, Just (sigAnn, sig)) grhss -- x :: ty = rhs parses as a *pattern* binding = do lhs' <- runPV $ mkHsTySigPV (combineLocsA lhs sig) lhs sig [sigAnn] >>= checkLPat - checkPatBind loc [] lhs' grhss mult + checkPatBind loc lhs' grhss mult checkValDef loc lhs (mult_ann, Nothing) grhss | HsNoMultAnn{} <- mult_ann @@ -1334,12 +1331,12 @@ checkValDef loc lhs (mult_ann, Nothing) grhss fun is_infix pats grhss Nothing -> do lhs' <- checkPattern lhs - checkPatBind loc [] lhs' grhss mult_ann } + checkPatBind loc lhs' grhss mult_ann } checkValDef loc lhs (mult_ann, Nothing) ghrss -- %p x = rhs parses as a *pattern* binding = do lhs' <- checkPattern lhs - checkPatBind loc [] lhs' ghrss mult_ann + checkPatBind loc lhs' ghrss mult_ann checkFunBind :: SrcStrictness -> SrcSpan @@ -1377,15 +1374,14 @@ makeFunBind fn ms -- See Note [FunBind vs PatBind] checkPatBind :: SrcSpan - -> [AddEpAnn] -> LPat GhcPs -> Located (GRHSs GhcPs (LHsExpr GhcPs)) -> HsMultAnn GhcPs -> P (HsBind GhcPs) -checkPatBind loc annsIn (L _ (BangPat ans (L _ (VarPat _ v)))) +checkPatBind loc (L _ (BangPat ans (L _ (VarPat _ v)))) (L _match_span grhss) (HsNoMultAnn _) = return (makeFunBind v (L (noAnnSrcSpan loc) - [L (noAnnSrcSpan loc) (m (ans++annsIn) v)])) + [L (noAnnSrcSpan loc) (m ans v)])) where m a v = Match { m_ext = a , m_ctxt = FunRhs { mc_fun = v @@ -1394,8 +1390,8 @@ checkPatBind loc annsIn (L _ (BangPat ans (L _ (VarPat _ v)))) , m_pats = [] , m_grhss = grhss } -checkPatBind _loc annsIn lhs (L _ grhss) mult = do - return (PatBind annsIn lhs mult grhss) +checkPatBind _loc lhs (L _ grhss) mult = do + return (PatBind noExtField lhs mult grhss) checkValSigLhs :: LHsExpr GhcPs -> P (LocatedN RdrName) @@ -1459,9 +1455,12 @@ isFunLhs e = go e [] [] [] op_app = mk $ L loc (PatBuilderOpApp (L k_loc k) (L loc' op) r (reverse ops ++ cps)) reassociate _other = Nothing - go (L _ (PatBuilderAppType pat tok ty_pat@(HsTP _ (L loc _)))) es ops cps - = go pat (L loc (ArgPatBuilderArgPat invis_pat) : es) ops cps + go (L _ (PatBuilderAppType pat tok ty_pat@(HsTP _ (L (EpAnn anc ann cs) _)))) es ops cps + = go pat (L (EpAnn anc' ann cs) (ArgPatBuilderArgPat invis_pat) : es) ops cps where invis_pat = InvisPat tok ty_pat + anc' = case tok of + NoEpTok -> anc + EpTok l -> widenAnchor anc [AddEpAnn AnnAnyclass l] go _ _ _ _ = return Nothing data ArgPatBuilder p @@ -1921,8 +1920,7 @@ instance DisambECP (PatBuilder GhcPs) where mkHsAppPV l p1 p2 = return $ L l (PatBuilderApp p1 p2) mkHsAppTypePV l p at t = do !cs <- getCommentsFor (locA l) - let anns = EpAnn (spanAsAnchor (getLocA t)) NoEpAnns cs - return $ L l (PatBuilderAppType p at (mkHsTyPat anns t)) + return $ L (addCommentsToEpAnn l cs) (PatBuilderAppType p at (mkHsTyPat t)) mkHsIfPV l _ _ _ _ _ _ = addFatalError $ mkPlainErrorMsgEnvelope l PsErrIfThenElseInPat mkHsDoPV l _ _ _ = addFatalError $ mkPlainErrorMsgEnvelope l PsErrDoNotationInPat mkHsParPV l lpar p rpar = return $ L (noAnnSrcSpan l) (PatBuilderPar lpar p rpar) @@ -1979,7 +1977,7 @@ instance DisambECP (PatBuilder GhcPs) where mkSumOrTuplePV = mkSumOrTuplePat mkHsEmbTyPV l toktype ty = return $ L (noAnnSrcSpan l) $ - PatBuilderPat (EmbTyPat toktype (mkHsTyPat noAnn ty)) + PatBuilderPat (EmbTyPat toktype (mkHsTyPat ty)) rejectPragmaPV _ = return () -- | Ensure that a literal pattern isn't of type Addr#, Float#, Double#. @@ -3318,12 +3316,12 @@ withCombinedComments :: HasLoc l2 => l1 -> l2 -> - (SrcSpan -> EpAnnComments -> P a) -> + (SrcSpan -> P a) -> P (LocatedA a) withCombinedComments start end use = do cs <- getCommentsFor fullSpan - a <- use fullSpan cs - pure (L (noAnnSrcSpan fullSpan) a) + a <- use fullSpan + pure (L (EpAnn (spanAsAnchor fullSpan) noAnn cs) a) where fullSpan = combineSrcSpans (getHasLoc start) (getHasLoc end) @@ -3363,15 +3361,14 @@ mkTupleSyntaxTycon boxity n = mkListSyntaxTy0 :: EpaLocation -> EpaLocation -> SrcSpan - -> EpAnnComments -> P (HsType GhcPs) -mkListSyntaxTy0 brkOpen brkClose span comments = +mkListSyntaxTy0 brkOpen brkClose span = punsIfElse enabled disabled where enabled = HsTyVar noAnn NotPromoted rn -- attach the comments only to the RdrName since it's the innermost AST node - rn = L (EpAnn fullLoc rdrNameAnn comments) listTyCon_RDR + rn = L (EpAnn fullLoc rdrNameAnn emptyComments) listTyCon_RDR disabled = HsExplicitListTy annsKeyword NotPromoted [] diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs index 59266d70a2d3454a5887b38f2c9326fbfe178692..8f8f11d672e26aee6a337eb659ac6dad292584e5 100644 --- a/compiler/GHC/ThToHs.hs +++ b/compiler/GHC/ThToHs.hs @@ -218,7 +218,7 @@ cvtDec (TH.ValD pat body ds) ; returnJustLA $ Hs.ValD noExtField $ PatBind { pat_lhs = pat' , pat_rhs = GRHSs emptyComments body' ds' - , pat_ext = noAnn + , pat_ext = noExtField , pat_mult = HsNoMultAnn noExtField } } @@ -1446,7 +1446,7 @@ cvtp (ConP s ts ps) = do { s' <- cNameN s ; ps' <- cvtPats ps ; ts' <- mapM cvtType ts ; let pps = map (parenthesizePat appPrec) ps' - pts = map (\t -> HsConPatTyArg noAnn (mkHsTyPat noAnn t)) ts' + pts = map (\t -> HsConPatTyArg noAnn (mkHsTyPat t)) ts' ; return $ ConPat { pat_con_ext = noAnn , pat_con = s' @@ -1489,9 +1489,9 @@ cvtp (SigP p t) = do { p' <- cvtPat p; t' <- cvtType t cvtp (ViewP e p) = do { e' <- cvtl e; p' <- cvtPat p ; return $ ViewPat noAnn e' p'} cvtp (TypeP t) = do { t' <- cvtType t - ; return $ EmbTyPat noAnn (mkHsTyPat noAnn t') } + ; return $ EmbTyPat noAnn (mkHsTyPat t') } cvtp (InvisP t) = do { t' <- cvtType t - ; pure (InvisPat noAnn (mkHsTyPat noAnn t'))} + ; pure (InvisPat noAnn (mkHsTyPat t'))} cvtPatFld :: (TH.Name, TH.Pat) -> CvtM (LHsRecField GhcPs (LPat GhcPs)) cvtPatFld (s,p) diff --git a/testsuite/tests/ghc-api/exactprint/T22919.stderr b/testsuite/tests/ghc-api/exactprint/T22919.stderr index 82684b25faa8611f5918f46cacab5efff3daf7f6..525a01a334c493e406b6d9d8c384fbb344ba7860 100644 --- a/testsuite/tests/ghc-api/exactprint/T22919.stderr +++ b/testsuite/tests/ghc-api/exactprint/T22919.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T22919.hs:1:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T22919.hs:1:29-33 }))] [] + [] (Just ((,) { T22919.hs:3:1 } diff --git a/testsuite/tests/ghc-api/exactprint/Test20239.stderr b/testsuite/tests/ghc-api/exactprint/Test20239.stderr index 55b900ecc7d98a2783c9157d7682735132662b97..e07962967b4f95de53df8b0b6aadfdf33bbe1810 100644 --- a/testsuite/tests/ghc-api/exactprint/Test20239.stderr +++ b/testsuite/tests/ghc-api/exactprint/Test20239.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { Test20239.hs:1:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { Test20239.hs:1:18-22 }))] [] + [] (Just ((,) { Test20239.hs:9:1 } @@ -200,7 +201,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { Test20239.hs:7:50 }) (EpaSpan { Test20239.hs:7:86 })) + (AnnParen + AnnParens + (EpaSpan { Test20239.hs:7:50 }) + (EpaSpan { Test20239.hs:7:86 })) (L (EpAnn (EpaSpan { Test20239.hs:7:51-85 }) @@ -269,7 +273,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { Test20239.hs:7:68 }) (EpaSpan { Test20239.hs:7:85 })) + (AnnParen + AnnParens + (EpaSpan { Test20239.hs:7:68 }) + (EpaSpan { Test20239.hs:7:85 })) (L (EpAnn (EpaSpan { Test20239.hs:7:69-84 }) @@ -334,7 +341,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { Test20239.hs:7:83 }) (EpaSpan { Test20239.hs:7:84 })) + (AnnParen + AnnParens + (EpaSpan { Test20239.hs:7:83 }) + (EpaSpan { Test20239.hs:7:84 })) (HsBoxedOrConstraintTuple) [])))))))))))))]) (Nothing)))]) diff --git a/testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr b/testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr index 98069a691e54f075470c0920ff9bd7da98e441ba..775cb7550f0517827d2b7665cebe743ce51edf33 100644 --- a/testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr +++ b/testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { ZeroWidthSemi.hs:1:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { ZeroWidthSemi.hs:1:22-26 }))] [] + [] (Just ((,) { ZeroWidthSemi.hs:9:1 } diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr index 5782d6f3b5219cc1add1d7798c5e7e10ea57b812..edc965c1c6b79c853aa39f8135a8cec20cdc4994 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T17544.hs:3:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:3:15-19 }))] [] + [] (Just ((,) { T17544.hs:57:1 } diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr index 8ef5c80a424fe1e2da26b1022f9a17e2da4bb3aa..bab3007ca54d028c1147643e32109eb2005a187c 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T17544_kw.hs:11:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:13:13-17 }))] [] + [] (Just ((,) { T17544_kw.hs:25:1 } @@ -227,7 +228,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { T17544_kw.hs:19:18 }) (EpaSpan { T17544_kw.hs:19:19 })) + (AnnParen + AnnParens + (EpaSpan { T17544_kw.hs:19:18 }) + (EpaSpan { T17544_kw.hs:19:19 })) (HsBoxedOrConstraintTuple) [])))]) (L diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr index 1e0e33d80cff5278754fdd632209a3614b83d2d7..017c96e25a0c90bf9a49940687491daef52063a6 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T24221.hs:1:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T24221.hs:1:15-19 }))] [] + [] (Just ((,) { T24221.hs:43:4 } diff --git a/testsuite/tests/linear/should_fail/LinearLet6.stderr b/testsuite/tests/linear/should_fail/LinearLet6.stderr index bb8a9bace8bcd4fb76960220a33276e7a333be95..e9f6e57dc5b0825dc61919b14f6b67e7f03e02b8 100644 --- a/testsuite/tests/linear/should_fail/LinearLet6.stderr +++ b/testsuite/tests/linear/should_fail/LinearLet6.stderr @@ -13,7 +13,7 @@ LinearLet6.hs:10:3: error: [GHC-18872] where (Just y) = x -LinearLet6.hs:15:14: error: [GHC-18872] +LinearLet6.hs:15:11: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ arising from a non-linear pattern ‘Just y’ (non-variable lazy pattern aren't linear) diff --git a/testsuite/tests/linear/should_fail/LinearLet7.stderr b/testsuite/tests/linear/should_fail/LinearLet7.stderr index af01d2658744eea66fa6c0596685bc59a5a8dcb4..52c95d8a95272deb570300f9e972e0e7f42c8d78 100644 --- a/testsuite/tests/linear/should_fail/LinearLet7.stderr +++ b/testsuite/tests/linear/should_fail/LinearLet7.stderr @@ -1,14 +1,14 @@ -LinearLet7.hs:6:14: error: [GHC-18872] +LinearLet7.hs:6:11: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from multiplicity of ‘g’ - • In a pattern binding: g = \ y -> g y - In the expression: let %1 g = \ y -> ... in g x + arising from a non-linear pattern ‘_’ + (non-variable pattern bindings that have been generalised aren't linear) + • In the expression: let %1 g = \ y -> ... in g x In an equation for ‘f’: f x = let %1 g = ... in g x LinearLet7.hs:6:14: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ - arising from a non-linear pattern ‘_’ - (non-variable pattern bindings that have been generalised aren't linear) - • In the expression: let %1 g = \ y -> ... in g x + arising from multiplicity of ‘g’ + • In a pattern binding: g = \ y -> g y + In the expression: let %1 g = \ y -> ... in g x In an equation for ‘f’: f x = let %1 g = ... in g x diff --git a/testsuite/tests/module/mod185.stderr b/testsuite/tests/module/mod185.stderr index 038059ad34b1c88ebfa187e44983fbb8101bea64..0f176b1a67becaad3267d5c0bc8c4b434d607731 100644 --- a/testsuite/tests/module/mod185.stderr +++ b/testsuite/tests/module/mod185.stderr @@ -8,6 +8,7 @@ (EpAnn (EpaSpan { mod185.hs:1:1 }) (AnnsModule + [] [] [] (Just diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr index bda6ca8d7878e1409516edf2df06e5436e8931b3..a97c900e9105e664d1ca008550915195eb71633d 100644 --- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { DumpParsedAst.hs:4:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { DumpParsedAst.hs:4:22-26 }))] [] + [] (Just ((,) { DumpParsedAst.hs:26:1 } @@ -228,7 +229,10 @@ (EpaComments [])) (HsListTy - (AnnParen AnnParensSquare (EpaSpan { DumpParsedAst.hs:9:16 }) (EpaSpan { DumpParsedAst.hs:9:18 })) + (AnnParen + AnnParensSquare + (EpaSpan { DumpParsedAst.hs:9:16 }) + (EpaSpan { DumpParsedAst.hs:9:18 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:9:17 }) @@ -315,7 +319,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:11:10 }) (EpaSpan { DumpParsedAst.hs:11:17 })) + (AnnParen + AnnParens + (EpaSpan { DumpParsedAst.hs:11:10 }) + (EpaSpan { DumpParsedAst.hs:11:17 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:11:11-16 }) @@ -410,7 +417,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:11:26 }) (EpaSpan { DumpParsedAst.hs:11:36 })) + (AnnParen + AnnParens + (EpaSpan { DumpParsedAst.hs:11:26 }) + (EpaSpan { DumpParsedAst.hs:11:36 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:11:27-35 }) @@ -555,7 +565,10 @@ (EpaComments [])) (HsListTy - (AnnParen AnnParensSquare (EpaSpan { DumpParsedAst.hs:10:27 }) (EpaSpan { DumpParsedAst.hs:10:29 })) + (AnnParen + AnnParensSquare + (EpaSpan { DumpParsedAst.hs:10:27 }) + (EpaSpan { DumpParsedAst.hs:10:29 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:10:28 }) @@ -732,7 +745,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:15:25 }) (EpaSpan { DumpParsedAst.hs:15:29 })) + (AnnParen + AnnParens + (EpaSpan { DumpParsedAst.hs:15:25 }) + (EpaSpan { DumpParsedAst.hs:15:29 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:15:26-28 }) @@ -867,7 +883,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:17:17 }) (EpaSpan { DumpParsedAst.hs:17:27 })) + (AnnParen + AnnParens + (EpaSpan { DumpParsedAst.hs:17:17 }) + (EpaSpan { DumpParsedAst.hs:17:27 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:17:18-26 }) @@ -1460,7 +1479,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:22:22 }) (EpaSpan { DumpParsedAst.hs:22:37 })) + (AnnParen + AnnParens + (EpaSpan { DumpParsedAst.hs:22:22 }) + (EpaSpan { DumpParsedAst.hs:22:37 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:22:23-36 }) @@ -1567,7 +1589,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:22:42 }) (EpaSpan { DumpParsedAst.hs:22:52 })) + (AnnParen + AnnParens + (EpaSpan { DumpParsedAst.hs:22:42 }) + (EpaSpan { DumpParsedAst.hs:22:52 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:22:43-51 }) @@ -1688,7 +1713,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:23:10 }) (EpaSpan { DumpParsedAst.hs:23:34 })) + (AnnParen + AnnParens + (EpaSpan { DumpParsedAst.hs:23:10 }) + (EpaSpan { DumpParsedAst.hs:23:34 })) (L (EpAnn (EpaSpan { DumpParsedAst.hs:23:11-33 }) diff --git a/testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr b/testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr index 6ffa0eaa043f0ecc1802bfd10bb5707a462d0d78..17ee66f5292ac0979c378eba5ddb660c8cb3f70b 100644 --- a/testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr +++ b/testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { DumpParsedAstComments.hs:5:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { DumpParsedAstComments.hs:5:30-34 }))] [] + [] (Just ((,) { DumpParsedAstComments.hs:20:1 } diff --git a/testsuite/tests/parser/should_compile/DumpSemis.stderr b/testsuite/tests/parser/should_compile/DumpSemis.stderr index 06813fabfe1fd1d8b2bd232ab45fb9fb34e6ceaf..12af0facf54d57dd49d26142eb5a6d9a3a1f2593 100644 --- a/testsuite/tests/parser/should_compile/DumpSemis.stderr +++ b/testsuite/tests/parser/should_compile/DumpSemis.stderr @@ -22,6 +22,7 @@ (EpaSpan { DumpSemis.hs:4:7 })) ,(AddSemiAnn (EpaSpan { DumpSemis.hs:4:8 }))] + [] (Just ((,) { DumpSemis.hs:46:1 } diff --git a/testsuite/tests/parser/should_compile/KindSigs.stderr b/testsuite/tests/parser/should_compile/KindSigs.stderr index f336dda4c54ef4fdd42e0117f242afb1d31e71e4..f73e7fcea48b1f87aca99fd6d8e8e936501961e9 100644 --- a/testsuite/tests/parser/should_compile/KindSigs.stderr +++ b/testsuite/tests/parser/should_compile/KindSigs.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { KindSigs.hs:6:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { KindSigs.hs:6:17-21 }))] [] + [] (Just ((,) { KindSigs.hs:36:1 } diff --git a/testsuite/tests/parser/should_compile/T15323.stderr b/testsuite/tests/parser/should_compile/T15323.stderr index e840115848add5356a7002ebf7ecdfd16b72b4df..d193c1e41769f796184eb4c4e54e98d14d787159 100644 --- a/testsuite/tests/parser/should_compile/T15323.stderr +++ b/testsuite/tests/parser/should_compile/T15323.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T15323.hs:3:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T15323.hs:3:15-19 }))] [] + [] (Just ((,) { T15323.hs:7:1 } @@ -163,7 +164,10 @@ (EpaComments [])) (HsParTy - (AnnParen AnnParens (EpaSpan { T15323.hs:6:31 }) (EpaSpan { T15323.hs:6:36 })) + (AnnParen + AnnParens + (EpaSpan { T15323.hs:6:31 }) + (EpaSpan { T15323.hs:6:36 })) (L (EpAnn (EpaSpan { T15323.hs:6:32-35 }) diff --git a/testsuite/tests/parser/should_compile/T20452.stderr b/testsuite/tests/parser/should_compile/T20452.stderr index 884ab4500a98eaf7698e45edd2747d59f8dcc7c4..f313d998ab1c4f3a40b49fd2d1f137ccafdf59d4 100644 --- a/testsuite/tests/parser/should_compile/T20452.stderr +++ b/testsuite/tests/parser/should_compile/T20452.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T20452.hs:3:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T20452.hs:3:15-19 }))] [] + [] (Just ((,) { T20452.hs:10:1 } @@ -376,7 +377,10 @@ (EpaComments [])) (HsListTy - (AnnParen AnnParensSquare (EpaSpan { T20452.hs:8:57 }) (EpaSpan { T20452.hs:8:74 })) + (AnnParen + AnnParensSquare + (EpaSpan { T20452.hs:8:57 }) + (EpaSpan { T20452.hs:8:74 })) (L (EpAnn (EpaSpan { T20452.hs:8:58-73 }) @@ -385,7 +389,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { T20452.hs:8:58 }) (EpaSpan { T20452.hs:8:73 })) + (AnnParen + AnnParens + (EpaSpan { T20452.hs:8:58 }) + (EpaSpan { T20452.hs:8:73 })) (HsBoxedOrConstraintTuple) [(L (EpAnn @@ -585,7 +592,10 @@ (EpaComments [])) (HsListTy - (AnnParen AnnParensSquare (EpaSpan { T20452.hs:9:57 }) (EpaSpan { T20452.hs:9:74 })) + (AnnParen + AnnParensSquare + (EpaSpan { T20452.hs:9:57 }) + (EpaSpan { T20452.hs:9:74 })) (L (EpAnn (EpaSpan { T20452.hs:9:58-73 }) @@ -594,7 +604,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { T20452.hs:9:58 }) (EpaSpan { T20452.hs:9:73 })) + (AnnParen + AnnParens + (EpaSpan { T20452.hs:9:58 }) + (EpaSpan { T20452.hs:9:73 })) (HsBoxedOrConstraintTuple) [(L (EpAnn diff --git a/testsuite/tests/parser/should_compile/T20718.stderr b/testsuite/tests/parser/should_compile/T20718.stderr index 23d9c9c88d1230723efdacaca2f2ee8268d6fc2f..f2e32d2867dab491158c757f43dca8b72cc63c6e 100644 --- a/testsuite/tests/parser/should_compile/T20718.stderr +++ b/testsuite/tests/parser/should_compile/T20718.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T20718.hs:3:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T20718.hs:3:15-19 }))] [] + [] (Just ((,) { T20718.hs:12:1 } diff --git a/testsuite/tests/parser/should_compile/T20718b.stderr b/testsuite/tests/parser/should_compile/T20718b.stderr index b4c80196bb5f7f16c7159fd5269696077b50d791..7569fdc6cda1173752849c30035dae9f84a995be 100644 --- a/testsuite/tests/parser/should_compile/T20718b.stderr +++ b/testsuite/tests/parser/should_compile/T20718b.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T20718b.hs:4:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T20718b.hs:4:16-20 }))] [] + [] (Just ((,) { T20718b.hs:8:1 } diff --git a/testsuite/tests/parser/should_compile/T20846.stderr b/testsuite/tests/parser/should_compile/T20846.stderr index 535db2237910eab9acbb3e1763a79d241d5f1c4f..11d54ee15861661ab69c6192e00adf3119401ba6 100644 --- a/testsuite/tests/parser/should_compile/T20846.stderr +++ b/testsuite/tests/parser/should_compile/T20846.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T20846.hs:1:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T20846.hs:1:15-19 }))] [] + [] (Just ((,) { T20846.hs:5:1 } diff --git a/testsuite/tests/parser/should_compile/T23315/T23315.stderr b/testsuite/tests/parser/should_compile/T23315/T23315.stderr index e4c265ca2fc29765d60453bfe17adf1f64f7e347..a7613953f206ad2851743a245a066792a077a81d 100644 --- a/testsuite/tests/parser/should_compile/T23315/T23315.stderr +++ b/testsuite/tests/parser/should_compile/T23315/T23315.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnSignature (EpaSpan { T23315.hsig:1:1-9 })) ,(AddEpAnn AnnWhere (EpaSpan { T23315.hsig:1:18-22 }))] [] + [] (Nothing)) (EpaComments [])) @@ -94,7 +95,10 @@ (EpaComments [])) (HsTupleTy - (AnnParen AnnParens (EpaSpan { T23315.hsig:3:6 }) (EpaSpan { T23315.hsig:3:7 })) + (AnnParen + AnnParens + (EpaSpan { T23315.hsig:3:6 }) + (EpaSpan { T23315.hsig:3:7 })) (HsBoxedOrConstraintTuple) [])))))))) ,(L diff --git a/testsuite/tests/printer/AnnotationNoListTuplePuns.hs b/testsuite/tests/printer/AnnotationNoListTuplePuns.hs index 0eb210a8ace84f78bd7c42cfb855ca79e9faf2dc..0e7d257b4baf3b53e7c8d5a8f30918325b803e2c 100644 --- a/testsuite/tests/printer/AnnotationNoListTuplePuns.hs +++ b/testsuite/tests/printer/AnnotationNoListTuplePuns.hs @@ -1,17 +1,18 @@ {-# language NoListTuplePuns #-} +{-# OPTIONS -ddump-parsed-ast #-} module AnnotationNoListTuplePuns where type A = - -- comment pre + -- comment pre A [ - -- comment inside + -- comment inside A ] - -- comment post + -- comment post A type B = - -- comment pre + -- comment pre B [ - -- comment inside + -- comment inside B Bool ] - -- comment post + -- comment post B diff --git a/testsuite/tests/printer/AnnotationNoListTuplePuns.stdout b/testsuite/tests/printer/AnnotationNoListTuplePuns.stdout new file mode 100644 index 0000000000000000000000000000000000000000..f51af8cfe217585f29dd37a43e34f490e756efce --- /dev/null +++ b/testsuite/tests/printer/AnnotationNoListTuplePuns.stdout @@ -0,0 +1,323 @@ + +==================== Parser AST ==================== + +(L + { AnnotationNoListTuplePuns.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { AnnotationNoListTuplePuns.hs:3:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { AnnotationNoListTuplePuns.hs:3:34-38 }))] + [] + [] + (Just + ((,) + { AnnotationNoListTuplePuns.hs:19:1 } + { AnnotationNoListTuplePuns.hs:18:3-19 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { AnnotationNoListTuplePuns.hs:1:1-32 }) + (EpaComment + (EpaBlockComment + "{-# language NoListTuplePuns #-}") + { AnnotationNoListTuplePuns.hs:1:1 })) + ,(L + (EpaSpan + { AnnotationNoListTuplePuns.hs:2:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { AnnotationNoListTuplePuns.hs:1:1-32 }))] + [(L + (EpaSpan + { AnnotationNoListTuplePuns.hs:18:3-19 }) + (EpaComment + (EpaLineComment + "-- comment post B") + { AnnotationNoListTuplePuns.hs:17:3 }))])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:3:8-32 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: AnnotationNoListTuplePuns})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:(5,1)-(9,3) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { AnnotationNoListTuplePuns.hs:6:3-18 }) + (EpaComment + (EpaLineComment + "-- comment pre A") + { AnnotationNoListTuplePuns.hs:5:8 }))])) + (TyClD + (NoExtField) + (SynDecl + [(AddEpAnn AnnType (EpaSpan { AnnotationNoListTuplePuns.hs:5:1-4 })) + ,(AddEpAnn AnnEqual (EpaSpan { AnnotationNoListTuplePuns.hs:5:8 }))] + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:5:6 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: A})) + (HsQTvs + (NoExtField) + []) + (Prefix) + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:(7,3)-(9,3) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { AnnotationNoListTuplePuns.hs:8:5-23 }) + (EpaComment + (EpaLineComment + "-- comment inside A") + { AnnotationNoListTuplePuns.hs:7:3 }))])) + (HsExplicitListTy + [(AddEpAnn AnnOpenS (EpaSpan { AnnotationNoListTuplePuns.hs:7:3 })) + ,(AddEpAnn AnnCloseS (EpaSpan { AnnotationNoListTuplePuns.hs:9:3 }))] + (NotPromoted) + []))))) + ,(L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:(12,1)-(17,3) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { AnnotationNoListTuplePuns.hs:10:3-19 }) + (EpaComment + (EpaLineComment + "-- comment post A") + { AnnotationNoListTuplePuns.hs:9:3 })) + ,(L + (EpaSpan + { AnnotationNoListTuplePuns.hs:13:3-18 }) + (EpaComment + (EpaLineComment + "-- comment pre B") + { AnnotationNoListTuplePuns.hs:12:8 }))])) + (TyClD + (NoExtField) + (SynDecl + [(AddEpAnn AnnType (EpaSpan { AnnotationNoListTuplePuns.hs:12:1-4 })) + ,(AddEpAnn AnnEqual (EpaSpan { AnnotationNoListTuplePuns.hs:12:8 }))] + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:12:6 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: B})) + (HsQTvs + (NoExtField) + []) + (Prefix) + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:(14,3)-(17,3) }) + (AnnListItem + []) + (EpaComments + [(L + (EpaSpan + { AnnotationNoListTuplePuns.hs:15:5-23 }) + (EpaComment + (EpaLineComment + "-- comment inside B") + { AnnotationNoListTuplePuns.hs:14:3 }))])) + (HsExplicitListTy + [(AddEpAnn AnnOpenS (EpaSpan { AnnotationNoListTuplePuns.hs:14:3 })) + ,(AddEpAnn AnnCloseS (EpaSpan { AnnotationNoListTuplePuns.hs:17:3 }))] + (NotPromoted) + [(L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:16:5-8 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.hs:16:5-8 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Bool}))))])))))])) + + + +==================== Parser AST ==================== + +(L + { AnnotationNoListTuplePuns.ppr.hs:1:1 } + (HsModule + (XModulePs + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:1:1 }) + (AnnsModule + [(AddEpAnn AnnModule (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:3:1-6 })) + ,(AddEpAnn AnnWhere (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:3:34-38 }))] + [] + [] + (Just + ((,) + { AnnotationNoListTuplePuns.ppr.hs:5:16 } + { AnnotationNoListTuplePuns.ppr.hs:5:15 }))) + (EpaCommentsBalanced + [(L + (EpaSpan + { AnnotationNoListTuplePuns.ppr.hs:1:1-32 }) + (EpaComment + (EpaBlockComment + "{-# language NoListTuplePuns #-}") + { AnnotationNoListTuplePuns.ppr.hs:1:1 })) + ,(L + (EpaSpan + { AnnotationNoListTuplePuns.ppr.hs:2:1-33 }) + (EpaComment + (EpaBlockComment + "{-# OPTIONS -ddump-parsed-ast #-}") + { AnnotationNoListTuplePuns.ppr.hs:1:1-32 }))] + [])) + (EpVirtualBraces + (1)) + (Nothing) + (Nothing)) + (Just + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:3:8-32 }) + (AnnListItem + []) + (EpaComments + [])) + {ModuleName: AnnotationNoListTuplePuns})) + (Nothing) + [] + [(L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:4:1-11 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (SynDecl + [(AddEpAnn AnnType (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:4:1-4 })) + ,(AddEpAnn AnnEqual (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:4:8 }))] + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:4:6 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: A})) + (HsQTvs + (NoExtField) + []) + (Prefix) + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:4:10-11 }) + (AnnListItem + []) + (EpaComments + [])) + (HsExplicitListTy + [(AddEpAnn AnnOpenS (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:4:10 })) + ,(AddEpAnn AnnCloseS (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:4:11 }))] + (NotPromoted) + []))))) + ,(L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:5:1-15 }) + (AnnListItem + []) + (EpaComments + [])) + (TyClD + (NoExtField) + (SynDecl + [(AddEpAnn AnnType (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:5:1-4 })) + ,(AddEpAnn AnnEqual (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:5:8 }))] + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:5:6 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: B})) + (HsQTvs + (NoExtField) + []) + (Prefix) + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:5:10-15 }) + (AnnListItem + []) + (EpaComments + [])) + (HsExplicitListTy + [(AddEpAnn AnnOpenS (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:5:10 })) + ,(AddEpAnn AnnCloseS (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:5:15 }))] + (NotPromoted) + [(L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:5:11-14 }) + (AnnListItem + []) + (EpaComments + [])) + (HsTyVar + [] + (NotPromoted) + (L + (EpAnn + (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:5:11-14 }) + (NameAnnTrailing + []) + (EpaComments + [])) + (Unqual + {OccName: Bool}))))])))))])) + + diff --git a/testsuite/tests/printer/T18791.stderr b/testsuite/tests/printer/T18791.stderr index 95df4dda5d7a6e11e74595b638bd56f9be72b1a7..451b2a591e5ccab5489f9cc3106df3bb1fdd9b63 100644 --- a/testsuite/tests/printer/T18791.stderr +++ b/testsuite/tests/printer/T18791.stderr @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { T18791.hs:2:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { T18791.hs:2:15-19 }))] [] + [] (Just ((,) { T18791.hs:6:1 } diff --git a/testsuite/tests/printer/Test20297.stdout b/testsuite/tests/printer/Test20297.stdout index f52290b5c33f902cdf4f9473b51eda3051e6ed0a..64c78e96fc7da4e6540d89f984d066dcd81c7923 100644 --- a/testsuite/tests/printer/Test20297.stdout +++ b/testsuite/tests/printer/Test20297.stdout @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { Test20297.hs:2:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { Test20297.hs:2:18-22 }))] [] + [] (Just ((,) { Test20297.hs:12:1 } @@ -418,6 +419,7 @@ [(AddEpAnn AnnModule (EpaSpan { Test20297.ppr.hs:2:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { Test20297.ppr.hs:2:18-22 }))] [] + [] (Just ((,) { Test20297.ppr.hs:9:25 } diff --git a/testsuite/tests/printer/Test24533.stdout b/testsuite/tests/printer/Test24533.stdout index aaa556bb58a82abbb5315de5a3b2ac3e20c6eefd..4a0fb2ae7d088da3fce3d59be203fb60a4607f89 100644 --- a/testsuite/tests/printer/Test24533.stdout +++ b/testsuite/tests/printer/Test24533.stdout @@ -11,6 +11,7 @@ [(AddEpAnn AnnModule (EpaSpan { Test24533.hs:2:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:2:18-22 }))] [] + [] (Just ((,) { Test24533.hs:17:1 } @@ -643,6 +644,7 @@ [(AddEpAnn AnnModule (EpaSpan { Test24533.ppr.hs:2:1-6 })) ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:2:18-22 }))] [] + [] (Just ((,) { Test24533.ppr.hs:6:20 } diff --git a/testsuite/tests/rename/should_fail/T17594b.stderr b/testsuite/tests/rename/should_fail/T17594b.stderr index e74145f6f0a09ad42788bc0b9e58a36b7fd877fa..5682c42ffb151695659ec5f01c652d6099a87c38 100644 --- a/testsuite/tests/rename/should_fail/T17594b.stderr +++ b/testsuite/tests/rename/should_fail/T17594b.stderr @@ -1,84 +1,84 @@ -T17594b.hs:7:6: error: [GHC-78249] +T17594b.hs:7:5: error: [GHC-78249] Illegal invisible type pattern: t Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:10:6: error: [GHC-78249] +T17594b.hs:10:5: error: [GHC-78249] Illegal invisible type pattern: t Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:14:6: error: [GHC-78249] +T17594b.hs:14:5: error: [GHC-78249] Illegal invisible type pattern: t Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:17:6: error: [GHC-78249] +T17594b.hs:17:5: error: [GHC-78249] Illegal invisible type pattern: t1 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:17:10: error: [GHC-78249] +T17594b.hs:17:9: error: [GHC-78249] Illegal invisible type pattern: t2 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:17:14: error: [GHC-78249] +T17594b.hs:17:13: error: [GHC-78249] Illegal invisible type pattern: t3 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:17:27: error: [GHC-78249] +T17594b.hs:17:26: error: [GHC-78249] Illegal invisible type pattern: t4 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:17:31: error: [GHC-78249] +T17594b.hs:17:30: error: [GHC-78249] Illegal invisible type pattern: t5 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:17:35: error: [GHC-78249] +T17594b.hs:17:34: error: [GHC-78249] Illegal invisible type pattern: t6 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:20:11: error: [GHC-78249] +T17594b.hs:20:10: error: [GHC-78249] Illegal invisible type pattern: t Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:22:20: error: [GHC-78249] +T17594b.hs:22:19: error: [GHC-78249] Illegal invisible type pattern: t Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:25:10: error: [GHC-78249] +T17594b.hs:25:9: error: [GHC-78249] Illegal invisible type pattern: t Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:28:6: error: [GHC-78249] +T17594b.hs:28:5: error: [GHC-78249] Illegal invisible type pattern: t1 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:28:10: error: [GHC-78249] +T17594b.hs:28:9: error: [GHC-78249] Illegal invisible type pattern: t2 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:28:32: error: [GHC-78249] +T17594b.hs:28:31: error: [GHC-78249] Illegal invisible type pattern: t3 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:28:58: error: [GHC-78249] +T17594b.hs:28:57: error: [GHC-78249] Illegal invisible type pattern: t4 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:28:62: error: [GHC-78249] +T17594b.hs:28:61: error: [GHC-78249] Illegal invisible type pattern: t5 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:28:71: error: [GHC-78249] +T17594b.hs:28:70: error: [GHC-78249] Illegal invisible type pattern: t6 Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:31:11: error: [GHC-78249] +T17594b.hs:31:10: error: [GHC-78249] Illegal invisible type pattern: t Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:34:11: error: [GHC-78249] +T17594b.hs:34:10: error: [GHC-78249] Illegal invisible type pattern: t Suggested fix: Perhaps you intended to use TypeAbstractions -T17594b.hs:37:7: error: [GHC-78249] +T17594b.hs:37:6: error: [GHC-78249] Illegal invisible type pattern: ($(TH.varT (TH.mkName "t"))) Suggested fix: Perhaps you intended to use TypeAbstractions diff --git a/testsuite/tests/typecheck/should_fail/T17594c.stderr b/testsuite/tests/typecheck/should_fail/T17594c.stderr index 878f9393558dd6cd6312885551b05b9a30995a94..bda3ad39be516c566a2a8796cf009dfa3cd57e13 100644 --- a/testsuite/tests/typecheck/should_fail/T17594c.stderr +++ b/testsuite/tests/typecheck/should_fail/T17594c.stderr @@ -1,5 +1,5 @@ -T17594c.hs:5:11: error: [GHC-14964] +T17594c.hs:5:10: error: [GHC-14964] • Invisible type pattern t has no associated forall • In the expression: \ @t -> undefined :: t In the expression: [\ @t -> undefined :: t] diff --git a/testsuite/tests/typecheck/should_fail/T17594d.stderr b/testsuite/tests/typecheck/should_fail/T17594d.stderr index c9917d917659f671d046f166081e5f3178d7ef5a..178ec3cd4f54d866df429b9dbb3f7e783882e3dd 100644 --- a/testsuite/tests/typecheck/should_fail/T17594d.stderr +++ b/testsuite/tests/typecheck/should_fail/T17594d.stderr @@ -1,4 +1,4 @@ -T17594d.hs:8:6: error: [GHC-14964] +T17594d.hs:8:5: error: [GHC-14964] • Invisible type pattern t has no associated forall • In an equation for ‘id'’: id' @t x = x :: t diff --git a/testsuite/tests/typecheck/should_fail/T17594g.stderr b/testsuite/tests/typecheck/should_fail/T17594g.stderr index f070c722215e542eb87dcf53acdb40912466b4d0..8ecba0854278eb7babe6cf2dcfdd83efd1eedc1f 100644 --- a/testsuite/tests/typecheck/should_fail/T17594g.stderr +++ b/testsuite/tests/typecheck/should_fail/T17594g.stderr @@ -1,4 +1,4 @@ -T17594g.hs:6:6: error: [GHC-14964] +T17594g.hs:6:5: error: [GHC-14964] • Invisible type pattern a has no associated forall • In an equation for ‘id'’: id' @a x = x diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index dee1b4f17df35ce2720fea79ef332741ead947ab..45d2e57a853582b0c26387cb0c8f5680f7274ada 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -652,6 +652,10 @@ printSourceText :: (Monad m, Monoid w) => SourceText -> String -> EP w m () printSourceText (NoSourceText) txt = printStringAdvance txt >> return () printSourceText (SourceText txt) _ = printStringAdvance (unpackFS txt) >> return () +printSourceTextAA :: (Monad m, Monoid w) => SourceText -> String -> EP w m () +printSourceTextAA (NoSourceText) txt = printStringAtAA (EpaDelta (SameLine 0) []) txt >> return () +printSourceTextAA (SourceText txt) _ = printStringAtAA (EpaDelta (SameLine 0) []) (unpackFS txt) >> return () + -- --------------------------------------------------------------------- printStringAtSs :: (Monad m, Monoid w) => SrcSpan -> String -> EP w m () @@ -961,8 +965,10 @@ lepa k epAnn = fmap (\newAnns -> epAnn { anns = newAnns }) -- data AnnsModule -- = AnnsModule { --- am_main :: [AddEpAnn], --- am_decls :: AnnList +-- am_main :: [AddEpAnn], +-- am_decls :: [TrailingAnn], +-- am_cs :: [LEpaComment], +-- am_eof :: Maybe (RealSrcSpan, RealSrcSpan) -- } deriving (Data, Eq) lam_main :: Lens AnnsModule [AddEpAnn] @@ -2119,7 +2125,7 @@ instance ExactPrint StringLiteral where setAnnotationAnchor a _ _ _ = a exact (StringLiteral src fs mcomma) = do - printSourceText src (show (unpackFS fs)) + printSourceTextAA src (show (unpackFS fs)) mcomma' <- mapM (\r -> printStringAtNC r ",") mcomma return (StringLiteral src fs mcomma')