[Git][ghc/ghc][wip/az/epa-hslet-tokens] EPA: Moving non-token annotations out of HsIPVar, HsOverLit, HsLit

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Thu Dec 7 21:03:18 UTC 2023



Alan Zimmerman pushed to branch wip/az/epa-hslet-tokens at Glasgow Haskell Compiler / GHC


Commits:
6058c011 by Alan Zimmerman at 2023-12-07T21:01:15+00:00
EPA: Moving non-token annotations out of HsIPVar, HsOverLit, HsLit

- - - - -


25 changed files:

- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/TyCl/PatSyn.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/ThToHs.hs
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr
- testsuite/tests/parser/should_compile/T20718.stderr
- testsuite/tests/plugins/hooks-plugin/Hooks/MetaPlugin.hs
- utils/check-exact/ExactPrint.hs


Changes:

=====================================
compiler/GHC/Hs/Expr.hs
=====================================
@@ -128,7 +128,7 @@ data SyntaxExprTc = SyntaxExprTc { syn_expr      :: HsExpr GhcTc
 -- | This is used for rebindable-syntax pieces that are too polymorphic
 -- for tcSyntaxOp (trS_fmap and the mzip in ParStmt)
 noExpr :: HsExpr (GhcPass p)
-noExpr = HsLit noComments (HsString (SourceText $ fsLit "noExpr") (fsLit "noExpr"))
+noExpr = HsLit noExtField (HsString (SourceText $ fsLit "noExpr") (fsLit "noExpr"))
 
 noSyntaxExpr :: forall p. IsPass p => SyntaxExpr (GhcPass p)
                               -- Before renaming, and sometimes after
@@ -227,7 +227,7 @@ type instance XOverLabel     GhcTc = DataConCantHappen
 
 type instance XVar           (GhcPass _) = NoExtField
 
-type instance XUnboundVar    GhcPs = EpAnn (Maybe EpAnnUnboundVar)
+type instance XUnboundVar    GhcPs = Maybe EpAnnUnboundVar
 type instance XUnboundVar    GhcRn = NoExtField
 type instance XUnboundVar    GhcTc = HoleExprRef
   -- We really don't need the whole HoleExprRef; just the IORef EvTerm
@@ -235,11 +235,11 @@ type instance XUnboundVar    GhcTc = HoleExprRef
   -- Much, much easier just to define HoleExprRef with a Data instance and
   -- store the whole structure.
 
-type instance XIPVar         GhcPs = EpAnnCO
-type instance XIPVar         GhcRn = EpAnnCO
+type instance XIPVar         GhcPs = NoExtField
+type instance XIPVar         GhcRn = NoExtField
 type instance XIPVar         GhcTc = DataConCantHappen
-type instance XOverLitE      (GhcPass _) = EpAnnCO
-type instance XLitE          (GhcPass _) = EpAnnCO
+type instance XOverLitE      (GhcPass _) = NoExtField
+type instance XLitE          (GhcPass _) = NoExtField
 type instance XLam           (GhcPass _) = EpAnn [AddEpAnn]
 type instance XApp           (GhcPass _) = EpAnnCO
 


=====================================
compiler/GHC/Hs/Utils.hs
=====================================
@@ -513,10 +513,10 @@ nlHsDataCon :: DataCon -> LHsExpr GhcTc
 nlHsDataCon con = noLocA (mkConLikeTc (RealDataCon con))
 
 nlHsLit :: HsLit (GhcPass p) -> LHsExpr (GhcPass p)
-nlHsLit n = noLocA (HsLit noComments n)
+nlHsLit n = noLocA (HsLit noExtField n)
 
 nlHsIntLit :: Integer -> LHsExpr (GhcPass p)
-nlHsIntLit n = noLocA (HsLit noComments (HsInt noExtField (mkIntegralLit n)))
+nlHsIntLit n = noLocA (HsLit noExtField (HsInt noExtField (mkIntegralLit n)))
 
 nlVarPat :: IsSrcSpanAnn p a
         => IdP (GhcPass p) -> LPat (GhcPass p)


=====================================
compiler/GHC/Parser.y
=====================================
@@ -2957,11 +2957,11 @@ aexp2   :: { ECP }
         : qvar                          { ECP $ mkHsVarPV $! $1 }
         | qcon                          { ECP $ mkHsVarPV $! $1 }
         -- See Note [%shift: aexp2 -> ipvar]
-        | ipvar %shift                  {% acsExpr (\cs -> sL1a $1 (HsIPVar (comment (glRR $1) cs) $! unLoc $1)) }
-        -- | overloaded_label              {% acsExpr (\cs -> sL1a $1 (HsOverLabel (comment (glRR $1) cs) (fst $! unLoc $1) (snd $! unLoc $1))) }
+        | ipvar %shift                  {% fmap ecpFromExp
+                                           (ams1 $1 (HsIPVar NoExtField $! unLoc $1)) }
         | overloaded_label              {% fmap ecpFromExp
                                            (ams1 $1 (HsOverLabel NoExtField (fst $! unLoc $1) (snd $! unLoc $1))) }
-        | literal                       { ECP $ pvA (mkHsLitPV $! $1) }
+        | literal                       { ECP $ mkHsLitPV $! $1 }
 -- This will enable overloaded strings permanently.  Normally the renamer turns HsString
 -- into HsOverLit when -XOverloadedStrings is on.
 --      | STRING    { sL (getLoc $1) (HsOverLit $! mkHsIsString (getSTRINGs $1)
@@ -3760,16 +3760,15 @@ varop   :: { LocatedN RdrName }
 qop     :: { forall b. DisambInfixOp b => PV (LocatedN b) }   -- used in sections
         : qvarop                { mkHsVarOpPV $1 }
         | qconop                { mkHsConOpPV $1 }
-        | hole_op               { pvN $1 }
+        | hole_op               { mkHsInfixHolePV $1 }
 
 qopm    :: { forall b. DisambInfixOp b => PV (LocatedN b) }   -- used in sections
         : qvaropm               { mkHsVarOpPV $1 }
         | qconop                { mkHsConOpPV $1 }
-        | hole_op               { pvN $1 }
+        | hole_op               { mkHsInfixHolePV $1 }
 
-hole_op :: { forall b. DisambInfixOp b => PV (Located b) }   -- used in sections
-hole_op : '`' '_' '`'           { mkHsInfixHolePV (comb2 $1 $>)
-                                         (\cs -> EpAnn (glEE $1 $>) (Just $ EpAnnUnboundVar (glAA $1, glAA $3) (glAA $2)) cs) }
+hole_op :: { LocatedN (HsExpr GhcPs) }   -- used in sections
+hole_op : '`' '_' '`'           { sLLa $1 $> (hsHoleExpr (Just $ EpAnnUnboundVar (glAA $1, glAA $3) (glAA $2))) }
 
 qvarop :: { LocatedN RdrName }
         : qvarsym               { $1 }
@@ -4416,9 +4415,9 @@ pvA :: (MonadP m, NoAnn t) => m (Located a) -> m (LocatedAn t a)
 pvA a = do { av <- a
            ; return (reLoc av) }
 
-pvN :: MonadP m => m (Located a) -> m (LocatedN a)
+pvN :: MonadP m => m (LocatedN a) -> m (LocatedN a)
 pvN a = do { (L l av) <- a
-           ; return (L (noAnnSrcSpan l) av) }
+           ; return (L l av) }
 
 pvL :: MonadP m => m (LocatedAn t a) -> m (Located a)
 pvL a = do { av <- a


=====================================
compiler/GHC/Parser/Annotation.hs
=====================================
@@ -1088,8 +1088,11 @@ instance (HasLoc a) => (HasLoc (Maybe a)) where
   getHasLoc Nothing = noSrcSpan
 
 instance HasLoc (EpAnn a) where
-  getHasLoc (EpAnn (EpaSpan l) _ _) = l
-  getHasLoc (EpAnn (EpaDelta _ _) _ _) = noSrcSpan
+  getHasLoc (EpAnn l _ _) = getHasLoc l
+
+instance HasLoc EpaLocation where
+  getHasLoc (EpaSpan l) = l
+  getHasLoc (EpaDelta _ _) = noSrcSpan
 
 getHasLocList :: HasLoc a => [a] -> SrcSpan
 getHasLocList [] = noSrcSpan


=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -109,6 +109,7 @@ module GHC.Parser.PostProcess (
         ecpFromExp,
         ecpFromCmd,
         PatBuilder,
+        hsHoleExpr,
 
         -- Type/datacon ambiguity resolution
         DisambTD(..),
@@ -1519,19 +1520,17 @@ type Fbind b = Either (LHsRecField GhcPs (LocatedA b)) (LHsRecProj GhcPs (Locate
 class DisambInfixOp b where
   mkHsVarOpPV :: LocatedN RdrName -> PV (LocatedN b)
   mkHsConOpPV :: LocatedN RdrName -> PV (LocatedN b)
-  mkHsInfixHolePV :: SrcSpan -> (EpAnnComments -> EpAnn (Maybe EpAnnUnboundVar)) -> PV (Located b)
+  mkHsInfixHolePV :: LocatedN (HsExpr GhcPs) -> PV (LocatedN b)
 
 instance DisambInfixOp (HsExpr GhcPs) where
   mkHsVarOpPV v = return $ L (getLoc v) (HsVar noExtField v)
   mkHsConOpPV v = return $ L (getLoc v) (HsVar noExtField v)
-  mkHsInfixHolePV l ann = do
-    cs <- getCommentsFor l
-    return $ L l (hsHoleExpr (ann cs))
+  mkHsInfixHolePV h = return h
 
 instance DisambInfixOp RdrName where
   mkHsConOpPV (L l v) = return $ L l v
   mkHsVarOpPV (L l v) = return $ L l v
-  mkHsInfixHolePV l _ = addFatalError $ mkPlainErrorMsgEnvelope l $ PsErrInvalidInfixHole
+  mkHsInfixHolePV (L l _) = addFatalError $ mkPlainErrorMsgEnvelope (getHasLoc l) $ PsErrInvalidInfixHole
 
 type AnnoBody b
   = ( Anno (GRHS GhcPs (LocatedA (Body b GhcPs))) ~ EpAnn NoEpAnns
@@ -1608,7 +1607,7 @@ class (b ~ (Body b) GhcPs, AnnoBody b) => DisambECP b where
   -- | Disambiguate a variable "f" or a data constructor "MkF".
   mkHsVarPV :: LocatedN RdrName -> PV (LocatedA b)
   -- | Disambiguate a monomorphic literal
-  mkHsLitPV :: Located (HsLit GhcPs) -> PV (Located b)
+  mkHsLitPV :: Located (HsLit GhcPs) -> PV (LocatedA b)
   -- | Disambiguate an overloaded literal
   mkHsOverLitPV :: LocatedAn a (HsOverLit GhcPs) -> PV (LocatedAn a b)
   -- | Disambiguate a wildcard
@@ -1828,13 +1827,15 @@ instance DisambECP (HsExpr GhcPs) where
   mkHsParPV l lpar e rpar = do
     cs <- getCommentsFor l
     return $ L (EpAnn (spanAsAnchor l) noAnn cs) (HsPar (lpar, rpar) e)
-  mkHsVarPV v@(L l _) = return $ L (l2l l) (HsVar noExtField v)
+  mkHsVarPV v@(L l@(EpAnn anc _ _) _) = do
+    cs <- getCommentsFor (getHasLoc l)
+    return $ L (EpAnn anc noAnn cs) (HsVar noExtField v)
   mkHsLitPV (L l a) = do
     cs <- getCommentsFor l
-    return $ L l (HsLit (comment (realSrcSpan l) cs) a)
-  mkHsOverLitPV (L l a) = do
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) (HsLit noExtField a)
+  mkHsOverLitPV (L (EpAnn l an csIn) a) = do
     cs <- getCommentsFor (locA l)
-    return $ L l (HsOverLit (comment (realSrcSpan (locA l)) cs) a)
+    return $ L (EpAnn  l an (cs Semi.<> csIn)) (HsOverLit NoExtField a)
   mkHsWildCardPV l = return $ L l (hsHoleExpr noAnn)
   mkHsTySigPV l a sig anns = do
     cs <- getCommentsFor (locA l)
@@ -1874,7 +1875,7 @@ instance DisambECP (HsExpr GhcPs) where
                                                          (PsErrUnallowedPragma prag)
   rejectPragmaPV _                        = return ()
 
-hsHoleExpr :: EpAnn (Maybe EpAnnUnboundVar) -> HsExpr GhcPs
+hsHoleExpr :: Maybe EpAnnUnboundVar -> HsExpr GhcPs
 hsHoleExpr anns = HsUnboundVar anns (mkRdrUnqual (mkVarOccFS (fsLit "_")))
 
 instance DisambECP (PatBuilder GhcPs) where
@@ -1906,7 +1907,8 @@ instance DisambECP (PatBuilder GhcPs) where
   mkHsVarPV v@(getLoc -> l) = return $ L (l2l l) (PatBuilderVar v)
   mkHsLitPV lit@(L l a) = do
     checkUnboxedLitPat lit
-    return $ L l (PatBuilderPat (LitPat noExtField a))
+    cs <- getCommentsFor l
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) (PatBuilderPat (LitPat noExtField a))
   mkHsOverLitPV (L l a) = return $ L l (PatBuilderOverLit a)
   mkHsWildCardPV l = return $ L l (PatBuilderPat (WildPat noExtField))
   mkHsTySigPV l b sig anns = do


=====================================
compiler/GHC/Rename/Splice.hs
=====================================
@@ -397,7 +397,7 @@ mkQuasiQuoteExpr flavour quoter (L q_span' quote)
   where
     q_span = noAnnSrcSpan (locA q_span')
     quoterExpr = L q_span $! HsVar noExtField $! (L (l2l q_span) quoter)
-    quoteExpr  = L q_span $! HsLit noComments $! HsString NoSourceText quote
+    quoteExpr  = L q_span $! HsLit noExtField $! HsString NoSourceText quote
     quote_selector = case flavour of
                        UntypedExpSplice  -> quoteExpName
                        UntypedPatSplice  -> quotePatName


=====================================
compiler/GHC/Rename/Utils.hs
=====================================
@@ -743,7 +743,7 @@ genAppType :: HsExpr GhcRn -> HsType (NoGhcTc GhcRn) -> HsExpr GhcRn
 genAppType expr ty = HsAppType noExtField (wrapGenSpan expr) (mkEmptyWildCardBndrs (wrapGenSpan ty))
 
 genLHsLit :: (NoAnn an) => HsLit GhcRn -> LocatedAn an (HsExpr GhcRn)
-genLHsLit = wrapGenSpan . HsLit noAnn
+genLHsLit = wrapGenSpan . HsLit noExtField
 
 genHsIntegralLit :: (NoAnn an) => IntegralLit -> LocatedAn an (HsExpr GhcRn)
 genHsIntegralLit = genLHsLit . HsInt noExtField


=====================================
compiler/GHC/Tc/Deriv/Generate.hs
=====================================
@@ -515,7 +515,7 @@ gen_Ord_binds loc dit@(DerivInstTys{ dit_rep_tc = tycon
       where
         tag     = get_tag data_con
         tag_lit
-             = noLocA (HsLit noComments (HsIntPrim NoSourceText (toInteger tag)))
+             = noLocA (HsLit noExtField (HsIntPrim NoSourceText (toInteger tag)))
 
     mkInnerEqAlt :: OrdOp -> DataCon -> LMatch GhcPs (LHsExpr GhcPs)
     -- First argument 'a' known to be built with K


=====================================
compiler/GHC/Tc/Gen/Expr.hs
=====================================
@@ -212,7 +212,7 @@ tcExpr e@(HsOverLit _ lit) res_ty
   = do { mb_res <- tcShortCutLit lit res_ty
          -- See Note [Short cut for overloaded literals] in GHC.Tc.Zonk.Type
        ; case mb_res of
-           Just lit' -> return (HsOverLit noAnn lit')
+           Just lit' -> return (HsOverLit noExtField lit')
            Nothing   -> tcApp e res_ty }
 
 -- Typecheck an occurrence of an unbound Id


=====================================
compiler/GHC/Tc/Gen/Head.hs
=====================================
@@ -1077,21 +1077,21 @@ tcInferOverLit lit@(OverLit { ol_val = val
        ; let
            thing    = NameThing from_name
            mb_thing = Just thing
-           herald   = ExpectedFunTyArg thing (HsLit noAnn hs_lit)
+           herald   = ExpectedFunTyArg thing (HsLit noExtField hs_lit)
        ; (wrap2, sarg_ty, res_ty) <- matchActualFunTySigma herald mb_thing
                                                            (1, []) from_ty
 
        ; co <- unifyType mb_thing (hsLitType hs_lit) (scaledThing sarg_ty)
        -- See Note [Source locations for implicit function calls] in GHC.Iface.Ext.Ast
        ; let lit_expr = L (l2l loc) $ mkHsWrapCo co $
-                        HsLit noAnn hs_lit
+                        HsLit noExtField hs_lit
              from_expr = mkHsWrap (wrap2 <.> wrap1) $
                          HsVar noExtField (L loc from_id)
              witness = HsApp noAnn (L (l2l loc) from_expr) lit_expr
              lit' = lit { ol_ext = OverLitTc { ol_rebindable = rebindable
                                              , ol_witness = witness
                                              , ol_type = res_ty } }
-       ; return (HsOverLit noAnn lit', res_ty) }
+       ; return (HsOverLit noExtField lit', res_ty) }
 
 {- *********************************************************************
 *                                                                      *


=====================================
compiler/GHC/Tc/Gen/Splice.hs
=====================================
@@ -971,7 +971,7 @@ stubNestedSplice :: HsExpr GhcTc
 -- do a debug-print.  The warning is because this should never happen
 -- /except/ when doing debug prints.
 stubNestedSplice = warnPprTrace True "stubNestedSplice" empty $
-                   HsLit noComments (mkHsString "stubNestedSplice")
+                   HsLit noExtField (mkHsString "stubNestedSplice")
 
 
 {-


=====================================
compiler/GHC/Tc/TyCl/Instance.hs
=====================================
@@ -1875,7 +1875,7 @@ tcMethods skol_info dfun_id clas tyvars dfun_ev_vars inst_tys
                                 [ getRuntimeRep meth_tau, meth_tau])
                               nO_METHOD_BINDING_ERROR_ID
         error_msg dflags = L inst_loc'
-                                    (HsLit noComments (HsStringPrim NoSourceText
+                                    (HsLit noExtField (HsStringPrim NoSourceText
                                               (unsafeMkByteString (error_string dflags))))
         meth_tau     = classMethodInstTy sel_id inst_tys
         error_string dflags = showSDoc dflags


=====================================
compiler/GHC/Tc/TyCl/PatSyn.hs
=====================================
@@ -1042,12 +1042,12 @@ tcPatToExpr args pat = go pat
                                          ; return $ ExplicitSum noExtField alt arity
                                                                    (noLocA expr)
                                          }
-    go1 (LitPat _ lit)              = return $ HsLit noComments lit
+    go1 (LitPat _ lit)              = return $ HsLit noExtField lit
     go1 (NPat _ (L _ n) mb_neg _)
         | Just (SyntaxExprRn neg) <- mb_neg
                                     = return $ unLoc $ foldl' nlHsApp (noLocA neg)
-                                                       [noLocA (HsOverLit noAnn n)]
-        | otherwise                 = return $ HsOverLit noAnn n
+                                                       [noLocA (HsOverLit noExtField n)]
+        | otherwise                 = return $ HsOverLit noExtField n
     go1 (SplicePat (HsUntypedSpliceTop _ pat) _) = go1 pat
     go1 (SplicePat (HsUntypedSpliceNested _) _)  = panic "tcPatToExpr: invalid nested splice"
     go1 (EmbTyPat _ tp) = return $ HsEmbTy noExtField (hstp_to_hswc tp)


=====================================
compiler/GHC/Tc/Utils/TcMType.hs
=====================================
@@ -2364,11 +2364,11 @@ shortCutLit platform val res_ty
   where
     go_integral int@(IL src neg i)
       | isIntTy res_ty  && platformInIntRange  platform i
-      = Just (HsLit noAnn (HsInt noExtField int))
+      = Just (HsLit noExtField (HsInt noExtField int))
       | isWordTy res_ty && platformInWordRange platform i
       = Just (mkLit wordDataCon (HsWordPrim src i))
       | isIntegerTy res_ty
-      = Just (HsLit noAnn (HsInteger src i res_ty))
+      = Just (HsLit noExtField (HsInteger src i res_ty))
       | otherwise
       = go_fractional (integralFractionalLit neg i)
         -- The 'otherwise' case is important
@@ -2389,7 +2389,7 @@ shortCutLit platform val res_ty
             -- is less than 100, which ensures desugaring isn't slow.
 
     go_string src s
-      | isStringTy res_ty = Just (HsLit noAnn (HsString src s))
+      | isStringTy res_ty = Just (HsLit noExtField (HsString src s))
       | otherwise         = Nothing
 
 mkLit :: DataCon -> HsLit GhcTc -> HsExpr GhcTc


=====================================
compiler/GHC/ThToHs.hs
=====================================
@@ -1028,9 +1028,9 @@ cvtl e = wrapLA (cvt e)
     cvt (VarE s)   = do { s' <- vName s; wrapParLA (HsVar noExtField) s' }
     cvt (ConE s)   = do { s' <- cName s; wrapParLA (HsVar noExtField) s' }
     cvt (LitE l)
-      | overloadedLit l = go cvtOverLit (HsOverLit noComments)
+      | overloadedLit l = go cvtOverLit (HsOverLit noExtField)
                              (hsOverLitNeedsParens appPrec)
-      | otherwise       = go cvtLit (HsLit noComments)
+      | otherwise       = go cvtLit (HsLit noExtField)
                              (hsLitNeedsParens appPrec)
       where
         go :: (Lit -> CvtM (l GhcPs))
@@ -1090,7 +1090,7 @@ cvtl e = wrapLA (cvt e)
                             ; return $ ArithSeq noAnn Nothing dd' }
     cvt (ListE xs)
       | Just s <- allCharLs xs       = do { l' <- cvtLit (StringL s)
-                                          ; return (HsLit noComments l') }
+                                          ; return (HsLit noExtField l') }
              -- Note [Converting strings]
       | otherwise       = do { xs' <- mapM cvtl xs
                              ; return $ ExplicitList noAnn xs'
@@ -1154,7 +1154,7 @@ cvtl e = wrapLA (cvt e)
                               { s' <- vcName s
                               ; wrapParLA (HsVar noExtField) s' }
     cvt (LabelE s)       = return $ HsOverLabel noExtField NoSourceText (fsLit s)
-    cvt (ImplicitParamVarE n) = do { n' <- ipName n; return $ HsIPVar noComments n' }
+    cvt (ImplicitParamVarE n) = do { n' <- ipName n; return $ HsIPVar noExtField n' }
     cvt (GetFieldE exp f) = do { e' <- cvtl exp
                                ; return $ HsGetField noComments e'
                                          (L noSrcSpanA (DotFieldOcc noAnn (L noSrcSpanA (FieldLabelString (fsLit f))))) }


=====================================
testsuite/tests/ghc-api/exactprint/T22919.stderr
=====================================
@@ -124,11 +124,7 @@
                  (EpaComments
                   []))
                 (HsLit
-                 (EpAnn
-                  (EpaSpan { T22919.hs:2:7-9 })
-                  (NoEpAnns)
-                  (EpaComments
-                   []))
+                 (NoExtField)
                  (HsChar
                   (SourceText 's')
                   ('s'))))))]


=====================================
testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
=====================================
@@ -136,11 +136,7 @@
                  (EpaComments
                   []))
                 (HsOverLit
-                 (EpAnn
-                  (EpaSpan { ZeroWidthSemi.hs:6:5 })
-                  (NoEpAnns)
-                  (EpaComments
-                   []))
+                 (NoExtField)
                  (OverLit
                   (NoExtField)
                   (HsIntegral


=====================================
testsuite/tests/parser/should_compile/DumpParsedAst.stderr
=====================================
@@ -2408,11 +2408,7 @@
                    (EpaComments
                     []))
                   (HsLit
-                   (EpAnn
-                    (EpaSpan { DumpParsedAst.hs:25:17-23 })
-                    (NoEpAnns)
-                    (EpaComments
-                     []))
+                   (NoExtField)
                    (HsString
                     (SourceText "hello")
                     {FastString: "hello"})))))))]


=====================================
testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
=====================================
@@ -145,11 +145,7 @@
                  (EpaComments
                   []))
                 (HsOverLit
-                 (EpAnn
-                  (EpaSpan { DumpParsedAstComments.hs:9:7 })
-                  (NoEpAnns)
-                  (EpaComments
-                   []))
+                 (NoExtField)
                  (OverLit
                   (NoExtField)
                   (HsIntegral
@@ -312,11 +308,7 @@
                        (EpaComments
                         []))
                       (HsOverLit
-                       (EpAnn
-                        (EpaSpan { DumpParsedAstComments.hs:16:3 })
-                        (NoEpAnns)
-                        (EpaComments
-                         []))
+                       (NoExtField)
                        (OverLit
                         (NoExtField)
                         (HsIntegral
@@ -450,11 +442,7 @@
                    (EpaComments
                     []))
                   (HsLit
-                   (EpAnn
-                    (EpaSpan { DumpParsedAstComments.hs:19:17-23 })
-                    (NoEpAnns)
-                    (EpaComments
-                     []))
+                   (NoExtField)
                    (HsString
                     (SourceText "hello")
                     {FastString: "hello"})))))))]


=====================================
testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
=====================================
@@ -122,11 +122,7 @@
                         (EpaComments
                          []))
                        (HsLit
-                        (EpAnn
-                         (EpaSpan { DumpRenamedAst.hs:35:17-23 })
-                         (NoEpAnns)
-                         (EpaComments
-                          []))
+                        (NoExtField)
                         (HsString
                          (SourceText "hello")
                          {FastString: "hello"})))))))]


