Commit 71d1f01d authored by Facundo Domínguez's avatar Facundo Domínguez Committed by Austin Seipp

Omit the static form error for variables not in scope.

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

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: bgamari, thomie, mboes

Differential Revision:

GHC Trac Issues: #10446
parent 70f1ca43
......@@ -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 "
Only identifiers of top-level bindings can appear in the body of the static form:
static T
but the following identifiers were found instead:
RnStaticPointersFail02.hs:5:12: Not in scope: data constructor ‘T’
RnStaticPointersFail02.hs:5:12: error:
Not in scope: data constructor ‘T’
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment