[commit: ghc] ghc-7.10: Omit the static form error for variables not in scope. (0a7f3b3)
git at git.haskell.org
git at git.haskell.org
Wed May 27 15:07:54 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-7.10
Link : http://ghc.haskell.org/trac/ghc/changeset/0a7f3b303f29724658ddb1c1481b2a26a5fd8b0a/ghc
>---------------------------------------------------------------
commit 0a7f3b303f29724658ddb1c1481b2a26a5fd8b0a
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
(cherry picked from commit 71d1f01db94dda5b8c2c367fba8cc7b115b06e95)
>---------------------------------------------------------------
0a7f3b303f29724658ddb1c1481b2a26a5fd8b0a
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 4cebafc..0dab57d 100644
--- a/compiler/rename/RnExpr.hs
+++ b/compiler/rename/RnExpr.hs
@@ -339,7 +339,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