[Git][ghc/ghc][wip/az/epa-getloca-as-gethasloc] EPA make getLocA a synonym for getHasLoc

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Wed Aug 2 17:14:16 UTC 2023



Alan Zimmerman pushed to branch wip/az/epa-getloca-as-gethasloc at Glasgow Haskell Compiler / GHC


Commits:
9731917b by Alan Zimmerman at 2023-08-02T18:12:43+01: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/9731917bf29545bd0453fb90bdc6ea574e5489ee

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9731917bf29545bd0453fb90bdc6ea574e5489ee
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/20230802/68fd7b1e/attachment-0001.html>


More information about the ghc-commits mailing list