[commit: ghc] wip/T11970: Record usages (98f54a7)

git at git.haskell.org git at git.haskell.org
Fri Jun 17 20:11:13 UTC 2016


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

On branch  : wip/T11970
Link       : http://ghc.haskell.org/trac/ghc/changeset/98f54a75c217dbfcfc10c7e44b438e9313ac4626/ghc

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

commit 98f54a75c217dbfcfc10c7e44b438e9313ac4626
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date:   Sat Jun 11 22:11:56 2016 +0100

    Record usages


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

98f54a75c217dbfcfc10c7e44b438e9313ac4626
 compiler/rename/RnEnv.hs          | 9 +++++++--
 testsuite/tests/module/T11970A.hs | 2 --
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs
index f34161b..c5b19d3 100644
--- a/compiler/rename/RnEnv.hs
+++ b/compiler/rename/RnEnv.hs
@@ -573,7 +573,9 @@ lookupExportChild parent rdr_name
 
   case lookupGRE_RdrName rdr_name gre_env of
     [] -> return Nothing
-    [x] -> return (Just ((:[]) <$> checkFld x))
+    [x] -> do
+      addUsedGRE True x
+      return (Just ((:[]) <$> checkFld x))
     xs  -> Just <$> checkAmbig overload_ok rdr_name parent xs
   where
 
@@ -599,6 +601,7 @@ lookupExportChild parent rdr_name
                    -> [GlobalRdrElt]
                    -> RnM (Either Name [FieldLabel])
         checkAmbig overload_ok rdr_name parent gres
+          -- Don't record ambiguous selector usage
           | all isRecFldGRE
                    gres && overload_ok
                 = return $
@@ -606,7 +609,9 @@ lookupExportChild parent rdr_name
                             | gre <- gres
                             , let FldParent _ mfs = gre_par gre ]
           | Just gre <- disambigChildren rdr_name parent gres
-            = return ((:[]) <$> checkFld gre)
+            = do
+                addUsedGRE True gre
+                return ((:[]) <$> checkFld gre)
           | otherwise = do
               addNameClashErrRn rdr_name gres
               return (Left (gre_name (head gres)))
diff --git a/testsuite/tests/module/T11970A.hs b/testsuite/tests/module/T11970A.hs
index b20aa80..e9d6e95 100644
--- a/testsuite/tests/module/T11970A.hs
+++ b/testsuite/tests/module/T11970A.hs
@@ -1,5 +1,3 @@
 module T11970A ( Fail(a) ) where
 
 import T11970A1 ( Fail(a, b) )
-
-



More information about the ghc-commits mailing list