=====================================
testsuite/tests/parser/should_compile/DumpSemis.stderr
=====================================
@@ -2062,11 +2062,7 @@
                                   (EpaComments
                                    []))
                                  (HsOverLit
-                                  (EpAnn
-                                   (EpaSpan { DumpSemis.hs:34:21 })
-                                   (NoEpAnns)
-                                   (EpaComments
-                                    []))
+                                  (NoExtField)
                                   (OverLit
                                    (NoExtField)
                                    (HsIntegral
@@ -2166,11 +2162,7 @@
                                   (EpaComments
                                    []))
                                  (HsOverLit
-                                  (EpAnn
-                                   (EpaSpan { DumpSemis.hs:34:26 })
-                                   (NoEpAnns)
-                                   (EpaComments
-                                    []))
+                                  (NoExtField)
                                   (OverLit
                                    (NoExtField)
                                    (HsIntegral
@@ -2417,11 +2409,7 @@
                             (EpaComments
                              []))
                            (HsLit
-                            (EpAnn
-                             (EpaSpan { DumpSemis.hs:39:11-13 })
-                             (NoEpAnns)
-                             (EpaComments
-                              []))
+                            (NoExtField)
                             (HsChar
                              (SourceText 'a')
                              ('a'))))))]
@@ -2496,11 +2484,7 @@
                             (EpaComments
                              []))
                            (HsLit
-                            (EpAnn
-                             (EpaSpan { DumpSemis.hs:40:11-13 })
-                             (NoEpAnns)
-                             (EpaComments
-                              []))
+                            (NoExtField)
                             (HsChar
                              (SourceText 'b')
                              ('b'))))))]
