summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojciech Baranowski <wbaranowski@protonmail.com>2019-04-24 21:54:42 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-29 21:02:38 -0400
commit8ee474320d849cc14b51706892665376e8ede629 (patch)
tree38895dec1deef32a65f2638207d50c722ea907f6
parent1deb2bb0c5f1178515d57380c96ec3d4df5a7965 (diff)
downloadhaskell-8ee474320d849cc14b51706892665376e8ede629.tar.gz
Suggest only local candidates from global env
-rw-r--r--compiler/rename/RnEnv.hs6
-rw-r--r--testsuite/tests/parser/should_fail/readFail001.stderr2
-rw-r--r--testsuite/tests/rename/should_fail/T16504.hs1
-rw-r--r--testsuite/tests/rename/should_fail/T16504.stderr10
4 files changed, 11 insertions, 8 deletions
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs
index 2e0b7ec00a..436e34220f 100644
--- a/compiler/rename/RnEnv.hs
+++ b/compiler/rename/RnEnv.hs
@@ -1374,7 +1374,7 @@ However, consider this case:
f :: Int -> Int
g x = x
We don't want to say 'f' is out of scope; instead, we want to
-return the imported 'f', so that later on the reanamer will
+return the imported 'f', so that later on the renamer will
correctly report "misplaced type sig".
Note [Signatures for top level things]
@@ -1472,7 +1472,9 @@ lookupBindGroupOcc ctxt what rdr_name
lookup_top keep_me
= do { env <- getGlobalRdrEnv
; let all_gres = lookupGlobalRdrEnv env (rdrNameOcc rdr_name)
- ; let candidates_msg = candidates $ map gre_name $ globalRdrEnvElts env
+ ; let candidates_msg = candidates $ map gre_name
+ $ filter isLocalGRE
+ $ globalRdrEnvElts env
; case filter (keep_me . gre_name) all_gres of
[] | null all_gres -> bale_out_with candidates_msg
| otherwise -> bale_out_with local_msg
diff --git a/testsuite/tests/parser/should_fail/readFail001.stderr b/testsuite/tests/parser/should_fail/readFail001.stderr
index f88eaac23b..6425d16c49 100644
--- a/testsuite/tests/parser/should_fail/readFail001.stderr
+++ b/testsuite/tests/parser/should_fail/readFail001.stderr
@@ -1,8 +1,6 @@
readFail001.hs:25:11: error:
The fixity signature for ‘+#’ lacks an accompanying binding
- Perhaps you meant one of these:
- ‘+’ (Defined in ‘GHC.Num’), ‘++’ (Defined in ‘GHC.Base’)
readFail001.hs:38:32: error:
Not in scope: type constructor or class ‘Leaf’
diff --git a/testsuite/tests/rename/should_fail/T16504.hs b/testsuite/tests/rename/should_fail/T16504.hs
index 1bb6a08226..8ee426f025 100644
--- a/testsuite/tests/rename/should_fail/T16504.hs
+++ b/testsuite/tests/rename/should_fail/T16504.hs
@@ -4,6 +4,7 @@ module M where
-- Both in global scope
simpleFuntcion :: Int -> Bool
simpleFunction i = i > 5
+simpleFunction2 i = i < 5
-- Both in local scope
f x = anotherFunction x
diff --git a/testsuite/tests/rename/should_fail/T16504.stderr b/testsuite/tests/rename/should_fail/T16504.stderr
index 7bc59bda3e..2fc822d3a2 100644
--- a/testsuite/tests/rename/should_fail/T16504.stderr
+++ b/testsuite/tests/rename/should_fail/T16504.stderr
@@ -2,13 +2,15 @@
T16504.hs:5:1: error:
The type signature for ‘simpleFuntcion’
lacks an accompanying binding
- Perhaps you meant ‘simpleFunction’ (Defined at T16504.hs:6:1)
+ Perhaps you meant one of these:
+ ‘simpleFunction’ (Defined at T16504.hs:6:1),
+ ‘simpleFunction2’ (Defined at T16504.hs:7:1)
-T16504.hs:10:9: error:
+T16504.hs:11:9: error:
The type signature for ‘anotherFunction’
lacks an accompanying binding
- Perhaps you meant ‘anotherFuntcion’ (Defined at T16504.hs:11:9)
+ Perhaps you meant ‘anotherFuntcion’ (Defined at T16504.hs:12:9)
-T16504.hs:14:1: error:
+T16504.hs:15:1: error:
The type signature for ‘nonexistentFuntcion’
lacks an accompanying binding