[Git][ghc/ghc][master] EPA make getLocA a synonym for getHasLoc

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Aug 4 16:31:00 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
de25487d by Alan Zimmerman at 2023-08-04T12:30:36-04:00
EPA make getLocA a synonym for getHasLoc

This is basically a no-op change, but allows us to make future changes
that can rely on the HasLoc instances

And I presume this means we can use more precise functions based on
class resolution, so the Windows CI build reports

Metric Decrease:
    T12234
    T13035

- - - - -


1 changed file:

- compiler/GHC/Parser/Annotation.hs


Changes:

=====================================
compiler/GHC/Parser/Annotation.hs
=====================================
@@ -925,8 +925,8 @@ class HasLoc a where
 instance HasLoc (Located a) where
   getHasLoc (L l _) = l
 
-instance HasLoc (LocatedAn t a) where
-  getHasLoc (L la _) = locA la
+instance HasLoc (GenLocated (SrcSpanAnn' a) e) where
+  getHasLoc (L (SrcSpanAnn _ l) _) = l
 
 getHasLocList :: HasLoc a => [a] -> SrcSpan
 getHasLocList [] = noSrcSpan
@@ -962,9 +962,8 @@ reAnnL anns cs (L l a) = L (SrcSpanAnn (EpAnn (spanAsAnchor l) anns cs) l) a
 getLocAnn :: Located a  -> SrcSpanAnnA
 getLocAnn (L l _) = SrcSpanAnn EpAnnNotUsed l
 
-
 getLocA :: GenLocated (SrcSpanAnn' a) e -> SrcSpan
-getLocA (L (SrcSpanAnn _ l) _) = l
+getLocA = getHasLoc
 
 noLocA :: a -> LocatedAn an a
 noLocA = L (SrcSpanAnn EpAnnNotUsed noSrcSpan)



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/de25487dbad7f6fddf35f486e468b27c4ed12003
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/20230804/a8dfede9/attachment-0001.html>


More information about the ghc-commits mailing list