@@ -2577,11 +2561,7 @@
                             (EpaComments
                              []))
                            (HsLit
-                            (EpAnn
-                             (EpaSpan { DumpSemis.hs:41:11-13 })
-                             (NoEpAnns)
-                             (EpaComments
-                              []))
+                            (NoExtField)
                             (HsChar
                              (SourceText 'c')
                              ('c'))))))]
@@ -2660,11 +2640,7 @@
                             (EpaComments
                              []))
                            (HsLit
-                            (EpAnn
-                             (EpaSpan { DumpSemis.hs:42:11-13 })
-                             (NoEpAnns)
-                             (EpaComments
-                              []))
+                            (NoExtField)
                             (HsChar
                              (SourceText 'd')
                              ('d'))))))]


=====================================
testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr
=====================================
@@ -110,11 +110,7 @@
                   (EpaComments
                    []))
                  (HsLit
-                  (EpAnn
-                   (EpaDelta (SameLine 0) [])
-                   (NoEpAnns)
-                   (EpaComments
-                    []))
+                  (NoExtField)
                   {HsWord{64}Prim (1374752024144278257) (NoSourceText)}))))
               (L
                (EpAnn
@@ -124,11 +120,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 {HsWord{64}Prim (13654949607623281177) (NoSourceText)}))))
             (L
              (EpAnn
@@ -189,11 +181,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (HsStringPrim
                  (NoSourceText)
                  "T")))))))))
