[Git][ghc/ghc][wip/az/epa-remove-addepann-5] EPA: Remove [AddEpAnn] from StandaloneKindSig

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Thu Oct 17 22:40:24 UTC 2024



Alan Zimmerman pushed to branch wip/az/epa-remove-addepann-5 at Glasgow Haskell Compiler / GHC


Commits:
395c02ad by Alan Zimmerman at 2024-10-17T23:39:55+01:00
EPA: Remove [AddEpAnn] from StandaloneKindSig

- - - - -


5 changed files:

- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- utils/check-exact/ExactPrint.hs


Changes:

=====================================
compiler/GHC/Hs/Decls.hs
=====================================
@@ -741,7 +741,7 @@ instance OutputableBndrId p => Outputable (DerivClauseTys (GhcPass p)) where
   ppr (DctSingle _ ty) = ppr ty
   ppr (DctMulti _ tys) = parens (interpp'SP tys)
 
-type instance XStandaloneKindSig GhcPs = [AddEpAnn]
+type instance XStandaloneKindSig GhcPs = (EpToken "type", TokDcolon)
 type instance XStandaloneKindSig GhcRn = NoExtField
 type instance XStandaloneKindSig GhcTc = NoExtField
 
@@ -750,7 +750,7 @@ type instance XXStandaloneKindSig (GhcPass p) = DataConCantHappen
 standaloneKindSigName :: StandaloneKindSig (GhcPass p) -> IdP (GhcPass p)
 standaloneKindSigName (StandaloneKindSig _ lname _) = unLoc lname
 
-type instance XConDeclGADT GhcPs = (EpUniToken "::" "∷", [AddEpAnn])
+type instance XConDeclGADT GhcPs = (TokDcolon, [AddEpAnn])
 type instance XConDeclGADT GhcRn = NoExtField
 type instance XConDeclGADT GhcTc = NoExtField
 


=====================================
compiler/GHC/Parser.y
=====================================
@@ -1366,7 +1366,7 @@ ty_decl :: { LTyClDecl GhcPs }
 standalone_kind_sig :: { LStandaloneKindSig GhcPs }
   : 'type' sks_vars '::' sigktype
       {% mkStandaloneKindSig (comb2 $1 $4) (L (gl $2) $ unLoc $2) $4
-               [mj AnnType $1,mu AnnDcolon $3]}
+               (epTok $1,epUniTok $3)}
 
 -- See also: sig_vars
 sks_vars :: { Located [LocatedN RdrName] }  -- Returned in reverse order


=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -283,7 +283,7 @@ mkStandaloneKindSig
   :: SrcSpan
   -> Located [LocatedN RdrName]   -- LHS
   -> LHsSigType GhcPs             -- RHS
-  -> [AddEpAnn]
+  -> (EpToken "type", TokDcolon)
   -> P (LStandaloneKindSig GhcPs)
 mkStandaloneKindSig loc lhs rhs anns =
   do { vs <- mapM check_lhs_name (unLoc lhs)


=====================================
testsuite/tests/parser/should_compile/DumpParsedAst.stderr
=====================================
@@ -201,8 +201,12 @@
     (KindSigD
      (NoExtField)
      (StandaloneKindSig
-      [(AddEpAnn AnnType (EpaSpan { DumpParsedAst.hs:9:1-4 }))
-      ,(AddEpAnn AnnDcolon (EpaSpan { DumpParsedAst.hs:9:13-14 }))]
+      ((,)
+       (EpTok
+        (EpaSpan { DumpParsedAst.hs:9:1-4 }))
+       (EpUniTok
+        (EpaSpan { DumpParsedAst.hs:9:13-14 })
+        (NormalSyntax)))
       (L
        (EpAnn
         (EpaSpan { DumpParsedAst.hs:9:6-11 })
@@ -885,8 +889,12 @@
     (KindSigD
      (NoExtField)
      (StandaloneKindSig
-      [(AddEpAnn AnnType (EpaSpan { DumpParsedAst.hs:17:1-4 }))
-      ,(AddEpAnn AnnDcolon (EpaSpan { DumpParsedAst.hs:17:9-10 }))]
+      ((,)
+       (EpTok
+        (EpaSpan { DumpParsedAst.hs:17:1-4 }))
+       (EpUniTok
+        (EpaSpan { DumpParsedAst.hs:17:9-10 })
+        (NormalSyntax)))
       (L
        (EpAnn
         (EpaSpan { DumpParsedAst.hs:17:6-7 })


=====================================
utils/check-exact/ExactPrint.hs
=====================================
@@ -2907,12 +2907,12 @@ instance ExactPrint (StandaloneKindSig GhcPs) where
   getAnnotationEntry _ = NoEntryVal
   setAnnotationAnchor a _ _ _ = a
 
-  exact (StandaloneKindSig an vars sig) = do
-    an0 <- markEpAnnL an lidl AnnType
+  exact (StandaloneKindSig (tt,td) vars sig) = do
+    tt' <- markEpToken tt
     vars' <- markAnnotated vars
-    an1 <- markEpAnnL an0 lidl AnnDcolon
+    td' <- markEpUniToken td
     sig' <- markAnnotated sig
-    return (StandaloneKindSig an1 vars' sig')
+    return (StandaloneKindSig (tt',td') vars' sig')
 
 -- ---------------------------------------------------------------------
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/395c02ad803917d011050115cf9c152c05c0a58f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/395c02ad803917d011050115cf9c152c05c0a58f
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/20241017/c29edb9f/attachment-0001.html>


More information about the ghc-commits mailing list