[Git][ghc/ghc][wip/amg/hasfield-2020] Exclude record updaters from HIE files

Adam Gundry gitlab at gitlab.haskell.org
Sun Sep 27 21:11:49 UTC 2020



Adam Gundry pushed to branch wip/amg/hasfield-2020 at Glasgow Haskell Compiler / GHC


Commits:
57363155 by Adam Gundry at 2020-09-27T22:10:02+01:00
Exclude record updaters from HIE files

I'm unsure if this is the right way to accomplish this, or even if
this is desireable in the first place, but it prevents them showing
up in haddockHypsrcTest.

- - - - -


1 changed file:

- compiler/GHC/Iface/Ext/Ast.hs


Changes:

=====================================
compiler/GHC/Iface/Ext/Ast.hs
=====================================
@@ -42,7 +42,8 @@ import GHC.Driver.Types
 import GHC.Unit.Module            ( ModuleName, ml_hs_file )
 import GHC.Utils.Monad            ( concatMapM, liftIO )
 import GHC.Types.Id               ( isDataConId_maybe )
-import GHC.Types.Name             ( Name, nameSrcSpan, setNameLoc, nameUnique )
+import GHC.Types.Name             ( Name, nameSrcSpan, setNameLoc, nameUnique, getOccName )
+import GHC.Types.Name.Occurrence  ( isRecFldUpdOcc )
 import GHC.Types.Name.Env         ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv )
 import GHC.Types.SrcLoc
 import GHC.Tc.Utils.Zonk          ( hsLitType, hsPatType )
@@ -804,7 +805,12 @@ instance ToHie (Context (Located NoExtField)) where
   toHie _ = pure []
 
 instance HiePass p => ToHie (BindContext (Located (HsBind (GhcPass p)))) where
-  toHie (BC context scope b@(L span bind)) =
+  toHie (BC context scope b@(L span bind))
+    | FunBind{fun_id = name} <- bind
+    , case hiePass @p of { HieRn -> isRecFldUpdOcc (getOccName (unLoc name))
+                         ; HieTc -> isRecFldUpdOcc (getOccName (unLoc name))
+                         } = pure [] -- Exclude record updaters from HIE files
+    | otherwise =
     concatM $ getTypeNode b : case bind of
       FunBind{fun_id = name, fun_matches = matches, fun_ext = wrap} ->
         [ toHie $ C (ValBind context scope $ getRealSpan span) name



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/573631554d1dbc6c648314a10695b6a553a8861a
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/20200927/22c85730/attachment-0001.html>


More information about the ghc-commits mailing list