@@ -205,11 +193,7 @@
           (EpaComments
            []))
          (HsLit
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           {HsInt{64}Prim (1) (NoSourceText)}))))
       (L
        (EpAnn
@@ -336,11 +320,7 @@
                   (EpaComments
                    []))
                  (HsLit
-                  (EpAnn
-                   (EpaDelta (SameLine 0) [])
-                   (NoEpAnns)
-                   (EpaComments
-                    []))
+                  (NoExtField)
                   {HsWord{64}Prim (10715337633704422415) (NoSourceText)}))))
               (L
                (EpAnn
@@ -350,11 +330,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 {HsWord{64}Prim (12411373583424111944) (NoSourceText)}))))
             (L
              (EpAnn
@@ -415,11 +391,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (HsStringPrim
                  (NoSourceText)
                  "'MkT")))))))))
@@ -431,11 +403,7 @@
           (EpaComments
            []))
          (HsLit
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           {HsInt{64}Prim (3) (NoSourceText)}))))
       (L
        (EpAnn
@@ -562,11 +530,7 @@
                   (EpaComments
                    []))
                  (HsLit
-                  (EpAnn
-                   (EpaDelta (SameLine 0) [])
-                   (NoEpAnns)
-                   (EpaComments
-                    []))
+                  (NoExtField)
                   {HsWord{64}Prim (14073232900889011755) (NoSourceText)}))))
               (L
                (EpAnn
@@ -576,11 +540,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 {HsWord{64}Prim (2739668351064589274) (NoSourceText)}))))
             (L
              (EpAnn
@@ -641,11 +601,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (HsStringPrim
                  (NoSourceText)
                  "Peano")))))))))
