[commit: ghc] wip/orf-reboot: Get rid of isOverloadedRecFldGRE (50c1b05)
git at git.haskell.org
git at git.haskell.org
Mon Oct 12 06:37:35 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/orf-reboot
Link : http://ghc.haskell.org/trac/ghc/changeset/50c1b05e7b633cc006f1b38a868fb2f5c2a3f9cd/ghc
>---------------------------------------------------------------
commit 50c1b05e7b633cc006f1b38a868fb2f5c2a3f9cd
Author: Adam Gundry <adam at well-typed.com>
Date: Wed Oct 7 11:55:16 2015 +0100
Get rid of isOverloadedRecFldGRE
>---------------------------------------------------------------
50c1b05e7b633cc006f1b38a868fb2f5c2a3f9cd
compiler/basicTypes/RdrName.hs | 7 +------
compiler/rename/RnEnv.hs | 15 +++++++--------
2 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs
index 209544f..1430f38 100644
--- a/compiler/basicTypes/RdrName.hs
+++ b/compiler/basicTypes/RdrName.hs
@@ -54,7 +54,7 @@ module RdrName (
greUsedRdrName, greRdrNames, greSrcSpan, greQualModName,
-- ** Global 'RdrName' mapping elements: 'GlobalRdrElt', 'Provenance', 'ImportSpec'
- GlobalRdrElt(..), isLocalGRE, isRecFldGRE, isOverloadedRecFldGRE, greLabel,
+ GlobalRdrElt(..), isLocalGRE, isRecFldGRE, greLabel,
unQualOK, qualSpecOK, unQualSpecOK,
pprNameProvenance,
Parent(..),
@@ -716,11 +716,6 @@ isRecFldGRE :: GlobalRdrElt -> Bool
isRecFldGRE (GRE {gre_par = FldParent{}}) = True
isRecFldGRE _ = False
-isOverloadedRecFldGRE :: GlobalRdrElt -> Bool
-isOverloadedRecFldGRE (GRE {gre_par = FldParent{par_lbl = Just _}})
- = True
-isOverloadedRecFldGRE _ = False
-
-- Returns the field label of this GRE, if it has one
greLabel :: GlobalRdrElt -> Maybe FieldLabelString
greLabel (GRE{gre_par = FldParent{par_lbl = Just lbl}}) = Just lbl
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs
index a75932d..fa4ef28 100644
--- a/compiler/rename/RnEnv.hs
+++ b/compiler/rename/RnEnv.hs
@@ -480,7 +480,7 @@ lookupSubBndrOcc warnIfDeprec parent doc rdr_name
-- NB: lookupGlobalRdrEnv, not lookupGRE_RdrName!
-- The latter does pickGREs, but we want to allow 'x'
-- even if only 'M.x' is in scope
- [gre] | isOverloadedRecFldGRE gre ->
+ [gre] | isRecFldGRE gre ->
do { addUsedSelector (FieldOcc rdr_name (gre_name gre))
; return (gre_name gre) }
| otherwise ->
@@ -868,9 +868,10 @@ lookupGlobalOccRn_overloaded overload_ok rdr_name
= do { env <- getGlobalRdrEnv
; case lookupGRE_RdrName rdr_name env of
[] -> return Nothing
- [gre] | isOverloadedRecFldGRE gre
- -> do { addUsedSelector (FieldOcc rdr_name (gre_name gre))
- ; return (Just (Right [FieldOcc rdr_name $ gre_name gre])) }
+ [gre] | isRecFldGRE gre
+ -> do { let fld_occ = FieldOcc rdr_name (gre_name gre)
+ ; addUsedSelector fld_occ
+ ; return (Just (Right [fld_occ])) }
| otherwise
-> do { addUsedRdrName True gre rdr_name
; return (Just (Left (gre_name gre))) }
@@ -1887,12 +1888,10 @@ warnUnusedGRE gre@(GRE { gre_name = name, gre_lcl = lcl, gre_imp = is })
-- | Make a map from selector names to field labels and parent tycon
-- names, to be used when reporting unused record fields.
mkFieldEnv :: GlobalRdrEnv -> NameEnv (FieldLabelString, Name)
-mkFieldEnv rdr_env = mkNameEnv [ (gre_name gre, (lbl, par_is par))
+mkFieldEnv rdr_env = mkNameEnv [ (gre_name gre, (lbl, par_is (gre_par gre)))
| gres <- occEnvElts rdr_env
, gre <- gres
- , isOverloadedRecFldGRE gre
- , let par = gre_par gre
- Just lbl = par_lbl par
+ , Just lbl <- [greLabel gre]
]
reportable :: Name -> Bool
More information about the ghc-commits
mailing list