diff options
author | roland <rsx@bluewin.ch> | 2018-11-04 16:45:29 +0100 |
---|---|---|
committer | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2018-11-04 16:45:29 +0100 |
commit | 1a3b9bd0b674ad16a41b942c738b8f34564bcd8d (patch) | |
tree | 6796e7d78d7c56c1c357dc431a66f35242ffa9f0 /testsuite/tests/rename/should_fail | |
parent | 2c959a1894311e59cd2fd469c1967491c1e488f3 (diff) | |
download | haskell-1a3b9bd0b674ad16a41b942c738b8f34564bcd8d.tar.gz |
Fix for Trac #15611: Scope errors lie about what modules are imported.
Summary:
For the error message:
Not in scope X.Y
Module X does not export Y
No module named ‘X’ is imported:
there are 2 cases, where we don't show the last "no module named is imported" line:
1. If the module X has been imported.
2. If the module X is the current module. There are 2 subcases:
2.1 If the unknown module name is in a input source file,
then we can use the getModule function to get the current module name.
2.2 If the unknown module name has been entered by the user in GHCi,
then the getModule function returns something like "interactive:Ghci1",
and we have to check the current module in the last added entry of
the HomePackageTable.
Test Plan: make test TESTS="T15611a T15611b"
Reviewers: monoidal, hvr, thomie, dfeuer, bgamari, DavidEichmann
Reviewed By: monoidal, DavidEichmann
Subscribers: rwbarton, carter
GHC Trac Issues: #15611
Differential Revision: https://phabricator.haskell.org/D5284
Diffstat (limited to 'testsuite/tests/rename/should_fail')
-rw-r--r-- | testsuite/tests/rename/should_fail/T15611a.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T15611a.stderr | 1 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T15611b.hs | 1 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T15611b.script | 2 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T15611b.stderr | 1 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T5892b.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/rnfail034.stderr | 1 |
8 files changed, 10 insertions, 4 deletions
diff --git a/testsuite/tests/rename/should_fail/T15611a.hs b/testsuite/tests/rename/should_fail/T15611a.hs new file mode 100644 index 0000000000..df1bb2f08c --- /dev/null +++ b/testsuite/tests/rename/should_fail/T15611a.hs @@ -0,0 +1,2 @@ +main :: IO () +main = Main.foo diff --git a/testsuite/tests/rename/should_fail/T15611a.stderr b/testsuite/tests/rename/should_fail/T15611a.stderr new file mode 100644 index 0000000000..ebeb83b5f2 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T15611a.stderr @@ -0,0 +1 @@ +T15611a.hs:2:8: Not in scope: ‘Main.foo’ diff --git a/testsuite/tests/rename/should_fail/T15611b.hs b/testsuite/tests/rename/should_fail/T15611b.hs new file mode 100644 index 0000000000..0ab721d1d1 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T15611b.hs @@ -0,0 +1 @@ +module T15611b where diff --git a/testsuite/tests/rename/should_fail/T15611b.script b/testsuite/tests/rename/should_fail/T15611b.script new file mode 100644 index 0000000000..d2b1fb1458 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T15611b.script @@ -0,0 +1,2 @@ +:l T15611b +T15611b.foo diff --git a/testsuite/tests/rename/should_fail/T15611b.stderr b/testsuite/tests/rename/should_fail/T15611b.stderr new file mode 100644 index 0000000000..609ab4c041 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T15611b.stderr @@ -0,0 +1 @@ +<interactive>:2:1: Not in scope: ‘T15611b.foo’ diff --git a/testsuite/tests/rename/should_fail/T5892b.stderr b/testsuite/tests/rename/should_fail/T5892b.stderr index 0f93c21f68..d55d0cb8e1 100644 --- a/testsuite/tests/rename/should_fail/T5892b.stderr +++ b/testsuite/tests/rename/should_fail/T5892b.stderr @@ -1,4 +1,2 @@ -T5892b.hs:11:7: error: - Not in scope: ‘T5892b.subForest’ - No module named ‘T5892b’ is imported. +T5892b.hs:11:7: error: Not in scope: ‘T5892b.subForest’ diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index 6debe7b917..9ca330f873 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -138,5 +138,7 @@ test('T15539', normal, compile_fail, ['']) test('T15487', normal, multimod_compile_fail, ['T15487','-v0']) test('T15659', normal, compile_fail, ['']) test('T15607', normal, compile_fail, ['']) +test('T15611a', normal, compile_fail, ['']) +test('T15611b', normal, ghci_script, ['T15611b.script']) test('ExplicitForAllRules2', normal, compile_fail, ['']) diff --git a/testsuite/tests/rename/should_fail/rnfail034.stderr b/testsuite/tests/rename/should_fail/rnfail034.stderr index 63e6eb5037..a5219c138b 100644 --- a/testsuite/tests/rename/should_fail/rnfail034.stderr +++ b/testsuite/tests/rename/should_fail/rnfail034.stderr @@ -4,4 +4,3 @@ rnfail034.hs:4:11: error: Qualified name in binding position: M.y rnfail034.hs:4:26: error: Not in scope: ‘M.y’ Perhaps you meant ‘M.g’ (line 4) - No module named ‘M’ is imported. |