@@ -657,11 +613,7 @@
           (EpaComments
            []))
          (HsLit
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           {HsInt{64}Prim (0) (NoSourceText)}))))
       (L
        (EpAnn
@@ -788,11 +740,7 @@
                   (EpaComments
                    []))
                  (HsLit
-                  (EpAnn
-                   (EpaDelta (SameLine 0) [])
-                   (NoEpAnns)
-                   (EpaComments
-                    []))
+                  (NoExtField)
                   {HsWord{64}Prim (13760111476013868540) (NoSourceText)}))))
               (L
                (EpAnn
@@ -802,11 +750,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 {HsWord{64}Prim (12314848029315386153) (NoSourceText)}))))
             (L
              (EpAnn
@@ -867,11 +811,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (HsStringPrim
                  (NoSourceText)
                  "'Zero")))))))))
@@ -883,11 +823,7 @@
           (EpaComments
            []))
          (HsLit
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           {HsInt{64}Prim (0) (NoSourceText)}))))
       (L
        (EpAnn
@@ -1014,11 +950,7 @@
                   (EpaComments
                    []))
                  (HsLit
-                  (EpAnn
-                   (EpaDelta (SameLine 0) [])
-                   (NoEpAnns)
-                   (EpaComments
-                    []))
+                  (NoExtField)
                   {HsWord{64}Prim (1143980031331647856) (NoSourceText)}))))
               (L
                (EpAnn
@@ -1028,11 +960,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 {HsWord{64}Prim (14802086722010293686) (NoSourceText)}))))
             (L
              (EpAnn
@@ -1093,11 +1021,7 @@
                 (EpaComments
                  []))
                (HsLit
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (HsStringPrim
                  (NoSourceText)
                  "'Succ")))))))))
