summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2015-11-10 17:07:10 +0100
committerJoachim Breitner <mail@joachim-breitner.de>2015-11-13 10:13:20 +0100
commite66f79dfb22031dd3f75dd3eb341e8269ab51d83 (patch)
tree157fdd402b439ac8c82439d37d02084b4e899fd9 /testsuite
parent2290c8bd8c3faee0cb7dc1c2c7951bb9d5e3ebf9 (diff)
downloadhaskell-e66f79dfb22031dd3f75dd3eb341e8269ab51d83.tar.gz
Give helpful advice when a fully qualified name is not in scope
This implements #11071. It needs to thread through a GlobalRdrEnv corresponding to the export list of the module if its exports were not restricted. A refactoring of ImportedModsVal into a proper data type follows. Differential Revision: https://phabricator.haskell.org/D1462
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/ghc-api/annotations/T10313.stderr56
-rw-r--r--testsuite/tests/ghc-api/annotations/T10399.stderr24
-rw-r--r--testsuite/tests/ghci/scripts/T2452.stderr4
-rw-r--r--testsuite/tests/ghci/scripts/T8639.stderr3
-rw-r--r--testsuite/tests/ghci/scripts/ghci036.stderr34
-rw-r--r--testsuite/tests/module/mod134.stderr4
-rw-r--r--testsuite/tests/module/mod62.stderr5
-rw-r--r--testsuite/tests/module/mod73.stderr3
-rw-r--r--testsuite/tests/module/mod74.stderr4
-rw-r--r--testsuite/tests/module/mod88.stderr5
-rw-r--r--testsuite/tests/rename/prog002/rename.prog002.stderr5
-rw-r--r--testsuite/tests/rename/should_fail/T10781.stderr4
-rw-r--r--testsuite/tests/rename/should_fail/T11071.hs28
-rw-r--r--testsuite/tests/rename/should_fail/T11071.stderr53
-rw-r--r--testsuite/tests/rename/should_fail/T2901.stderr7
-rw-r--r--testsuite/tests/rename/should_fail/T5657.stderr6
-rw-r--r--testsuite/tests/rename/should_fail/T5892b.stderr4
-rw-r--r--testsuite/tests/rename/should_fail/all.T1
-rw-r--r--testsuite/tests/rename/should_fail/rnfail030.stderr5
-rw-r--r--testsuite/tests/rename/should_fail/rnfail031.stderr5
-rw-r--r--testsuite/tests/rename/should_fail/rnfail032.stderr4
-rw-r--r--testsuite/tests/rename/should_fail/rnfail033.stderr4
-rw-r--r--testsuite/tests/rename/should_fail/rnfail034.stderr5
-rw-r--r--testsuite/tests/safeHaskell/ghci/p4.stderr17
24 files changed, 211 insertions, 79 deletions
diff --git a/testsuite/tests/ghc-api/annotations/T10313.stderr b/testsuite/tests/ghc-api/annotations/T10313.stderr
index 1b6a7c2aab..426d496e3c 100644
--- a/testsuite/tests/ghc-api/annotations/T10313.stderr
+++ b/testsuite/tests/ghc-api/annotations/T10313.stderr
@@ -1,25 +1,31 @@
-
-Test10313.hs:9:13: error:
- The deprecation for ‘solverCheckAndGetModel’
- lacks an accompanying binding
-
-Test10313.hs:15:16: error:
- Multiple warning declarations for ‘Logic’
- also at Test10313.hs:9:13-17
-
-Test10313.hs:15:16: error:
- The deprecation for ‘solverCheckAndGetModel’
- lacks an accompanying binding
-
-Test10313.hs:16:13: error:
- Multiple warning declarations for ‘solverCheckAndGetModel’
- also at Test10313.hs:10:13-34
-
-Test10313.hs:30:15: error:
- Not in scope: data constructor ‘Bitstream’
-
-Test10313.hs:32:7: error: Not in scope: ‘S.concatMap’
-
-Test10313.hs:32:27: error: Not in scope: ‘GV.stream’
-
-Test10313.hs:33:7: error: Not in scope: ‘S.sized’
+
+Test10313.hs:9:13: error:
+ The deprecation for ‘solverCheckAndGetModel’
+ lacks an accompanying binding
+
+Test10313.hs:15:16: error:
+ Multiple warning declarations for ‘Logic’
+ also at Test10313.hs:9:13-17
+
+Test10313.hs:15:16: error:
+ The deprecation for ‘solverCheckAndGetModel’
+ lacks an accompanying binding
+
+Test10313.hs:16:13: error:
+ Multiple warning declarations for ‘solverCheckAndGetModel’
+ also at Test10313.hs:10:13-34
+
+Test10313.hs:30:15: error:
+ Not in scope: data constructor ‘Bitstream’
+
+Test10313.hs:32:7: error:
+ Not in scope: ‘S.concatMap’
+ No module named ‘S’ is imported.
+
+Test10313.hs:32:27: error:
+ Not in scope: ‘GV.stream’
+ No module named ‘GV’ is imported.
+
+Test10313.hs:33:7: error:
+ Not in scope: ‘S.sized’
+ No module named ‘S’ is imported.
diff --git a/testsuite/tests/ghc-api/annotations/T10399.stderr b/testsuite/tests/ghc-api/annotations/T10399.stderr
index 9d9bc29b0a..0b120e2c4f 100644
--- a/testsuite/tests/ghc-api/annotations/T10399.stderr
+++ b/testsuite/tests/ghc-api/annotations/T10399.stderr
@@ -1,9 +1,15 @@
-
-Test10399.hs:10:27: error:
- Not in scope: type constructor or class ‘MPISecret’
-
-Test10399.hs:12:39: error: Not in scope: ‘P.base’
-
-Test10399.hs:12:50: error: Not in scope: ‘P.pos’
-
-Test10399.hs:12:60: error: Not in scope: ‘P.form’
+
+Test10399.hs:10:27: error:
+ Not in scope: type constructor or class ‘MPISecret’
+
+Test10399.hs:12:39: error:
+ Not in scope: ‘P.base’
+ No module named ‘P’ is imported.
+
+Test10399.hs:12:50: error:
+ Not in scope: ‘P.pos’
+ No module named ‘P’ is imported.
+
+Test10399.hs:12:60: error:
+ Not in scope: ‘P.form’
+ No module named ‘P’ is imported.
diff --git a/testsuite/tests/ghci/scripts/T2452.stderr b/testsuite/tests/ghci/scripts/T2452.stderr
index 68e07ae367..663742f67c 100644
--- a/testsuite/tests/ghci/scripts/T2452.stderr
+++ b/testsuite/tests/ghci/scripts/T2452.stderr
@@ -1,2 +1,4 @@
-<interactive>:1:1: Not in scope: ‘System.IO.hPutStrLn’
+<interactive>:1:1: error:
+ Not in scope: ‘System.IO.hPutStrLn’
+ No module named ‘System.IO’ is imported.
diff --git a/testsuite/tests/ghci/scripts/T8639.stderr b/testsuite/tests/ghci/scripts/T8639.stderr
index 2c63d731b1..ee06e6e70c 100644
--- a/testsuite/tests/ghci/scripts/T8639.stderr
+++ b/testsuite/tests/ghci/scripts/T8639.stderr
@@ -1,4 +1,5 @@
-<interactive>:1:1:
+<interactive>:1:1: error:
Not in scope: ‘H.bit’
Perhaps you meant ‘Q.bit’ (imported from T8639)
+ No module named ‘H’ is imported.
diff --git a/testsuite/tests/ghci/scripts/ghci036.stderr b/testsuite/tests/ghci/scripts/ghci036.stderr
index 0c7de1356b..5b44b562a7 100644
--- a/testsuite/tests/ghci/scripts/ghci036.stderr
+++ b/testsuite/tests/ghci/scripts/ghci036.stderr
@@ -1,16 +1,18 @@
-
-<interactive>:1:1: error: Variable not in scope: nubBy
-
-<interactive>:1:1: error: Variable not in scope: nub
-
-<interactive>:1:1: error: Variable not in scope: nubBy
-
-<interactive>:1:1: error: Variable not in scope: nub
-
-<interactive>:1:1: error:
- Variable not in scope: nub
- Perhaps you meant ‘L.nub’ (imported from Data.List)
-
-<interactive>:1:1: error: Not in scope: ‘L.nub’
-
-<interactive>:1:1: error: Variable not in scope: nub
+
+<interactive>:1:1: error: Variable not in scope: nubBy
+
+<interactive>:1:1: error: Variable not in scope: nub
+
+<interactive>:1:1: error: Variable not in scope: nubBy
+
+<interactive>:1:1: error: Variable not in scope: nub
+
+<interactive>:1:1: error:
+ Variable not in scope: nub
+ Perhaps you meant ‘L.nub’ (imported from Data.List)
+
+<interactive>:1:1: error:
+ Not in scope: ‘L.nub’
+ No module named ‘L’ is imported.
+
+<interactive>:1:1: error: Variable not in scope: nub
diff --git a/testsuite/tests/module/mod134.stderr b/testsuite/tests/module/mod134.stderr
index d6e6f0e30b..86c2ffb6a5 100644
--- a/testsuite/tests/module/mod134.stderr
+++ b/testsuite/tests/module/mod134.stderr
@@ -1,7 +1,9 @@
-mod134.hs:6:19:
+mod134.hs:6:19: error:
Not in scope: ‘Prelude.head’
Perhaps you meant one of these:
‘Prelude.read’ (imported from Prelude),
‘Prelude.reads’ (imported from Prelude),
data constructor ‘Prelude.Left’ (imported from Prelude)
+ Perhaps you want to remove ‘head’ from the explicit hiding list
+ in the import of ‘Prelude’ (mod134.hs:4:1-28).
diff --git a/testsuite/tests/module/mod62.stderr b/testsuite/tests/module/mod62.stderr
index 8215ec1e1d..3a6f415946 100644
--- a/testsuite/tests/module/mod62.stderr
+++ b/testsuite/tests/module/mod62.stderr
@@ -1,6 +1,7 @@
-mod62.hs:3:9: Qualified name in binding position: M.y
+mod62.hs:3:9: error: Qualified name in binding position: M.y
-mod62.hs:3:22:
+mod62.hs:3:22: error:
Not in scope: ‘M.y’
Perhaps you meant ‘M.x’ (line 3)
+ No module named ‘M’ is imported.
diff --git a/testsuite/tests/module/mod73.stderr b/testsuite/tests/module/mod73.stderr
index d19a032cef..12dc6b2b39 100644
--- a/testsuite/tests/module/mod73.stderr
+++ b/testsuite/tests/module/mod73.stderr
@@ -1,7 +1,8 @@
-mod73.hs:3:7:
+mod73.hs:3:7: error:
Not in scope: ‘Prelude.g’
Perhaps you meant one of these:
data constructor ‘Prelude.GT’ (imported from Prelude),
data constructor ‘Prelude.EQ’ (imported from Prelude),
data constructor ‘Prelude.LT’ (imported from Prelude)
+ Module ‘Prelude’ does not export ‘g’.
diff --git a/testsuite/tests/module/mod74.stderr b/testsuite/tests/module/mod74.stderr
index e3660924cc..55a8ca65f2 100644
--- a/testsuite/tests/module/mod74.stderr
+++ b/testsuite/tests/module/mod74.stderr
@@ -1,2 +1,4 @@
-mod74.hs:3:7: Not in scope: ‘N.g’
+mod74.hs:3:7: error:
+ Not in scope: ‘N.g’
+ No module named ‘N’ is imported.
diff --git a/testsuite/tests/module/mod88.stderr b/testsuite/tests/module/mod88.stderr
index fea1eddb7d..f145350c4e 100644
--- a/testsuite/tests/module/mod88.stderr
+++ b/testsuite/tests/module/mod88.stderr
@@ -1,2 +1,5 @@
-mod88.hs:5:5: Not in scope: data constructor ‘Prelude.Left’
+mod88.hs:5:5: error:
+ Not in scope: data constructor ‘Prelude.Left’
+ Perhaps you want to add ‘Left’ to the import list in the import of
+ ‘Prelude’ (mod88.hs:4:1-30).
diff --git a/testsuite/tests/rename/prog002/rename.prog002.stderr b/testsuite/tests/rename/prog002/rename.prog002.stderr
index b9dbf7f54a..01ab86946e 100644
--- a/testsuite/tests/rename/prog002/rename.prog002.stderr
+++ b/testsuite/tests/rename/prog002/rename.prog002.stderr
@@ -1,2 +1,5 @@
-rnfail037.hs:8:7: Not in scope: data constructor ‘Rn037Help.C’
+rnfail037.hs:8:7: error:
+ Not in scope: data constructor ‘Rn037Help.C’
+ Perhaps you want to remove ‘C’ from the explicit hiding list
+ in the import of ‘Rn037Help’ (rnfail037.hs:4:1-28).
diff --git a/testsuite/tests/rename/should_fail/T10781.stderr b/testsuite/tests/rename/should_fail/T10781.stderr
index 5d4dc3c098..d86f0d1beb 100644
--- a/testsuite/tests/rename/should_fail/T10781.stderr
+++ b/testsuite/tests/rename/should_fail/T10781.stderr
@@ -1,2 +1,4 @@
-T10781.hs:12:5: error: Not in scope: ‘Foo._name’
+T10781.hs:12:5: error:
+ Not in scope: ‘Foo._name’
+ No module named ‘Foo’ is imported.
diff --git a/testsuite/tests/rename/should_fail/T11071.hs b/testsuite/tests/rename/should_fail/T11071.hs
new file mode 100644
index 0000000000..ad31bc0c80
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T11071.hs
@@ -0,0 +1,28 @@
+module T11071 where
+
+import Data.List (lines)
+import qualified Data.Map as M ()
+import qualified Data.IntMap as M ()
+import qualified Data.IntMap as M () -- just to see if this confused the code
+
+import qualified Data.Ord as Ord hiding (Down)
+
+import qualified Data.Map as M' hiding (size, filter)
+import qualified Data.Map as M' hiding (size)
+import qualified Data.IntMap as M' hiding (size)
+import qualified System.IO as M' () -- unrelated
+
+ignore :: a -> IO ()
+ignore = const (return ())
+
+main = do
+ ignore NoSuchModule.foo -- no such module
+ ignore Data.List.foobar -- does not exist (one import)
+ ignore M.foobar -- does not exist (two imports)
+ ignore M'.foobar -- does not exist (three imports)
+ ignore Data.List.sort -- needs import
+ ignore Data.List.unlines -- needs import, similar to imported
+ ignore M.size -- multiple modules to import from
+ ignore M.valid -- only one module to import from
+ ignore Ord.Down -- explicit hiding
+ ignore M'.size -- hidden and/or missing in import list
diff --git a/testsuite/tests/rename/should_fail/T11071.stderr b/testsuite/tests/rename/should_fail/T11071.stderr
new file mode 100644
index 0000000000..e3d5e30377
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T11071.stderr
@@ -0,0 +1,53 @@
+
+T11071.hs:19:12: error:
+ Not in scope: ‘NoSuchModule.foo’
+ No module named ‘NoSuchModule’ is imported.
+
+T11071.hs:20:12: error:
+ Not in scope: ‘Data.List.foobar’
+ Module ‘Data.List’ does not export ‘foobar’.
+
+T11071.hs:21:12: error:
+ Not in scope: ‘M.foobar’
+ Neither ‘Data.Map’ nor ‘Data.IntMap’ exports ‘foobar’.
+
+T11071.hs:22:12: error:
+ Not in scope: ‘M'.foobar’
+ Neither ‘Data.Map’, ‘Data.IntMap’ nor ‘System.IO’ exports ‘foobar’.
+
+T11071.hs:23:12: error:
+ Not in scope: ‘Data.List.sort’
+ Perhaps you want to add ‘sort’ to the import list in the import of
+ ‘Data.List’ (T11071.hs:3:1-24).
+
+T11071.hs:24:12: error:
+ Not in scope: ‘Data.List.unlines’
+ Perhaps you meant ‘Data.List.lines’ (imported from Data.List)
+ Perhaps you want to add ‘unlines’ to the import list
+ in the import of ‘Data.List’ (T11071.hs:3:1-24).
+
+T11071.hs:25:12: error:
+ Not in scope: ‘M.size’
+ Perhaps you want to add ‘size’ to one of these import lists:
+ ‘Data.Map’ (T11071.hs:4:1-33)
+ ‘Data.IntMap’ (T11071.hs:5:1-36)
+
+T11071.hs:26:12: error:
+ Not in scope: ‘M.valid’
+ Perhaps you meant one of these:
+ ‘M'.valid’ (imported from Data.Map),
+ ‘M'.valid’ (imported from Data.Map)
+ Perhaps you want to add ‘valid’ to the import list in the import of
+ ‘Data.Map’ (T11071.hs:4:1-33).
+
+T11071.hs:27:12: error:
+ Not in scope: data constructor ‘Ord.Down’
+ Perhaps you want to remove ‘Down’ from the explicit hiding list
+ in the import of ‘Data.Ord’ (T11071.hs:8:1-46).
+
+T11071.hs:28:12: error:
+ Not in scope: ‘M'.size’
+ Perhaps you want to remove ‘size’ from the hiding clauses
+ in one of these imports:
+ ‘Data.Map’ (T11071.hs:10:1-53)
+ ‘Data.IntMap’ (T11071.hs:12:1-48)
diff --git a/testsuite/tests/rename/should_fail/T2901.stderr b/testsuite/tests/rename/should_fail/T2901.stderr
index b240139bd8..d5a2247ce1 100644
--- a/testsuite/tests/rename/should_fail/T2901.stderr
+++ b/testsuite/tests/rename/should_fail/T2901.stderr
@@ -1,4 +1,7 @@
-T2901.hs:6:5: Not in scope: data constructor ‘F.Foo’
+T2901.hs:6:5: error:
+ Not in scope: data constructor ‘F.Foo’
+ No module named ‘F’ is imported.
-T2901.hs:6:13: ‘F.field’ is not a (visible) constructor field name
+T2901.hs:6:13: error:
+ ‘F.field’ is not a (visible) constructor field name
diff --git a/testsuite/tests/rename/should_fail/T5657.stderr b/testsuite/tests/rename/should_fail/T5657.stderr
index aa5f870b7b..5663b900d9 100644
--- a/testsuite/tests/rename/should_fail/T5657.stderr
+++ b/testsuite/tests/rename/should_fail/T5657.stderr
@@ -1,5 +1,7 @@
-T5657.hs:3:8: Not in scope: ‘LT..’
+T5657.hs:3:8: error:
+ Not in scope: ‘LT..’
+ No module named ‘LT’ is imported.
-T5657.hs:3:8:
+T5657.hs:3:8: error:
A section must be enclosed in parentheses thus: (LT.. GT)
diff --git a/testsuite/tests/rename/should_fail/T5892b.stderr b/testsuite/tests/rename/should_fail/T5892b.stderr
index 994ea78c11..0f93c21f68 100644
--- a/testsuite/tests/rename/should_fail/T5892b.stderr
+++ b/testsuite/tests/rename/should_fail/T5892b.stderr
@@ -1,2 +1,4 @@
-T5892b.hs:11:7: Not in scope: ‘T5892b.subForest’
+T5892b.hs:11:7: error:
+ Not in scope: ‘T5892b.subForest’
+ No module named ‘T5892b’ is imported.
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index 48814ec983..66dfeaa916 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -138,3 +138,4 @@ test('T10618', normal, compile_fail, [''])
test('T10668', normal, compile_fail, [''])
test('T5001b', normal, compile_fail, [''])
test('T10781', normal, compile_fail, [''])
+test('T11071', normal, compile_fail, [''])
diff --git a/testsuite/tests/rename/should_fail/rnfail030.stderr b/testsuite/tests/rename/should_fail/rnfail030.stderr
index 5b2cd36358..462dc5fa2c 100644
--- a/testsuite/tests/rename/should_fail/rnfail030.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail030.stderr
@@ -1,2 +1,5 @@
-rnfail030.hs:2:21: Not in scope: ‘Data.List.map’
+rnfail030.hs:2:21: error:
+ Not in scope: ‘Data.List.map’
+ Perhaps you want to add ‘map’ to the import list in the import of
+ ‘Data.List’ (rnfail030.hs:3:1-19).
diff --git a/testsuite/tests/rename/should_fail/rnfail031.stderr b/testsuite/tests/rename/should_fail/rnfail031.stderr
index 828d5121c8..95d8ea1561 100644
--- a/testsuite/tests/rename/should_fail/rnfail031.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail031.stderr
@@ -1,2 +1,5 @@
-rnfail031.hs:2:21: Not in scope: ‘Data.List.map’
+rnfail031.hs:2:21: error:
+ Not in scope: ‘Data.List.map’
+ Perhaps you want to add ‘map’ to the import list in the import of
+ ‘Data.List’ (rnfail031.hs:3:1-36).
diff --git a/testsuite/tests/rename/should_fail/rnfail032.stderr b/testsuite/tests/rename/should_fail/rnfail032.stderr
index 2169fd502e..70d80a0322 100644
--- a/testsuite/tests/rename/should_fail/rnfail032.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail032.stderr
@@ -1,7 +1,9 @@
-rnfail032.hs:2:21:
+rnfail032.hs:2:21: error:
Not in scope: ‘Data.List.map’
Perhaps you meant one of these:
‘Data.List.zip’ (imported from Data.List),
‘Data.List.all’ (imported from Data.List),
‘Data.List.and’ (imported from Data.List)
+ Perhaps you want to remove ‘map’ from the explicit hiding list
+ in the import of ‘Data.List’ (rnfail032.hs:3:1-41).
diff --git a/testsuite/tests/rename/should_fail/rnfail033.stderr b/testsuite/tests/rename/should_fail/rnfail033.stderr
index 6b6849d1e5..277b42fb16 100644
--- a/testsuite/tests/rename/should_fail/rnfail033.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail033.stderr
@@ -1,7 +1,9 @@
-rnfail033.hs:2:21:
+rnfail033.hs:2:21: error:
Not in scope: ‘Data.List.map’
Perhaps you meant one of these:
‘Data.List.zip’ (imported from Data.List),
‘Data.List.all’ (imported from Data.List),
‘Data.List.and’ (imported from Data.List)
+ Perhaps you want to remove ‘map’ from the explicit hiding list
+ in the import of ‘Data.List’ (rnfail033.hs:3:1-31).
diff --git a/testsuite/tests/rename/should_fail/rnfail034.stderr b/testsuite/tests/rename/should_fail/rnfail034.stderr
index 78bc649c29..63e6eb5037 100644
--- a/testsuite/tests/rename/should_fail/rnfail034.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail034.stderr
@@ -1,6 +1,7 @@
-rnfail034.hs:4:11: Qualified name in binding position: M.y
+rnfail034.hs:4:11: error: Qualified name in binding position: M.y
-rnfail034.hs:4:26:
+rnfail034.hs:4:26: error:
Not in scope: ‘M.y’
Perhaps you meant ‘M.g’ (line 4)
+ No module named ‘M’ is imported.
diff --git a/testsuite/tests/safeHaskell/ghci/p4.stderr b/testsuite/tests/safeHaskell/ghci/p4.stderr
index 5d70969f3a..a0dc5c319e 100644
--- a/testsuite/tests/safeHaskell/ghci/p4.stderr
+++ b/testsuite/tests/safeHaskell/ghci/p4.stderr
@@ -1,8 +1,9 @@
-
-<interactive>:5:9: error:
- Not in scope: ‘System.IO.Unsafe.unsafePerformIO’
-
-<interactive>:6:9: error:
- Variable not in scope: x :: IO Integer -> t
-
-<interactive>:7:1: error: Variable not in scope: y
+
+<interactive>:5:9: error:
+ Not in scope: ‘System.IO.Unsafe.unsafePerformIO’
+ No module named ‘System.IO.Unsafe’ is imported.
+
+<interactive>:6:9: error:
+ Variable not in scope: x :: IO Integer -> t
+
+<interactive>:7:1: error: Variable not in scope: y