[commit: ghc] master: Omit the static form error for variables not in scope. (71d1f01)

git at git.haskell.org git at git.haskell.org
Tue May 26 16:16:19 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/71d1f01db94dda5b8c2c367fba8cc7b115b06e95/ghc

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

commit 71d1f01db94dda5b8c2c367fba8cc7b115b06e95
Author: Facundo Domínguez <facundo.dominguez at tweag.io>
Date:   Mon May 25 21:08:05 2015 -0500

    Omit the static form error for variables not in scope.
    
    Summary:
    Fixes T10446.
    
    The following program
    
    > g = static f
    
    now produces only:
    
    > ...: error
    >    Not in scope: 'f'
    
    Before it would also produce a complaint about 'f' not being a top-level
    identifier.
    
    Test Plan: validate
    
    Reviewers: austin
    
    Reviewed By: austin
    
    Subscribers: bgamari, thomie, mboes
    
    Differential Revision: https://phabricator.haskell.org/D906
    
    GHC Trac Issues: #10446


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

71d1f01db94dda5b8c2c367fba8cc7b115b06e95
 compiler/rename/RnExpr.hs                                        | 4 +++-
 testsuite/tests/rename/should_fail/RnStaticPointersFail02.stderr | 9 ++-------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs
index 50860f9..71fa1cb 100644
--- a/compiler/rename/RnExpr.hs
+++ b/compiler/rename/RnExpr.hs
@@ -330,7 +330,9 @@ rnExpr e@(HsStatic expr) = do
              ]
       _ -> do
        let isTopLevelName n = isExternalName n || isWiredInName n
-       case nameSetElems $ filterNameSet (not . isTopLevelName) fvExpr of
+       case nameSetElems $ filterNameSet
+                             (\n -> not (isTopLevelName n || isUnboundName n))
+                             fvExpr                                           of
          [] -> return ()
          fvNonGlobal -> addErr $ cat
              [ text $ "Only identifiers of top-level bindings can "
diff --git a/testsuite/tests/rename/should_fail/RnStaticPointersFail02.stderr b/testsuite/tests/rename/should_fail/RnStaticPointersFail02.stderr
index 6524702..52e3609 100644
--- a/testsuite/tests/rename/should_fail/RnStaticPointersFail02.stderr
+++ b/testsuite/tests/rename/should_fail/RnStaticPointersFail02.stderr
@@ -1,8 +1,3 @@
 
-RnStaticPointersFail02.hs:5:5:
-    Only identifiers of top-level bindings can appear in the body of the static form:
-      static T
-    but the following identifiers were found instead:
-      T
-
-RnStaticPointersFail02.hs:5:12: Not in scope: data constructor ‘T’
+RnStaticPointersFail02.hs:5:12: error:
+    Not in scope: data constructor ‘T’



More information about the ghc-commits mailing list