@@ -1109,11 +1033,7 @@
           (EpaComments
            []))
          (HsLit
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           {HsInt{64}Prim (0) (NoSourceText)}))))
       (L
        (EpAnn
@@ -1175,11 +1095,7 @@
         (EpaComments
          []))
        (HsLit
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (HsInt
          (NoExtField)
          (IL
@@ -1229,11 +1145,7 @@
         (EpaComments
          []))
        (HsLit
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (HsInt
          (NoExtField)
          (IL
@@ -1283,11 +1195,7 @@
         (EpaComments
          []))
        (HsLit
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (HsInt
          (NoExtField)
          (IL
@@ -2175,11 +2083,7 @@
               (EpaComments
                []))
              (HsLit
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (HsStringPrim
                (NoSourceText)
                "main")))))))))
@@ -2225,11 +2129,7 @@
             (EpaComments
              []))
            (HsLit
-            (EpAnn
-             (EpaDelta (SameLine 0) [])
-             (NoEpAnns)
-             (EpaComments
-              []))
+            (NoExtField)
             (HsStringPrim
              (NoSourceText)
              "DumpTypecheckedAst")))))))))))
@@ -2372,11 +2272,7 @@
                       (EpaComments
                        []))
                      (HsLit
-                      (EpAnn
-                       (EpaSpan { DumpTypecheckedAst.hs:20:17-23 })
-                       (NoEpAnns)
-                       (EpaComments
-                        []))
+                      (NoExtField)
                       (HsString
                        (SourceText "hello")
                        {FastString: "hello"})))))))]


