[commit: ghc] wip/orf-reboot: Use addUsedSelector to record occurrences of overloaded fields in pattern matches (6ff694b)

git at git.haskell.org git at git.haskell.org
Fri Mar 27 15:47:07 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/orf-reboot
Link       : http://ghc.haskell.org/trac/ghc/changeset/6ff694baaac9fbc79c9f44ebf805f2d1db233866/ghc

>---------------------------------------------------------------

commit 6ff694baaac9fbc79c9f44ebf805f2d1db233866
Author: Adam Gundry <adam at well-typed.com>
Date:   Fri Mar 20 14:52:00 2015 +0000

    Use addUsedSelector to record occurrences of overloaded fields in pattern matches


>---------------------------------------------------------------

6ff694baaac9fbc79c9f44ebf805f2d1db233866
 compiler/rename/RnEnv.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs
index acc59bb..1bd71e2 100644
--- a/compiler/rename/RnEnv.hs
+++ b/compiler/rename/RnEnv.hs
@@ -482,7 +482,11 @@ 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] -> do { addUsedRdrName warnIfDeprec gre (used_rdr_name gre)
+            [gre] | isOverloadedRecFldGRE gre ->
+                     do { addUsedSelector (gre_name gre)
+                        ; return (gre_name gre) }
+                  | otherwise ->
+                     do { addUsedRdrName warnIfDeprec gre (used_rdr_name gre)
                           -- Add a usage; this is an *occurrence* site
                         ; return (gre_name gre) }
             []    -> do { addErr (unknownSubordinateErr doc rdr_name)



More information about the ghc-commits mailing list