diff options
author | Richard Eisenberg <rae@richarde.dev> | 2019-09-26 14:31:30 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-08 13:26:20 -0400 |
commit | 9612e91c793830b3049d2bc9a9ee28d9d82b928d (patch) | |
tree | f34d5c1f295026aaf1e706b8e2d20426fad6ac23 /compiler/rename/RnExpr.hs | |
parent | bf02c26402cf926d41c006ab930ed9747e92a373 (diff) | |
download | haskell-9612e91c793830b3049d2bc9a9ee28d9d82b928d.tar.gz |
Solve constraints from top-level groups sooner
Previously, all constraints from all top-level groups (as
separated by top-level splices) were lumped together and solved
at the end. This could leak metavariables to TH, though, and
that's bad. This patch solves each group's constraints before
running the next group's splice.
Naturally, we now report fewer errors in some cases.
One nice benefit is that this also fixes #11680, but in a much
simpler way than the original fix for that ticket. Admittedly,
the error messages degrade just a bit from the fix from #11680
(previously, we informed users about variables that will be
brought into scope below a top-level splice, and now we just
report an out-of-scope error), but the amount of complexity
required throughout GHC to get that error was just not worth it.
This patch thus reverts much of
f93c9517a2c6e158e4a5c5bc7a3d3f88cb4ed119.
Fixes #16980
Test cases: th/T16980{,a}
Diffstat (limited to 'compiler/rename/RnExpr.hs')
-rw-r--r-- | compiler/rename/RnExpr.hs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index 3ec24a7a6d..42d38c23e9 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -108,11 +108,7 @@ rnUnboundVar v then -- Treat this as a "hole" -- Do not fail right now; instead, return HsUnboundVar -- and let the type checker report the error - do { let occ = rdrNameOcc v - ; uv <- if startsWithUnderscore occ - then return (TrueExprHole occ) - else OutOfScope occ <$> getGlobalRdrEnv - ; return (HsUnboundVar noExtField uv, emptyFVs) } + return (HsUnboundVar noExtField (rdrNameOcc v), emptyFVs) else -- Fail immediately (qualified name) do { n <- reportUnboundName v |