[Git][ghc/ghc][wip/az/ghc-9.10-backports-1] 2 commits: EPA: Fix span for PatBuilderAppType

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Mon Apr 15 21:32:18 UTC 2024



Alan Zimmerman pushed to branch wip/az/ghc-9.10-backports-1 at Glasgow Haskell Compiler / GHC


Commits:
fe3321b8 by Alan Zimmerman at 2024-04-15T22:06:44+01:00
EPA: Fix span for PatBuilderAppType

Note: tests still need to be updated

- - - - -
1eb1a5ae by Alan Zimmerman at 2024-04-15T22:31:39+01:00
EPA: Avoid duplicated comments in splice decls

- - - - -


3 changed files:

- compiler/GHC/Hs/Type.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs


Changes:

=====================================
compiler/GHC/Hs/Type.hs
=====================================
@@ -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)
 
 {-
 ************************************************************************


=====================================
compiler/GHC/Parser.y
=====================================
@@ -3401,7 +3401,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 noAnn $2)) }
 
 argpats :: { [LPat GhcPs] }
           : argpat argpats            { $1 : $2 }


=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -398,17 +398,14 @@ mkSpliceDecl :: LHsExpr GhcPs -> P (LHsDecl GhcPs)
 -- 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)
+    return $ L loc $ SpliceD noExtField (SpliceDecl noExtField (L (l2l 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)
+    return $ L loc $ SpliceD noExtField (SpliceDecl noExtField (L (l2l loc) splice) DollarSplice)
 
   | otherwise = do
-    !cs <- getCommentsFor (locA loc)
-    return $ L (addCommentsToEpAnn loc cs) $ SpliceD noExtField (SpliceDecl noExtField
-                                 (L loc (HsUntypedSpliceExpr noAnn lexpr))
+    return $ L loc $ SpliceD noExtField (SpliceDecl noExtField
+                                 (L (l2l loc) (HsUntypedSpliceExpr noAnn (la2la lexpr)))
                                        BareSplice)
 
 mkRoleAnnotDecl :: SrcSpan
@@ -1458,7 +1455,7 @@ 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 (L loc (PatBuilderAppType pat tok ty_pat@(HsTP _ (L _loc _)))) es ops cps
              = go pat (L loc (ArgPatBuilderArgPat invis_pat) : es) ops cps
              where invis_pat = InvisPat tok ty_pat
    go _ _ _ _ = return Nothing



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/86062534289a04184bdd6768dc0c5031713873cf...1eb1a5ae98ab32439870867dfd39d38b64bd6a6d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/86062534289a04184bdd6768dc0c5031713873cf...1eb1a5ae98ab32439870867dfd39d38b64bd6a6d
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/20240415/6b6a793d/attachment-0001.html>


More information about the ghc-commits mailing list