=====================================
testsuite/tests/parser/should_compile/T20718.stderr
=====================================
@@ -158,11 +158,7 @@
                  (EpaComments
                   []))
                 (HsOverLit
-                 (EpAnn
-                  (EpaSpan { T20718.hs:8:5 })
-                  (NoEpAnns)
-                  (EpaComments
-                   []))
+                 (NoExtField)
                  (OverLit
                   (NoExtField)
                   (HsIntegral


=====================================
testsuite/tests/plugins/hooks-plugin/Hooks/MetaPlugin.hs
=====================================
@@ -36,7 +36,7 @@ fakeRunMeta opts (MetaE r) _ = do
   pure $ r zero
 
   where zero :: LHsExpr GhcPs
-        zero = noLocA $ HsLit noAnn $
+        zero = noLocA $ HsLit noExtField $
           HsInt NoExtField (mkIntegralLit (0 :: Int))
 
 fakeRunMeta _ _ _ = error "fakeRunMeta: unimplemented"


=====================================
utils/check-exact/ExactPrint.hs
=====================================
@@ -2858,12 +2858,12 @@ instance ExactPrint (GRHS GhcPs (LocatedA (HsCmd GhcPs))) where
 
 instance ExactPrint (HsExpr GhcPs) where
   getAnnotationEntry (HsVar{})                    = NoEntryVal
-  getAnnotationEntry (HsUnboundVar an _)          = fromAnn an
+  getAnnotationEntry (HsUnboundVar{})             = NoEntryVal
   getAnnotationEntry (HsRecSel{})                 = NoEntryVal
   getAnnotationEntry (HsOverLabel{})              = NoEntryVal
-  getAnnotationEntry (HsIPVar an _)               = fromAnn an
-  getAnnotationEntry (HsOverLit an _)             = fromAnn an
-  getAnnotationEntry (HsLit an _)                 = fromAnn an
+  getAnnotationEntry (HsIPVar{})                  = NoEntryVal
+  getAnnotationEntry (HsOverLit{})                = NoEntryVal
+  getAnnotationEntry (HsLit{})                    = NoEntryVal
   getAnnotationEntry (HsLam an _ _)               = fromAnn an
   getAnnotationEntry (HsApp an _ _)               = fromAnn an
   getAnnotationEntry (HsAppType _ _ _)            = NoEntryVal
@@ -2896,12 +2896,12 @@ instance ExactPrint (HsExpr GhcPs) where
   getAnnotationEntry (HsEmbTy{})                  = NoEntryVal
 
   setAnnotationAnchor a@(HsVar{})               _ _ _s = a
-  setAnnotationAnchor (HsUnboundVar an a)    anc ts cs = (HsUnboundVar (setAnchorEpa an anc ts cs) a)
+  setAnnotationAnchor a@(HsUnboundVar{})        _ _ _s = a
   setAnnotationAnchor a@(HsRecSel{})            _ _ _s = a
   setAnnotationAnchor a@(HsOverLabel{})         _ _ _s = a
-  setAnnotationAnchor (HsIPVar an a)         anc ts cs = (HsIPVar (setAnchorEpa an anc ts cs) a)
-  setAnnotationAnchor (HsOverLit an a)       anc ts cs = (HsOverLit (setAnchorEpa an anc ts cs) a)
-  setAnnotationAnchor (HsLit an a)           anc ts cs = (HsLit (setAnchorEpa an anc ts cs) a)
+  setAnnotationAnchor a@(HsIPVar{})             _ _ _s = a
+  setAnnotationAnchor a@(HsOverLit {})          _ _ _s = a
+  setAnnotationAnchor a@(HsLit {})              _ _ _s = a
   setAnnotationAnchor (HsLam an a b)         anc ts cs = (HsLam (setAnchorEpa an anc ts cs) a b)
   setAnnotationAnchor (HsApp an a b)         anc ts cs = (HsApp (setAnchorEpa an anc ts cs) a b)
   setAnnotationAnchor a@(HsAppType {})          _ _ _s = a
@@ -2943,7 +2943,7 @@ instance ExactPrint (HsExpr GhcPs) where
     return (HsVar x n')
   exact x@(HsUnboundVar an _) = do
     case an of
-      EpAnn _ (Just (EpAnnUnboundVar (ob,cb) l)) _ -> do
+      Just (EpAnnUnboundVar (ob,cb) l) -> do
         printStringAtAA ob "`" >> return ()
         printStringAtAA l  "_" >> return ()
         printStringAtAA cb "`" >> return ()



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6058c01186a35de4dcdb24452ca33d1d09a1ddca

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6058c01186a35de4dcdb24452ca33d1d09a1ddca
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231207/86be5c10/attachment-0001.html>


More information about the ghc-commits mailing list